This page is still under construction.

Parts of this page are still being built. What you see may change.

Drift

Time limit2sMemory limit512 MB

Summary
Find the minimum time for a car with top speed v, acceleration a and braking b to cover two segments x and y joined by a 90 degree turn where the speed must drop to exactly 0.
Level

Medium6 of 10

Topics
Math, Greedy, Implementation, Binary search
Solved
No attempts yet

Problem

Berland is preparing for the next round of I2011-class car racing.

Cars of this class cannot move faster than vv m/s, when accelerating the engine power is enough to produce any acceleration not exceeding aa m/s2^2, and when braking the absolute value of the acceleration does not exceed bb m/s2^2.

The track in Berland is laid out as follows. First comes a long straight on which cars can accelerate to any speed from 0 to vv. Then comes the start line, followed by a segment of length xx m, a 90∘90^\circ turn, and a segment of length yy m, after which is the finish line. A car may cross the finish line at any speed.

To get through the turn, using a controlled drift is recommended. To do this, the car must brake so that its speed is exactly 0 at the turn. After that, by jerking the steering wheel in the direction of the turn and sharply pressing the gas, it can move onto the second segment of the track without losing time.

Vitaly plans to take part in the competition. He decided to work out the minimum time in which he can complete the track. Help him do this.

Input

The input file contains five integers: vv, xx, yy, aa, bb (1≤v,x,y,a,b≤1061 \leq v, x, y, a, b \leq 10^6).

Output

Print the minimum time in which the whole track can be completed. Your answer must have an absolute or relative error of at most 10−810^{-8}.

Hint

In the given example, the following should be done. On the acceleration straight, accelerate to the maximum possible speed of 4 m/s. After the start, drive 6 m at the maximum possible speed in 1.5 s, then brake to 0 over 2 s using the maximum possible braking, covering the remaining 4 m to the turn along the way. Entering the turn with a drift, press the gas and accelerate at maximum acceleration for 4 s up to the maximum speed of 4 m/s, covering 8 m in that time. After that, cover the remaining 4 m to the finish in 1 s at maximum speed. The total time to complete the track is 1.5+2+4+1=8.51.5+2+4+1=8.5 s.

Examples1

  1. Example 1

    Input
    4 10 12 1 2
    
    Expected output
    8.5