import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class joe_sm extends Thread {

	void solve() {
		int d = in.nextInt();
		int h1 = in.nextInt();
		int h2 = in.nextInt();
		int l = in.nextInt();
		if (h1 > h2) {
			int tmp = h1;
			h1 = h2;
			h2 = tmp;
		}
		
		double h = Math.max((d * d - l * l) / (2.0 * l), 0);
		double lh = Math.max(h, h2-h1);
		double r = Math.sqrt(d * d + lh * lh);
		out.println(h1 + Math.min(r, h2));
	}

	void myAssert(boolean b) {
		if (!b)
			throw new AssertionError();
	}

	Scanner in;
	PrintWriter out;

	public void run() {
		try {
			in = new Scanner(new File("joe.in"));
			out = new PrintWriter(new File("joe.out"));
			solve();
			out.flush();
			out.close();
			// new FilePrinter("joe.out",System.out);
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

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

}
