//int overflow

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

public class joe_af_wrong implements Runnable {
    public static void main(String[] args) {
        new Thread(new joe_af_wrong()).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 {
        int d = in.nextInt();
        int h1 = in.nextInt();
        int h2 = in.nextInt();
        int 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");
        int th1 = Math.min(h1, h2);
        int th2 = Math.max(h1, h2);
        double a = Math.max((d * d - l * l) / 2.0 / l, th2 - th1);
        double r = Math.sqrt(a * a + d * d);
        out.println(th1 + Math.min(th2, r));
    }

}
