import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int A = in.Int();
            int B = in.Int();
            int H = in.Int();
            int M = in.Int();

            double hr = Math.toRadians(H * 30.0 + M * 0.5);
            double mr = Math.toRadians(M * 6.0);
            double hx = A * Math.sin(hr);
            double hy = A * Math.cos(hr);
            double mx = B * Math.sin(mr);
            double my = B * Math.cos(mr);
            double dx = hx - mx;
            double dy = hy - my;
            double ans = Math.sqrt(dx * dx + dy * dy);
            out.printf("%.14f", ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.InputStream; InputStream java.io public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int A = in.Int();
            int B = in.Int();
            int H = in.Int();
            int M = in.Int();

            double hr = Math.toRadians(H * 30.0 + M * 0.5);
            double mr = Math.toRadians(M * 6.0);
            double hx = A * Math.sin(hr);
            double hy = A * Math.cos(hr);
            double mx = B * Math.sin(mr);
            double my = B * Math.cos(mr);
            double dx = hx - mx;
            double dy = hy - my;
            double ans = Math.sqrt(dx * dx + dy * dy);
            out.printf("%.14f", ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out MyScanner in = new MyScanner(inputStream); in new MyScanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) C solver = new C(); solver new C() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int A = in.Int();
            int B = in.Int();
            int H = in.Int();
            int M = in.Int();

            double hr = Math.toRadians(H * 30.0 + M * 0.5);
            double mr = Math.toRadians(M * 6.0);
            double hx = A * Math.sin(hr);
            double hy = A * Math.cos(hr);
            double mx = B * Math.sin(mr);
            double my = B * Math.cos(mr);
            double dx = hx - mx;
            double dy = hy - my;
            double ans = Math.sqrt(dx * dx + dy * dy);
            out.printf("%.14f", ans);
        }

    } C public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int A = in.Int();
            int B = in.Int();
            int H = in.Int();
            int M = in.Int();

            double hr = Math.toRadians(H * 30.0 + M * 0.5);
            double mr = Math.toRadians(M * 6.0);
            double hx = A * Math.sin(hr);
            double hy = A * Math.cos(hr);
            double mx = B * Math.sin(mr);
            double my = B * Math.cos(mr);
            double dx = hx - mx;
            double dy = hy - my;
            double ans = Math.sqrt(dx * dx + dy * dy);
            out.printf("%.14f", ans);
        } solve {
            int A = in.Int();
            int B = in.Int();
            int H = in.Int();
            int M = in.Int();

            double hr = Math.toRadians(H * 30.0 + M * 0.5);
            double mr = Math.toRadians(M * 6.0);
            double hx = A * Math.sin(hr);
            double hy = A * Math.cos(hr);
            double mx = B * Math.sin(mr);
            double my = B * Math.cos(mr);
            double dx = hx - mx;
            double dy = hy - my;
            double ans = Math.sqrt(dx * dx + dy * dy);
            out.printf("%.14f", ans);
        } int A = in.Int(); A in.Int() in.Int in int B = in.Int(); B in.Int() in.Int in int H = in.Int(); H in.Int() in.Int in int M = in.Int(); M in.Int() in.Int in double hr = Math.toRadians(H * 30.0 + M * 0.5); hr Math.toRadians(H * 30.0 + M * 0.5) Math.toRadians Math H * 30.0 + M * 0.5 H * 30.0 H 30.0 M * 0.5 M 0.5 double mr = Math.toRadians(M * 6.0); mr Math.toRadians(M * 6.0) Math.toRadians Math M * 6.0 M 6.0 double hx = A * Math.sin(hr); hx A * Math.sin(hr) A Math.sin(hr) Math.sin Math hr double hy = A * Math.cos(hr); hy A * Math.cos(hr) A Math.cos(hr) Math.cos Math hr double mx = B * Math.sin(mr); mx B * Math.sin(mr) B Math.sin(mr) Math.sin Math mr double my = B * Math.cos(mr); my B * Math.cos(mr) B Math.cos(mr) Math.cos Math mr double dx = hx - mx; dx hx - mx hx mx double dy = hy - my; dy hy - my hy my double ans = Math.sqrt(dx * dx + dy * dy); ans Math.sqrt(dx * dx + dy * dy) Math.sqrt Math dx * dx + dy * dy dx * dx dx dx dy * dy dy dy out.printf("%.14f", ans) out.printf out "%.14f" ans int testNumber testNumber MyScanner in in PrintWriter out out static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    } MyScanner private BufferedReader in; in private StringTokenizer st; st public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        } MyScanner {
            in = new BufferedReader(new InputStreamReader(stream));
        } in = new BufferedReader(new InputStreamReader(stream)) in new BufferedReader(new InputStreamReader(stream)) InputStream stream stream public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        } while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            } st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            } try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                } catch (IOException e) {
                    return null;
                } IOException e {
                    return null;
                } return null; null {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } String rl = in.readLine(); rl in.readLine() in.readLine in if (rl == null) {
                        return null;
                    } rl == null rl null {
                        return null;
                    } return null; null st = new StringTokenizer(rl) st new StringTokenizer(rl) return st.nextToken(); st.nextToken() st.nextToken st public int Int() {
            return Integer.parseInt(next());
        } Int {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int A = in.Int();
            int B = in.Int();
            int H = in.Int();
            int M = in.Int();

            double hr = Math.toRadians(H * 30.0 + M * 0.5);
            double mr = Math.toRadians(M * 6.0);
            double hx = A * Math.sin(hr);
            double hy = A * Math.cos(hr);
            double mx = B * Math.sin(mr);
            double my = B * Math.cos(mr);
            double dx = hx - mx;
            double dy = hy - my;
            double ans = Math.sqrt(dx * dx + dy * dy);
            out.printf("%.14f", ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int A = in.Int();
            int B = in.Int();
            int H = in.Int();
            int M = in.Int();

            double hr = Math.toRadians(H * 30.0 + M * 0.5);
            double mr = Math.toRadians(M * 6.0);
            double hx = A * Math.sin(hr);
            double hy = A * Math.cos(hr);
            double mx = B * Math.sin(mr);
            double my = B * Math.cos(mr);
            double dx = hx - mx;
            double dy = hy - my;
            double ans = Math.sqrt(dx * dx + dy * dy);
            out.printf("%.14f", ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int A = in.Int();
            int B = in.Int();
            int H = in.Int();
            int M = in.Int();

            double hr = Math.toRadians(H * 30.0 + M * 0.5);
            double mr = Math.toRadians(M * 6.0);
            double hx = A * Math.sin(hr);
            double hy = A * Math.cos(hr);
            double mx = B * Math.sin(mr);
            double my = B * Math.cos(mr);
            double dx = hx - mx;
            double dy = hy - my;
            double ans = Math.sqrt(dx * dx + dy * dy);
            out.printf("%.14f", ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
}

