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:
/**
 * ******* Created on 18/9/19 7:47 PM*******
 */

import java.io.*;
import java.text.DecimalFormat;
import java.util.*;

public class DCon5 {
    public static final double eps = 1e-12;
    public static void main(String[] args) throws IOException {

        try (Input input = new StandardInput(); PrintWriter writer = new PrintWriter(System.out)) {
            double caracc , carspeed, totaldis, bp, w;
            caracc = input.nextDouble();carspeed= input.nextDouble();
            totaldis= input.nextDouble();bp = input.nextDouble();w = input.nextDouble();




            w = Math.min(w, carspeed);
            double v = Math.sqrt(2.0 * caracc*bp);
            if(v <= w +eps){
                System.out.printf("%.20f", v/caracc+getEnd(v,caracc,totaldis-bp,carspeed));
            }else{
                double l = w, r = carspeed+eps;
                for(int i=0;i<50;i++){
                    double mid =(l+r)/2.0;
                    double t1 = mid/caracc;double t2 = (mid -w)/caracc;
                    if(caracc*t1*t1*0.5 + mid*t2 - caracc*t2*t2*0.5 <= bp+eps ){
                        l=mid;
                    }else{
                        r=mid;
                    }
                }
                double t1 = l/caracc, t2 = (l-w)/caracc;
                double s = bp-(caracc*t1*t1/2.0 + l*t2 - caracc*t2*t2/2.0);
                double t3 = s/l;
                System.out.printf("%.20f",t1+t2+t3+getEnd(w, caracc,totaldis-bp,carspeed));
            }

        }
    }

    private static double getEnd(double w, double caracc, double td, double carspeed) {
        double t = (-w + Math.sqrt(w*w+2.0*caracc*td))/caracc;
        if(w+caracc*t <= carspeed+eps)return t;
        t=(carspeed-w)/caracc;
        double s = td - (w*t+caracc*t*t/2.0);
        return t+ s/carspeed;
    }

    private static double findTime(double carspeed, double caracc, double td, double u) {
        double time = (carspeed-u)/caracc;
        double dis = u* time + 0.5*(caracc)*time *time;
        if(dis < td){
            time  += (td-dis)/carspeed;
        }else if(dis > td){
            double v = Math.sqrt( (u*u) + (2*caracc*td));
            time = (v-u)/caracc;
        }
        return time;
    }

    interface Input extends Closeable {
        String next() throws IOException;

        default int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        default long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        default double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        default int[] readIntArray() throws IOException {
            return readIntArray(nextInt());
        }

        default int[] readIntArray(int size) throws IOException {
            int[] array = new int[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        default long[] readLongArray(int size) throws IOException {
            long[] array = new long[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = nextLong();
            }
            return array;
        }
    }

    private static class StandardInput implements Input {
        private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        private StringTokenizer stringTokenizer;

        @Override
        public void close() throws IOException {
            reader.close();
        }

        @Override
        public String next() throws IOException {
            if (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
                stringTokenizer = new StringTokenizer(reader.readLine());
            }
            return stringTokenizer.nextToken();
        }
    }
}