Hide

Problem B
Invoker (Easy)

You are an invoker, a master sorcerer that is able to command sources of magic.

Magical Training

There are two sources of magic you can control, $\mathbb {R}$eagus and $\mathbb {I}$magus. Each source has a potency coefficient in front of it. This potency is a real number at most $10^6$ in absolute value.

As an invoker you have the choice of combining two sources of magic (denoted $\oplus $), or casting one on to another (denoted $\otimes $).

The rules for combining sources is as follows:

  • Combining a source of Reagus or Imagus with another source of equal type creates the same type but you add the potencies.

    • $x\mathbb {R}\oplus y\mathbb {R}=(x+y)\mathbb {R}$

    • $x\mathbb {I}\oplus y\mathbb {I}=(x+y)\mathbb {I}$

  • Combining a source of Reagus and Imagus together creates a new complex form of magic.

    • $x\mathbb {R}\oplus y\mathbb {I} \in \mathbb {C}_{\mathbb {M}}$

Casting sources of magic has some different laws:

  • Casting Reagus on to Reagus creates a source of Reagus whose potency is the product of the previous sources.

    • $x\mathbb {R}\otimes y\mathbb {R} = (x\cdot y)\mathbb {R}$

  • Casting Imagus on to another source of Imagus creates anti-Reagus (negative potency) with a potency of the product of the two sources.

    • $x\mathbb {I}\otimes y\mathbb {I} = -(x\cdot y)\mathbb {R}$

  • Casting Reagus on Imagus or Imagus on Reagus creates Imagus with a potency of the product of the two sources.

    • $x\mathbb {R}\otimes y\mathbb {I} = (x\cdot y)\mathbb {I}$

Another thing that you remember well from your studies is that for every magical source, there is an anti-source that when cast will neutralize the magical energies.

\[ \forall s\in \mathbb {M}~ \exists s^{-1}\in \mathbb {M} : s\otimes s^{-1} = \epsilon \]

where $\mathbb {M}$ is the set of non-zero magical sources and $\epsilon $ is the neutral source, or $1\mathbb {R}$.

Additionally, every magic source $s$ has a magic complement $s^\dagger $ such that:

\[ \begin{aligned} s=x\mathbb {R}& \rightarrow s^\dagger =s\\ s=y\mathbb {I}& \rightarrow s^\dagger =-s\\ s=x\mathbb {R}\oplus y\mathbb {I}& \rightarrow s+s^\dagger =2x\mathbb {R} \end{aligned} \]

Casting a magic source on its complement (or visa versa), generates a non-negative number known as the potency norm of the source.

\[ s\otimes s^\dagger = |s|^2 \]

Problem

You are currently locked in battle against an equally powerful foe. You recognize that you can defeat them by neutralizing their source of magic. That is, you cast a spell on them that will turn their source into the neutral source $\epsilon = 1\mathbb {R}$.

However, magic is not without its consequences. Any source you cast on your opponent will also be cast on you as well, changing your current magical source.

When the dust settles and you are declared victorious, what is your new magical source?

Input

The inputs are two magical sources separated by new lines. Each line contains two space-separated integers. The first integer is the potency of Reagus, and the second integer is the potency of Imagus.

The first line contains your sources $a,b$, and the second line contains your opponents sources $c,d$.

All sources are integers in the range $-10^6 \le a,b,c,d \le 10^6$, and neither source has both potencies equal to zero.

Output

Output your resulting source after you have annihilated your opponent. The output should be two space-separated values $x,y$. $x$ is the potency of Reagus and $y$ the potency of Imagus present in your final source.

Your answers will be accepted if they have an absolute or relative error of at most $10^{-5}$.

Sample Input 1 Sample Output 1
1 2
3 4
0.44 0.08
Sample Input 2 Sample Output 2
3 3
3 3
1.0 0.0

Please log in to submit a solution to this problem

Log in