import java.util.Scanner;
public class ImpComplex{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double real1=in.nextDouble();
double image1=in.nextDouble();
double real2=in.nextDouble();
double image2=in.nextDouble();
ComplexNumber a=new ComplexNumber(real1,image1);
ComplexNumber b=new ComplexNumber(real2,image2);
System.out.printf("Real:%.2f imaginary:%.2f ",a.getRealPart(),a.getImaginaryPart());
System.out.printf("Real:%.2f imaginary:%.2f ",b.getRealPart(),b.getImaginaryPart());
System.out.println(a.complexAdd(b));
System.out.println(a.complexMinus(b));
System.out.println(a.complexMulti(b));
System.out.println(a.complexDivide(b));
}
}
class ComplexNumber {
private double m_dRealPart;
private double m_dImaginPart;
ComplexNumber(double r, double i) {
this.m_dRealPart = r;
this.m_dImaginPart = i;
}
ComplexNumber() {
this.m_dRealPart = 0;
this.m_dImaginPart = 0;
}
public double getImaginaryPart() {
return this.m_dImaginPart;
}
public double getRealPart() {
return this.m_dRealPart;
}
public ComplexNumber setRealPart(double d){
this.m_dRealPart = d;
return this;
}
public ComplexNumber setImaginaryPart(double d){
this.m_dImaginPart = d;
return this;
}
public ComplexNumber complexConjugate(){
ComplexNumber c = new ComplexNumber();
c.m_dRealPart = this.m_dRealPart;
c.m_dImaginPart = -this.m_dImaginPart;
return c;
}
public ComplexNumber complexAdd(ComplexNumber c) {
ComplexNumber a = new ComplexNumber();
a.m_dRealPart = this.m_dRealPart + c.m_dRealPart;
a.m_dImaginPart = this.m_dImaginPart + c.m_dImaginPart;
return a;
}
public ComplexNumber complexAdd(double c){
ComplexNumber a = new ComplexNumber();
a.m_dRealPart = this.m_dRealPart + c;
a.m_dImaginPart = this.m_dImaginPart;
return a;
}
public ComplexNumber complexMinus(ComplexNumber c) {
ComplexNumber a = new ComplexNumber();
a.m_dRealPart = this.m_dRealPart - c.m_dRealPart;
a.m_dImaginPart = this.m_dImaginPart - c.m_dImaginPart;
return a;
}
public ComplexNumber complexMinus(double c) {
ComplexNumber a = new ComplexNumber();
a.m_dRealPart = this.m_dRealPart - c;
a.m_dImaginPart = this.m_dImaginPart;
return a;
}
public ComplexNumber complexMulti(ComplexNumber c) {
ComplexNumber a = new ComplexNumber();
a.m_dRealPart = this.m_dRealPart * c.m_dRealPart - this.m_dImaginPart * c.m_dImaginPart;
a.m_dImaginPart = this.m_dRealPart * c.m_dImaginPart + this.m_dImaginPart * c.m_dRealPart;
return a;
}
public ComplexNumber complexMulti(double c) {
ComplexNumber a = new ComplexNumber();
a.m_dRealPart = this.m_dRealPart * c;
a.m_dImaginPart = this.m_dImaginPart * c;
return a;
}
public ComplexNumber complexDivide(ComplexNumber c) {
ComplexNumber a = new ComplexNumber();
a.m_dRealPart = (c.m_dRealPart * this.m_dRealPart + c.m_dImaginPart * this.m_dImaginPart) / (c.m_dRealPart * c.m_dRealPart + c.m_dImaginPart * c.m_dImaginPart);
a.m_dImaginPart = (c.m_dRealPart * this.m_dImaginPart - this.m_dRealPart * c.m_dImaginPart) / (c.m_dRealPart * c.m_dRealPart + c.m_dImaginPart * c.m_dImaginPart);
return a;
}
public ComplexNumber complexDivide(double c){
ComplexNumber a = new ComplexNumber();
a.m_dRealPart = this.m_dRealPart / c;
a.m_dImaginPart = this.m_dImaginPart /c;
return a;
}
public String toString(){
return(this.m_dRealPart + "+" + this.m_dImaginPart + "i");
}
}