Consider two infinite horizontal train rails, so close that we can regard them to be coincident. On the first rail there is a train of length . To its right, on the second rail and distance units apart, there is a train of length . This simple picture corresponds to all the cases of the sample input, with , and :
(70,10) (10,06)10 (30,04)30 (55,06)20
(05,04)(15,04) (45,04)(65,04)
(05,06)(09,06) (11,06)(15,06) (15,04)(29,04) (31,04)(45,04) (45,06)(54,06) (56,06)(65,06)
The first train has velocity and constant acceleration . The second train has velocity and constant acceleration . Positive means to the right, negative means to the left. For how many time units will the trains overlap, at least partially?
Input consists of several cases, with only integer numbers, each one with , , , , , and . Assume that , and are strictly positive. No number is larger than in absolute value.
For every case, print with four digits after the decimal point the amount of time that both trains will overlap. The input cases have no precision issues.
Input
10 20 30 10 0 20 0 10 20 30 10 0 -10 5 10 20 30 10 0 -10 1 10 20 30 10 0 -10 -10
Output
0.0000 4.0000 3.4118 0.8377