#include
#include
using namespace std;
class Complex{
public:
Complex(double r=0,double i=0);
Complex operator +(const Complex& c);
Complex operator -(const Complex& c);
void print() const;
private:
double real,imag;
};
Complex::Complex(double r , double i){
real=r;
imag=i;
}
Complex Complex::operator +(const Complex& c){
double r=real+c.real;
double i=imag+c.imag;
return Complex(r,i);
}
Complex Complex::operator -(const Complex& c){
double r=real-c.real;
double i=imag-c.imag;
return Complex(r,i);
}
void Complex::print() const{
cout<<real<<'+'<<imag<<'i'<<endl;
}
int main()
{
double r, i;
cin >> r >> i;
Complex c(r, i);
cin >> r >> i;
Complex n(r, i);
Complex c1=c+n;
Complex c2=c-n;
c1.print();
c2.print();
return 0;
}