ComplexNumber Class

You are asked to create a class ComplexNumber that encapsulates the behavior of a complex number. A complex number is a number that can be expressed in the form a + bi, where a and b are real numbers, and i is a solution of the equation x2=−1x^2 = -1. Because no real number satisfies this equation, i is called an imaginary number (−1\sqrt{-1}).

Your ComplexNumber class should have the following attributes:

  • real: The real part of the complex number (a)

  • imaginary: The imaginary part of the complex number (b)

You have to implement these magic methods:

  • __add__: This method should add two complex numbers and return a new ComplexNumber object that represents the result: (a1+a2)+(b1+b2)i(a_1 + a_2) + (b_1 + b_2) i.

  • __sub__: This method should subtract one complex number from another and return a new ComplexNumber object that represents the result: (a1−a2)+(b1−b2)i(a_1 - a_2) + (b_1 - b_2) i.

  • __mul__: This method should multiply two complex numbers and return a new ComplexNumber object that represents the result: (a1⋅a2−b1⋅b2)+(a1⋅b2+b1⋅a2)i(a_1 \cdot a_2 - b_1 \cdot b_2) + (a_1 \cdot b_2 + b_1 \cdot a_2) i.

  • __truediv__: This method should divide one complex number by another and return a new ComplexNumber object that represents the result: a1⋅a2+b1⋅b2a22+b22+b1⋅a2−a1⋅b2a22+b22i\frac{ a_1 \cdot a_2 + b_1 \cdot b_2 }{ a_2^2 + b_2^2 } + \frac{ b_1 \cdot a_2 - a_1 \cdot b_2 }{ a_2^2 + b_2^2 }i.

Besides the numerical magic methods, you should also implement a __str__ magic method that would return the complex number as <real> + <imaginary> i.

Input

Output

print(ComplexNumber(1, 1) + ComplexNumber(2, 2)); print(ComplexNumber(2, 3) - ComplexNumber(1, 1)); print(ComplexNumber(2, 3) * ComplexNumber(1, 1)); print(ComplexNumber(2, 2) / ComplexNumber(1, 1)); print(ComplexNumber(1, 1) - ComplexNumber(2, 3))

3 + 3 i
1 + 2 i
-1 + 5 i
2.0 + 0.0 i
-1 + -2 i

Constraints

Time limit: 1.6 seconds

Memory limit: 512 MB

Output limit: 1 MB