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.io.*;
import java.util.*;

public class Main {

    private static FastScanner fastScanner;
    private static FastPrinter fastPrinter;

    public static void main(String[] args) throws IOException {

        boolean onlineJudge = System.getProperty("ONLINE_JUDGE") != null;

        fastScanner = onlineJudge ?
                new FastScanner(new InputStreamReader(System.in)) :
                new FastScanner(new FileReader("input.in"));
        fastPrinter = onlineJudge ?
                new FastPrinter(new OutputStreamWriter(System.out)) :
                new FastPrinter(new FileWriter("output.out"));

        Locale.setDefault(Locale.US);
        new Main().solve(args);

        fastScanner.close();
        fastPrinter.close();

    }

    private final int SCALE = 2000;

    private double a;
    private double v;
    private double len;
    private double d;
    private double w;

    private double f(double t) {
        double tStop = (a * t - w) / a;

        return a * t * t / 2 + a * t * tStop - a * tStop * tStop / 2;
    }

    private double binSearch() {
        double l = w / a;
        double r = v / a;
        for (int i = 0; i < SCALE; i++) {
            double m = (l + r) / 2;

            if (f(m) <= d)
                l = m;
            else
                r = m;
        }

        return l;
    }

    private void solve(String[] args) throws IOException {
        a = fastScanner.nextInt();
        v = fastScanner.nextInt();
        len = fastScanner.nextInt();
        d = fastScanner.nextInt();
        w = fastScanner.nextInt();

        if (v < w) {
            double tAcs = v / a;

            if (a * tAcs * tAcs / 2 > len)
                fastPrinter.println(Math.sqrt(2 * len / a));
            else
                fastPrinter.println(tAcs + (len - a * tAcs * tAcs / 2) / v);
        } else {
            double result;
            double v2;

            if (a * (w / a) * (w / a) / 2 >= d) {
                result = Math.sqrt(2 * d / a);
                v2 = a * Math.sqrt(2 * d / a);
            } else {
                double tAcs = binSearch();

//                System.out.println("tAcs " + tAcs);
//                System.out.println("f(tAcs) " + f(tAcs));
//                System.out.println(a * tAcs * tAcs / 2);
//                System.out.println("tStop " + (a * tAcs - w) / a);
//                System.out.println(a * tAcs * (a * tAcs - w) / a - a * (a * tAcs - w) / a * (a * tAcs - w) / a / 2);

                result = tAcs + (tAcs * a - w) / a + (d - f(tAcs)) / (tAcs * a);
                v2 = w;
            }

//        System.out.println(result);

//        System.out.println("v2 " + v2);
            double tToMax = (v - v2) / a;
            double xToMax = v2 * tToMax + a * tToMax * tToMax / 2;

            if (d + xToMax < len) {
                result += tToMax;
                result += (len - (d + xToMax)) / v;
            } else {
                result += (-v2 + Math.sqrt(v2 * v2 - 2 * a * (d - len))) / a;
            }

            fastPrinter.printf("%.9f\n", result);
        }
    }
}

class FastScanner {

    private BufferedReader bufferedReader;
    private StringTokenizer stringTokenizer;

    public FastScanner(Reader reader) {
        bufferedReader = new BufferedReader(reader);
        stringTokenizer = new StringTokenizer("");
    }

    public String nextLine() throws IOException {
        return bufferedReader.readLine();
    }

    public String nextToken() throws IOException {
        if (!stringTokenizer.hasMoreTokens())
            stringTokenizer = new StringTokenizer(bufferedReader.readLine());

        return stringTokenizer.nextToken();
    }

    public String nextToken(String delim) throws IOException {
        if (!stringTokenizer.hasMoreTokens())
            stringTokenizer = new StringTokenizer(bufferedReader.readLine());

        return stringTokenizer.nextToken(delim);
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public String nextWord() throws IOException {
        return nextToken();
    }

    public void close() throws IOException {
        stringTokenizer = null;
        bufferedReader.close();
    }
}

class FastPrinter {

    private BufferedWriter bufferedWriter;
    private PrintWriter printWriter;

    public FastPrinter(Writer writer) {
        bufferedWriter = new BufferedWriter(writer);
        printWriter = new PrintWriter(bufferedWriter);
    }

    public void println() {
        printWriter.println();
    }

    public void println(int x) {
        printWriter.println(x);
    }

    public void println(long x) {
        printWriter.println(x);
    }

    public void println(double x) {
        printWriter.println(x);
    }

    public void println(char x) {
        printWriter.println(x);
    }

    public void println(String x) {
        printWriter.println(x);
    }

    public void print(int x) {
        printWriter.print(x);
    }

    public void print(long x) {
        printWriter.print(x);
    }

    public void print(double x) {
        printWriter.print(x);
    }

    public void print(char x) {
        printWriter.print(x);
    }

    public void print(String x) {
        printWriter.print(x);
    }

    public void printf(Locale locale, String format, Object... args) {
        printWriter.printf(locale, format, args);
    }

    public void printf(String format, Object... args) {
        printWriter.printf(format, args);
    }

    public void close() throws IOException {
        printWriter.flush();
        printWriter.close();
        bufferedWriter.close();
    }
}