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

public class joe_af_wrong4 implements Runnable {
	public static void main(String[] args) {
		new Thread(new joe_af_wrong4()).start();
	}

	Scanner in;
	PrintWriter out;

	public void run() {
		try {
			in = new Scanner(new File("joe.in"));
			out = new PrintWriter("joe.out");
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(-1);
		}

	}

	boolean between(double l, double x, double r) {
		return l <= x && x <= r || r <= x && x <= l;
	}

	void myAssert(boolean e, String msg) {
		if (!e) {
			throw new Error(msg);
		}
	}

	void solve() throws IOException {
		double d = in.nextInt();
		double h1 = in.nextInt();
		double h2 = in.nextInt();
		double l = in.nextInt();
		myAssert(between(1, d, 1000000), "d is  out of bounds");
		myAssert(between(1, h1, 1000000), "h1 is  out of bounds");
		myAssert(between(1, h2, 1000000), "h2 is  out of bounds");
		myAssert(between(1, l, 1000000), "l is  out of bounds");
		double th1 = Math.min(h1, h2);
		double th2 = Math.max(h1, h2);
		double a = Math.max((d * d - l * l) / 2 / l, th2 - th1);
		double r = Math.sqrt(a * a + d * d);
		out.println(th1 + th2);
	}

}
