#include <iostream>
#include <limits>
using namespace std;

class Complex {
    float real, imag;
public:
    Complex() {
        real = imag = 0;
    }
    Complex(float r, float i) {
        real = r;
        imag = i;
    }

    // Operator overloading for addition
    Complex operator+(Complex &c) {
        return Complex(real + c.real, imag + c.imag);
    }

    // Operator overloading for subtraction
    Complex operator-(Complex &c) {
        return Complex(real - c.real, imag - c.imag);
    }

    // Function to display in a + bi format
    void display(string label) {
        cout << label << ": " << real << " + " << imag << "i" << endl;
    }
};

int main() {
    float r1, i1, r2, i2;

    // Input validation
    if (!(cin >> r1 >> i1)) {
        cout << "Invalid input";
        return 0;
    }
    if (!(cin >> r2 >> i2)) {
        cout << "Invalid input";
        return 0;
    }

    // Range check
    if (r1 < -1000 || r1 > 1000 || i1 < -1000 || i1 > 1000 ||
        r2 < -1000 || r2 > 1000 || i2 < -1000 || i2 > 1000) {
        cout << "Invalid input";
        return 0;
    }

    Complex c1(r1, i1), c2(r2, i2);
    Complex add = c1 + c2;
    Complex sub = c1 - c2;

    cout << "Addition: " << add.real << " + " << add.imag << "i" << endl;
    cout << "Subtraction: " << sub.real << " + " << sub.imag << "i" << endl;

    return 0;
}
