import java.io.*;
import java.util.*;

public class joe_aa implements Runnable {

	public static void main(String[] args) {
		new Thread(new joe_aa()).start();
	}

	BufferedReader br;

	StringTokenizer st;

	PrintWriter out;

	boolean eof = false;

	Random rand = new Random(this.hashCode());

	public void run() {
		Locale.setDefault(Locale.US);
		try {
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

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

	String FNAME = "joe";

	private void solve() throws IOException {
		long d = nextInt();
		long h1 = nextInt();
		long h2 = nextInt();
		long l = nextInt();
		out.println(Math.min(h1, h2) + Math.min(Math.sqrt(d * d + (Math.max(h1, h2) - Math.min(Math.max(h1, h2) - (d * d - l * l)/ (2.0 * l), 
				Math.min(h1, h2)))	* (Math.max(h1, h2) - Math.min(Math.max(h1, h2) - (d * d - l * l) / (2.0 * l), Math.min(h1, h2)))), Math.max(h1, h2)));
	}
}
