On the same rail there are two trains approaching each other.
The train at the left goes to the right at constant speed *t*_{1}.
The train at the right goes to the left at constant speed *t*_{2}.
Initially, the noses of the trains are *d* distance units apart.
There is a fly at the nose of the left train
that starts flying to the right at constant speed *f*_{1},
where *f*_{1} > *t*_{1}.
Similarly, there is a fly at the nose of the right train
that starts flying to the left at constant speed *f*_{2},
where *f*_{2} > *t*_{2}.
The flies are so small that we can consider them as points.
Any time that a fly reaches another fly, or reaches a train,
that fly turns around immediately,
never changing the absolute value of its speed.
Thus, the movement of each fly is like a zig-zag
with an infinite number of rebounds.

Given all the information, can you compute the total distance travelled by each fly until the trains collide? If so, you would prove yourself even better than von Neumann!

**Input**

Input consists of several cases,
each one with *d*, *t*_{1}, *t*_{2}, *f*_{1} and *f*_{2}.
All given numbers are strictly positive integers,
and no larger than 10^{6}.
Assume *f*_{1} > *t*_{1} and *f*_{2} > *t*_{2}.

**Output**

For every case, print with four digits after the decimal point the total distance travelled by the first fly and by the second fly. The given cases have no precision issues.

Public test cases

**Input**

1 1 1 2 2 1234 12 23 42 100

**Output**

1.0000 1.0000 1480.8000 3525.7143

Information

- Author
- Salvador Roura
- Language
- English
- Other languages
- Catalan
- Official solutions
- C++
- User solutions
- C++
- Event
- Catorzè Concurs de Programació de la UPC - Semifinal
- Date
- 2016-06-29