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 PYTHON):

Solution:
from math import sqrt

def float_cmp(x, y = 0, tol = 1e-9):
    return (-1 if x + tol < y else 0) if x <= y + tol else 1

def velocity_at_d(k):
    det = 2*a * (2*k - d)
    return sqrt(det)    if det >= 0 else    0

def velocity_at_d_vm(k):
    det = v**2 - 2*a*(d-k)
    return sqrt(det)    if det >= 0 else    0

def binary_search(low, high, f, y):
    while float_cmp(low, high) != 0:
        x = (low + high) / 2
        fx = f(x)

        # print "(%.2f - %.2f) : f(%.2f) = %.2f vs. %2f" % (low, high, x, fx, y)
        
        if float_cmp(fx, y) < 0:
            low = x
        elif float_cmp(fx, y) > 0:
            high = x
        else:
            return x
        
    return x


a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

td = sqrt(2 * d/a)  # time to get to sign
vd = a * td         # speed at sign

if float_cmp(min(v, vd), w) <= 0:
    # car's limit speed is le. than sign speed
    # or speed at sign is le. than sign speed

    if float_cmp(v, sqrt(2*a*l)) >= 0:
        # limit speed is greater than achievable speed
        time = sqrt(2 * l/a)
    else:
        time = v/a    # time to get to limit speed
        distance = a/2 * time**2
        time += (l - distance) / v

else:
    k = binary_search(0, d, velocity_at_d, w)
    vk = sqrt(2*a*k)

    if float_cmp(vk, v) <= 0:
        # we can reach the peak
        time = sqrt(2 * k/a) + (vk - w) / a
    else:
        # get as close as the peak as we can
        time = v/a    # time to get to limit speed
        distance = a/2 * time**2

        k = binary_search(distance, d, velocity_at_d_vm, w)
        time += (k - distance) / v + (v - w) / a

    t = (v - w) / a    # time to get to limit speed
    distance = a/2 * t**2 + w * t

    if float_cmp(d + distance, l) <= 0:
        # we reach top velocity before arriving
        time += t + (l - d - distance) / v
    else:
        # we reach top velocity after arriving
        time += (-w + sqrt(w**2 - 2*a*(d-l)))/a

print time