import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        sc.close();

        double Hx = A * Math.sin(Math.toRadians(360 * (H + M / 60) / 12));
        double Hy = A * Math.cos(Math.toRadians(360 * (H + M / 60) / 12));

        double Mx = B * Math.sin(Math.toRadians(360 * M / 60));
        double My = B * Math.cos(Math.toRadians(360 * M / 60));

        double x = (Hx - Mx);
        double y = (Hy - My);

        System.out.println(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        sc.close();

        double Hx = A * Math.sin(Math.toRadians(360 * (H + M / 60) / 12));
        double Hy = A * Math.cos(Math.toRadians(360 * (H + M / 60) / 12));

        double Mx = B * Math.sin(Math.toRadians(360 * M / 60));
        double My = B * Math.cos(Math.toRadians(360 * M / 60));

        double x = (Hx - Mx);
        double y = (Hy - My);

        System.out.println(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        sc.close();

        double Hx = A * Math.sin(Math.toRadians(360 * (H + M / 60) / 12));
        double Hy = A * Math.cos(Math.toRadians(360 * (H + M / 60) / 12));

        double Mx = B * Math.sin(Math.toRadians(360 * M / 60));
        double My = B * Math.cos(Math.toRadians(360 * M / 60));

        double x = (Hx - Mx);
        double y = (Hy - My);

        System.out.println(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
    } main {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        sc.close();

        double Hx = A * Math.sin(Math.toRadians(360 * (H + M / 60) / 12));
        double Hy = A * Math.cos(Math.toRadians(360 * (H + M / 60) / 12));

        double Mx = B * Math.sin(Math.toRadians(360 * M / 60));
        double My = B * Math.cos(Math.toRadians(360 * M / 60));

        double x = (Hx - Mx);
        double y = (Hy - My);

        System.out.println(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc double H = sc.nextDouble(); H sc.nextDouble() sc.nextDouble sc double M = sc.nextDouble(); M sc.nextDouble() sc.nextDouble sc sc.close() sc.close sc double Hx = A * Math.sin(Math.toRadians(360 * (H + M / 60) / 12)); Hx A * Math.sin(Math.toRadians(360 * (H + M / 60) / 12)) A Math.sin(Math.toRadians(360 * (H + M / 60) / 12)) Math.sin Math Math.toRadians(360 * (H + M / 60) / 12) Math.toRadians Math 360 * (H + M / 60) / 12 360 * (H + M / 60) 360 (H + M / 60) H M / 60 M 60 12 double Hy = A * Math.cos(Math.toRadians(360 * (H + M / 60) / 12)); Hy A * Math.cos(Math.toRadians(360 * (H + M / 60) / 12)) A Math.cos(Math.toRadians(360 * (H + M / 60) / 12)) Math.cos Math Math.toRadians(360 * (H + M / 60) / 12) Math.toRadians Math 360 * (H + M / 60) / 12 360 * (H + M / 60) 360 (H + M / 60) H M / 60 M 60 12 double Mx = B * Math.sin(Math.toRadians(360 * M / 60)); Mx B * Math.sin(Math.toRadians(360 * M / 60)) B Math.sin(Math.toRadians(360 * M / 60)) Math.sin Math Math.toRadians(360 * M / 60) Math.toRadians Math 360 * M / 60 360 * M 360 M 60 double My = B * Math.cos(Math.toRadians(360 * M / 60)); My B * Math.cos(Math.toRadians(360 * M / 60)) B Math.cos(Math.toRadians(360 * M / 60)) Math.cos Math Math.toRadians(360 * M / 60) Math.toRadians Math 360 * M / 60 360 * M 360 M 60 double x = (Hx - Mx); x (Hx - Mx) Hx Mx double y = (Hy - My); y (Hy - My) Hy My System.out.println(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))) System.out.println System.out System System.out Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) Math.sqrt Math Math.pow(x, 2) + Math.pow(y, 2) Math.pow(x, 2) Math.pow Math x 2 Math.pow(y, 2) Math.pow Math y 2 String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        sc.close();

        double Hx = A * Math.sin(Math.toRadians(360 * (H + M / 60) / 12));
        double Hy = A * Math.cos(Math.toRadians(360 * (H + M / 60) / 12));

        double Mx = B * Math.sin(Math.toRadians(360 * M / 60));
        double My = B * Math.cos(Math.toRadians(360 * M / 60));

        double x = (Hx - Mx);
        double y = (Hy - My);

        System.out.println(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        sc.close();

        double Hx = A * Math.sin(Math.toRadians(360 * (H + M / 60) / 12));
        double Hy = A * Math.cos(Math.toRadians(360 * (H + M / 60) / 12));

        double Mx = B * Math.sin(Math.toRadians(360 * M / 60));
        double My = B * Math.cos(Math.toRadians(360 * M / 60));

        double x = (Hx - Mx);
        double y = (Hy - My);

        System.out.println(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        sc.close();

        double Hx = A * Math.sin(Math.toRadians(360 * (H + M / 60) / 12));
        double Hy = A * Math.cos(Math.toRadians(360 * (H + M / 60) / 12));

        double Mx = B * Math.sin(Math.toRadians(360 * M / 60));
        double My = B * Math.cos(Math.toRadians(360 * M / 60));

        double x = (Hx - Mx);
        double y = (Hy - My);

        System.out.println(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
    }
}