import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int A = s.nextInt();
        int B = s.nextInt();
        int H = s.nextInt();
        int M = s.nextInt();

        double Hx = A * Math.cos(Math.toRadians(90 - 30 * H - (double) M / 2));
        double Hy = A * Math.sin(Math.toRadians(90 - 30 * H - (double) M / 2));

        double Mx = B * Math.cos(Math.toRadians(90 - 6 * M));
        double My = B * Math.sin(Math.toRadians(90 - 6 * M));

        double d = Math.sqrt((Hx - Mx) * (Hx - Mx) + (Hy - My) * (Hy - My));
        System.out.print(d);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int A = s.nextInt();
        int B = s.nextInt();
        int H = s.nextInt();
        int M = s.nextInt();

        double Hx = A * Math.cos(Math.toRadians(90 - 30 * H - (double) M / 2));
        double Hy = A * Math.sin(Math.toRadians(90 - 30 * H - (double) M / 2));

        double Mx = B * Math.cos(Math.toRadians(90 - 6 * M));
        double My = B * Math.sin(Math.toRadians(90 - 6 * M));

        double d = Math.sqrt((Hx - Mx) * (Hx - Mx) + (Hy - My) * (Hy - My));
        System.out.print(d);
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int A = s.nextInt();
        int B = s.nextInt();
        int H = s.nextInt();
        int M = s.nextInt();

        double Hx = A * Math.cos(Math.toRadians(90 - 30 * H - (double) M / 2));
        double Hy = A * Math.sin(Math.toRadians(90 - 30 * H - (double) M / 2));

        double Mx = B * Math.cos(Math.toRadians(90 - 6 * M));
        double My = B * Math.sin(Math.toRadians(90 - 6 * M));

        double d = Math.sqrt((Hx - Mx) * (Hx - Mx) + (Hy - My) * (Hy - My));
        System.out.print(d);
    } main {
        Scanner s = new Scanner(System.in);
        int A = s.nextInt();
        int B = s.nextInt();
        int H = s.nextInt();
        int M = s.nextInt();

        double Hx = A * Math.cos(Math.toRadians(90 - 30 * H - (double) M / 2));
        double Hy = A * Math.sin(Math.toRadians(90 - 30 * H - (double) M / 2));

        double Mx = B * Math.cos(Math.toRadians(90 - 6 * M));
        double My = B * Math.sin(Math.toRadians(90 - 6 * M));

        double d = Math.sqrt((Hx - Mx) * (Hx - Mx) + (Hy - My) * (Hy - My));
        System.out.print(d);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int A = s.nextInt(); A s.nextInt() s.nextInt s int B = s.nextInt(); B s.nextInt() s.nextInt s int H = s.nextInt(); H s.nextInt() s.nextInt s int M = s.nextInt(); M s.nextInt() s.nextInt s double Hx = A * Math.cos(Math.toRadians(90 - 30 * H - (double) M / 2)); Hx A * Math.cos(Math.toRadians(90 - 30 * H - (double) M / 2)) A Math.cos(Math.toRadians(90 - 30 * H - (double) M / 2)) Math.cos Math Math.toRadians(90 - 30 * H - (double) M / 2) Math.toRadians Math 90 - 30 * H - (double) M / 2 90 - 30 * H - (double) M / 2 90 30 * H 30 H (double) M / 2 (double) M 2 double Hy = A * Math.sin(Math.toRadians(90 - 30 * H - (double) M / 2)); Hy A * Math.sin(Math.toRadians(90 - 30 * H - (double) M / 2)) A Math.sin(Math.toRadians(90 - 30 * H - (double) M / 2)) Math.sin Math Math.toRadians(90 - 30 * H - (double) M / 2) Math.toRadians Math 90 - 30 * H - (double) M / 2 90 - 30 * H - (double) M / 2 90 30 * H 30 H (double) M / 2 (double) M 2 double Mx = B * Math.cos(Math.toRadians(90 - 6 * M)); Mx B * Math.cos(Math.toRadians(90 - 6 * M)) B Math.cos(Math.toRadians(90 - 6 * M)) Math.cos Math Math.toRadians(90 - 6 * M) Math.toRadians Math 90 - 6 * M 90 6 * M 6 M double My = B * Math.sin(Math.toRadians(90 - 6 * M)); My B * Math.sin(Math.toRadians(90 - 6 * M)) B Math.sin(Math.toRadians(90 - 6 * M)) Math.sin Math Math.toRadians(90 - 6 * M) Math.toRadians Math 90 - 6 * M 90 6 * M 6 M double d = Math.sqrt((Hx - Mx) * (Hx - Mx) + (Hy - My) * (Hy - My)); d Math.sqrt((Hx - Mx) * (Hx - Mx) + (Hy - My) * (Hy - My)) Math.sqrt Math (Hx - Mx) * (Hx - Mx) + (Hy - My) * (Hy - My) (Hx - Mx) * (Hx - Mx) (Hx - Mx) Hx Mx (Hx - Mx) Hx Mx (Hy - My) * (Hy - My) (Hy - My) Hy My (Hy - My) Hy My System.out.print(d) System.out.print System.out System System.out d String[] args args public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int A = s.nextInt();
        int B = s.nextInt();
        int H = s.nextInt();
        int M = s.nextInt();

        double Hx = A * Math.cos(Math.toRadians(90 - 30 * H - (double) M / 2));
        double Hy = A * Math.sin(Math.toRadians(90 - 30 * H - (double) M / 2));

        double Mx = B * Math.cos(Math.toRadians(90 - 6 * M));
        double My = B * Math.sin(Math.toRadians(90 - 6 * M));

        double d = Math.sqrt((Hx - Mx) * (Hx - Mx) + (Hy - My) * (Hy - My));
        System.out.print(d);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int A = s.nextInt();
        int B = s.nextInt();
        int H = s.nextInt();
        int M = s.nextInt();

        double Hx = A * Math.cos(Math.toRadians(90 - 30 * H - (double) M / 2));
        double Hy = A * Math.sin(Math.toRadians(90 - 30 * H - (double) M / 2));

        double Mx = B * Math.cos(Math.toRadians(90 - 6 * M));
        double My = B * Math.sin(Math.toRadians(90 - 6 * M));

        double d = Math.sqrt((Hx - Mx) * (Hx - Mx) + (Hy - My) * (Hy - My));
        System.out.print(d);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int A = s.nextInt();
        int B = s.nextInt();
        int H = s.nextInt();
        int M = s.nextInt();

        double Hx = A * Math.cos(Math.toRadians(90 - 30 * H - (double) M / 2));
        double Hy = A * Math.sin(Math.toRadians(90 - 30 * H - (double) M / 2));

        double Mx = B * Math.cos(Math.toRadians(90 - 6 * M));
        double My = B * Math.sin(Math.toRadians(90 - 6 * M));

        double d = Math.sqrt((Hx - Mx) * (Hx - Mx) + (Hy - My) * (Hy - My));
        System.out.print(d);
    }
}