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

Solution:
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class RespectTheRules {
    private static final double E = 1E-10;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double a = scanner.nextDouble();
        double maxV = scanner.nextDouble();
        double l = scanner.nextDouble();
        double d = scanner.nextDouble();
        double w = scanner.nextDouble();

        double r = l - d;
        w = Math.min(w, maxV);

        List<WayPoint> wayPoints = new ArrayList<WayPoint>(256);
        double t = 0;

        wayPoints.add(new WayPoint(0));

        double dW = dTo(w, 0, a);
        if (leq(dW, d)) {
            wayPoints.add(new WayPoint(w));
            {
                double v = v(w, a, (d - dW) / 2);
                v = Math.min(v, maxV);

                wayPoints.add(new WayPoint(v));
                wayPoints.add(new WayPoint(w));

                double dW_V = dTo(v, w, a);
                double vDistance = d - dW - 2 * dW_V;
                if (!eq(vDistance)) {
                    t += vDistance / maxV;
                }
            }
            {
                double dW_MaxV = dTo(maxV, w, a);
                dW_MaxV = Math.min(dW_MaxV, r);
                double v = v(w, a, dW_MaxV);
                wayPoints.add(new WayPoint(v));
                double dMaxV = r - dW_MaxV;
                if (!eq(dMaxV)) {
                    t += dMaxV / maxV;
                }
            }

        } else {
            double dMaxV = dTo(maxV, 0, a);
            dMaxV = Math.min(dMaxV, l);
            double v = v(0, a, dMaxV);
            wayPoints.add(new WayPoint(v));
            double dv = l - dMaxV;
            if (!eq(dMaxV)) {
                t += dv / maxV;
            }
        }

        for (int i = 1; i < wayPoints.size(); ++i) {
            double v0 = wayPoints.get(i - 1).v;
            double v = wayPoints.get(i).v;
            t += Math.abs(tTo(v, v0, a));
        }
        System.out.println(t);
    }

    static double tTo(double v, double v0, double a) {
        return (v - v0) / a;
    }

    static double dTo(double v, double v0, double a) {
        return (v * v - v0 * v0) / (2 * a);
    }

    static double v(double v0, double a, double d) {
        return Math.sqrt(2 * d * a + v0 * v0);
    }

    static boolean eq(double value) {
        return Math.abs(value) <= E;
    }

    static boolean l(double v) {
        return v < -E;
    }

    static boolean leq(double v) {
        return l(v) || eq(v);
    }

    static boolean leq(double one, double another) {
        return leq(one - another);
    }

    static class WayPoint {
        double v;

        WayPoint(double v) {
            this.v = v;
        }
    }
}