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.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws FileNotFoundException, IOException {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();

	}
}

class Pair implements Comparable<Pair> {
	long cost;
	int idx;

	Pair(long cost, int second) {
		this.cost = cost;
		idx = second;
	}

	@Override
	public int compareTo(Pair e) {
		if (this.cost != e.cost) {
			return Long.compare(this.cost, e.cost);
		} else {
			return Integer.compare(this.idx, e.idx);
		}
	}
}

// pair problem can be done using stack
class TaskB {
	int MAXN = (int) 1e9 + 7;

	void solve(int testNumber, InputReader in, PrintWriter pw) {
		double a = in.nextDouble();
		double v = in.nextDouble();
		double l = in.nextDouble();
		double d = in.nextDouble();
		double w = in.nextDouble();
		double res = 0.0d;
		if (v <= w) {
			double t = v / a;
			double dis = a * t * t / 2;
			System.err.println("hello");
			if (dis > l) {
				res = Math.sqrt((2 * l) / a);
			} else {
				l -= dis;
				t += l / v;
				res = t;
			}
		} else {
			double vel = Math.sqrt(2 * a * d);
			if (vel <= w) {
				System.err.println("hi");
				double dis = v * v / (2 * a);
				if (dis > l) {
					res = Math.sqrt((2 * l) / a);
				} else {
					l -= dis;
					res = v / a + l / v;
				}
			} else {
				double t1 = v / a;
				double t2 = (v - w) / a;
				double dis = ((a * t1 * t1) / 2) + v * t2 - ((a * t2 * t2) / 2);
				if (dis <= d) {
					res = t1 + t2 + (d - dis) / v;
					double rem = (v * v - w * w) / (2 * a);
					if (rem + d > l) {
						double hi = v;
						double lo = 0;
						for (int i = 0; i < 1000; ++i) {
							double mid = (hi + lo) / 2;
							double check = (mid * mid - w * w) / (2 * a);
							if (check + d <= l) {
								lo = mid;
							} else {
								hi = mid;
							}
						}

						System.err.println("fourth");
						res += (lo - w) / a;
					} else {
						res += (v - w) / a;
						l -= (rem + d);
						res += l / v;
						System.err.println("five");
					}
				} else {
//					double dis = in.ne
					double hi = v;
					double lo = 0;
					System.err.println("this second");
					for (int i = 0; i < 1000; ++i) {
						double mid = (hi + lo) / 2;
						double t3 = mid / a;
						double t4 = (mid - w) / a;
						double dist = ((a * t3 * t3) / 2) + mid * t4 - ((a * t4 * t4) / 2);
						if (dist <= d) {
							lo = mid;
						} else {
							hi = mid;
						}
					}
					res = lo / a + (lo - w) / a;
					double rem = (v * v - w * w) / (2 * a);
					if (rem + d > l) {
						hi = v;
						lo = 0;
						for (int i = 0; i < 1000; ++i) {
							double mid = (hi + lo) / 2;
							double check = (mid * mid - w * w) / (2 * a);
							if (check + d <= l) {
								lo = mid;
							} else {
								hi = mid;
							}
						}

						System.err.println("fourth");
						res += (lo - w) / a;
					} else {
						res += (v - w) / a;
						l -= (rem + d);
						res += l / v;
						System.err.println("five");
					}
				}
			}
		}
		pw.printf("%.9f", res);

	}

	long pow(int n, int m) {
		if (m == 0)
			return 1;
		long ans = pow(n, m / 2);
		ans = (ans * ans);
		if (m % 2 == 1) {
			ans = (ans * n);
		}
		return ans;
	}

	double pow(double n, int m) {
		if (m == 0)
			return 1;
		double ans = pow(n, m / 2);
		ans = (ans * ans);
		if (m % 2 == 1) {
			ans = (ans * n);
		}
		return ans;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}