Problem: Everybody knows that the capital of Berland is connected to Bercouver (the Olympic capital) by a direct road. To improve the road's traffic capacity, there was placed just one traffic sign, limiting the maximum speed. Traffic signs in Berland are a bit peculiar, because they limit the speed only at that point on the road where they are placed. Right after passing the sign it is allowed to drive at any speed.

It is known that the car of an average Berland citizen has the acceleration (deceleration) speed of a km/h2, and has maximum speed of v km/h. The road has the length of l km, and the speed sign, limiting the speed to w km/h, is placed d km (1 ≤ d < l) away from the capital of Berland. The car has a zero speed at the beginning of the journey. Find the minimum time that an average Berland citizen will need to get from the capital to Bercouver, if he drives at the optimal speed.

The car can enter Bercouver at any speed.

Input

The first line of the input file contains two integer numbers a and v (1 ≤ a, v ≤ 10000). The second line contains three integer numbers l, d and w (2 ≤ l ≤ 10000; 1 ≤ d < l; 1 ≤ w ≤ 10000).

Output

Print the answer with at least five digits after the decimal point.

Examples

Input

1 1
2 1 3


Output

2.500000000000


Input

5 70
200 170 40


Output

8.965874696353

Solution (in PYTHON3):

Solution:
#!/usr/bin/env python
"""
CodeForces: 5D Follow Trafic Rules

Basic equations for acceleration, distance and velocity (speed):

    eqn-1) final velocity:      v = v0 + a * t
    eqn-2) distance traveled:   d = v0 * t + a * t * t / 2
    eqn-3) acceleration:        v * v - v0 * v0 = 2 * a * d

    Symbols stand for:
        a: acceleration
        d: distance traveled
        t: travel time
        v0: initial speed
        v: final speed
"""

from math import sqrt


def main():
    a, v = map(int, input().split())
    l, d, w = map(int, input().split())


    # if v <= w, virtually no speed limit
    if v <= w:
        w = v

    # there are three cases before reaching the sign:
    # Case 1: unable to drive over the speed limit
    #   i.e. no need to decelerate during the travel
    # Case 2: able to drive over the speed limit
    #   Case 2a: able to drive at the max speed
    #     i.e. accelerate and deceleration
    #   Case 2b: unable to drive at the max speed
    #     i.e. find the possible max speed, then same as case 2a

    ax2 = a * 2
    vxv = v * v
    wxw = w * w
    ax2xd = ax2 * d

    # eqn-3:
    #   d1 = travel distance to reach the speed limit
    #   w * w - 0 * 0 = 2 * a * d1
    # if d1 >= d or v == w, then Case 1
    # otherwise Case 2
    if wxw >= ax2xd or v == w:
        # Case 1: unable to drive over the speed limit

        # check if able to drive at the max spped before reaching the goal
        # eqn-3:
        #   m = distance to reach the max speed
        #   v * v - 0 * 0 = 2 * a * m
        # if m <= l (distance to the goal), then
        #   2 * a * s <= 2 * a * l
        #   v * v <= 2 * a * l
        if vxv <= ax2 * l:
            # able to drive at the max speed
            # eqn-1:
            #   t1 = time to reach the max speed
            #   v = a * t1
            # eqn-3:
            #   d1 = distance traveled to reach the max speed
            #   v * v = 2 * a * d1
            # equation:
            #   d2 = remaining distance = l - d1
            #   t2 = remaining time
            #   d2 = v * t2
            hours = (v / a) + ((l - (vxv / ax2)) / v)
        else:
            # unable to drive at the max speed
            # eqn-2: time of the entire travel
            #   l = a * t * t / 2
            hours = sqrt(2.0 * l / a)
    else:
        # Case 2: able to drive over the speed limit
        # there are three steps:
        #  Step 1: find the possible max speed and
        #          travel distance at that speed
        #    Step 1a: Case 2a
        #    Step 1b: Case 2b
        #  Step 2: calculate the time to the sing
        #  Step 3: calculate the time after the sign

        # Step 1: find the possible max speed (p)
        #         and the distance travels (r) at the possible max speed
        # eqn-3:
        #   d1 = distance to the max speed (acceleration)
        #   d2 = distance to the speed limit (deceleration)
        #   v * v - 0 * 0 = 2 * a * d1
        #   v * v - w * w = 2 * a * d2  <--  w * w - v * v = 2 * (-a) * d2
        # add two equations:
        #   v * v + (v * v - w * w) = 2 * a * (d1 + d2)
        # if (d1 + d2) <= d, then Case 2a
        # otherwise Case 2b
        vxv_wxw = vxv - wxw
        s = vxv + vxv_wxw
        if s <= ax2xd:
            # Case 2a: able to drive at the max speed
            # i.e. find the distance travels (r) at the max speed
            # eqn-3:
            #   v * v + (v * v - w * w) = 2 * a * (d1 + d2)
            #   d1 + d2 + r = d
            p = v
            r = d - (s / ax2)
        else:
            # Case 2b: unable to drive at the max speed
            # i.e. find the possible max speed (p)
            # eqn-3:
            #   d1 = distance to reach the possible max speed
            #   d2 = distance to reach the speed limit
            #   p = possible max speed when d1 + d2 == d
            #   p * p - 0 * 0 = 2 * a * d1
            #   p * p - w * w = 2 * a * d2  <--  w * w - p * p = 2 * (-a) * d2
            # add two equation
            #   2 * (p * p) - (w * w) = 2 * a * (d1 + d2)
            p = sqrt((ax2xd + wxw) * 0.5)
            r = 0

        # Step 2: calculate the time to the sign

        # Time to reach the sign
        # eqn-2:
        #   t1, d1 = time and distance to reach the possible max speed
        #   t2, d2 = time and distance to reach the speed limit
        #   p = 0 + a * t1
        #   p - w = a * t2  <--  w = p + (-a) * t2
        # add two equations:
        #   p + (p - w) = a * (t1 + t2)
        # equation:
        #   r = travel distance at the possible max speed
        #   t3 = travel time at the possible max speed
        #   r = p * t3
        hours = ((p + (p - w)) / a) + (r / p)

        # Step 3: time after the sign

        # Check if able to drive at the max speed
        # eqn-2:
        #   d1 = distance to reach the max speed
        #   v * v - w * w = 2 * a * d1
        # if d1 >= d, able to drive at the max speed
        # else possible reach the max speed
        g = l - d
        s = ax2 * g
        if vxv_wxw >= s:
            # reach the goal before reaching the max speed
            # eqn-2:
            #   g = remaining distance
            #   t1 = time to the goal
            #   g = l - d = w * t1 + a * t1 * t1 / 2
            # solve the equation for t1 (positive):
            #   t1 = (sqrt(2 * a * g - w * w) - w) / a
            hours += (sqrt(s + wxw) - w) / a
        else:
            # possible to reach the max before reaching the goal
            # eqn-1:
            #   t1 = time to reach the max speed
            #   v = w + a * t1
            # eqn-3:
            #   d1 = distance to reach the max speed
            #   v * v - w * w = 2 * a * d1
            # equation:
            #   d2 = remaining distance after reaching the max speed
            #   t2 = time after reaching the max speed
            #   d2 = g - d1 = v * t2
            hours += ((v - w) / a) + ((g - (vxv_wxw / ax2)) / v)

    print("{:.12f}".format(hours))


if __name__ == '__main__':
    main()