import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextInt();
        double m = sc.nextInt();
        double mm = -Math.toRadians(m)*6;
        double hh = -Math.toRadians(h+m/60)*30;
        double x = Math.cos(hh)*a-Math.cos(mm)*b;
        double y = Math.sin(hh)*a-Math.sin(mm)*b;
        System.out.println(Math.sqrt(x*x+y*y));
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextInt();
        double m = sc.nextInt();
        double mm = -Math.toRadians(m)*6;
        double hh = -Math.toRadians(h+m/60)*30;
        double x = Math.cos(hh)*a-Math.cos(mm)*b;
        double y = Math.sin(hh)*a-Math.sin(mm)*b;
        System.out.println(Math.sqrt(x*x+y*y));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextInt();
        double m = sc.nextInt();
        double mm = -Math.toRadians(m)*6;
        double hh = -Math.toRadians(h+m/60)*30;
        double x = Math.cos(hh)*a-Math.cos(mm)*b;
        double y = Math.sin(hh)*a-Math.sin(mm)*b;
        System.out.println(Math.sqrt(x*x+y*y));
    } main {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextInt();
        double m = sc.nextInt();
        double mm = -Math.toRadians(m)*6;
        double hh = -Math.toRadians(h+m/60)*30;
        double x = Math.cos(hh)*a-Math.cos(mm)*b;
        double y = Math.sin(hh)*a-Math.sin(mm)*b;
        System.out.println(Math.sqrt(x*x+y*y));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double a = sc.nextDouble(); a sc.nextDouble() sc.nextDouble sc double b = sc.nextDouble(); b sc.nextDouble() sc.nextDouble sc double h = sc.nextInt(); h sc.nextInt() sc.nextInt sc double m = sc.nextInt(); m sc.nextInt() sc.nextInt sc double mm = -Math.toRadians(m)*6; mm -Math.toRadians(m)*6 -Math.toRadians(m) Math.toRadians(m) Math.toRadians Math m 6 double hh = -Math.toRadians(h+m/60)*30; hh -Math.toRadians(h+m/60)*30 -Math.toRadians(h+m/60) Math.toRadians(h+m/60) Math.toRadians Math h+m/60 h m/60 m 60 30 double x = Math.cos(hh)*a-Math.cos(mm)*b; x Math.cos(hh)*a-Math.cos(mm)*b Math.cos(hh)*a Math.cos(hh) Math.cos Math hh a Math.cos(mm)*b Math.cos(mm) Math.cos Math mm b double y = Math.sin(hh)*a-Math.sin(mm)*b; y Math.sin(hh)*a-Math.sin(mm)*b Math.sin(hh)*a Math.sin(hh) Math.sin Math hh a Math.sin(mm)*b Math.sin(mm) Math.sin Math mm b System.out.println(Math.sqrt(x*x+y*y)) System.out.println System.out System System.out Math.sqrt(x*x+y*y) Math.sqrt Math x*x+y*y x*x x x y*y y y String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextInt();
        double m = sc.nextInt();
        double mm = -Math.toRadians(m)*6;
        double hh = -Math.toRadians(h+m/60)*30;
        double x = Math.cos(hh)*a-Math.cos(mm)*b;
        double y = Math.sin(hh)*a-Math.sin(mm)*b;
        System.out.println(Math.sqrt(x*x+y*y));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextInt();
        double m = sc.nextInt();
        double mm = -Math.toRadians(m)*6;
        double hh = -Math.toRadians(h+m/60)*30;
        double x = Math.cos(hh)*a-Math.cos(mm)*b;
        double y = Math.sin(hh)*a-Math.sin(mm)*b;
        System.out.println(Math.sqrt(x*x+y*y));
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextInt();
        double m = sc.nextInt();
        double mm = -Math.toRadians(m)*6;
        double hh = -Math.toRadians(h+m/60)*30;
        double x = Math.cos(hh)*a-Math.cos(mm)*b;
        double y = Math.sin(hh)*a-Math.sin(mm)*b;
        System.out.println(Math.sqrt(x*x+y*y));
    }
}
