100 #ABC183B. [ABC183B] Billiards

[ABC183B] Billiards

Score : 200200 points

Problem Statement

Takahashi is playing billiards on a two-dimensional plane. The xx-axis functions as a wall; when a ball hits the axis, it will bounce off the axis so that the angle of incidence equals the angle of reflection.

Takahashi's ball is now at (Sx,Sy)(S_x,S_y). When he strikes the ball aiming for some point, it will roll in a straight line towards that point.

To make the ball hit the xx-axis exactly once and then pass (Gx,Gy)(G_x, G_y), where along the xx-axis should he aim for?

Constraints

  • 106Sx,Gx106-10^6 \leq S_x, G_x \leq 10^6
  • 0<Sy,Gy1060 < S_y, G_y \leq 10^6
  • SxGxS_x \neq G_x
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

SxS_x SyS_y GxG_x GyG_y

Output

Let (x,0)(x, 0) be the point Takahashi should aim for. Print xx.

Your output will be considered correct when its absolute or relative error from our answer is at most 10610^{-6}.

1 1 7 2
3.0000000000

As shown below, we can make the ball pass (7,2)(7, 2) by striking it aiming for (3,0)(3, 0).

Figure

1 1 3 2
1.6666666667

Figure

-9 99 -999 9999
-18.7058823529

The output will be considered correct when its absolute or relative error from our answer is at most 10610^{-6}.