import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        double a = sc.nextInt();
        double b = sc.nextInt();
        double h = sc.nextInt();
        double m = sc.nextInt();

        double theta1 = (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2;
        double theta2 = m / 60.0 * Math.PI * 2;

        double ret = a * a + b * b - 2 * a * b * Math.cos(theta1 - theta2);
        ret = Math.sqrt(ret);

        System.out.printf("%.12f\n", ret);

    }
} 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.nextInt();
        double b = sc.nextInt();
        double h = sc.nextInt();
        double m = sc.nextInt();

        double theta1 = (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2;
        double theta2 = m / 60.0 * Math.PI * 2;

        double ret = a * a + b * b - 2 * a * b * Math.cos(theta1 - theta2);
        ret = Math.sqrt(ret);

        System.out.printf("%.12f\n", ret);

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        double a = sc.nextInt();
        double b = sc.nextInt();
        double h = sc.nextInt();
        double m = sc.nextInt();

        double theta1 = (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2;
        double theta2 = m / 60.0 * Math.PI * 2;

        double ret = a * a + b * b - 2 * a * b * Math.cos(theta1 - theta2);
        ret = Math.sqrt(ret);

        System.out.printf("%.12f\n", ret);

    } main {
        Scanner sc = new Scanner(System.in);

        double a = sc.nextInt();
        double b = sc.nextInt();
        double h = sc.nextInt();
        double m = sc.nextInt();

        double theta1 = (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2;
        double theta2 = m / 60.0 * Math.PI * 2;

        double ret = a * a + b * b - 2 * a * b * Math.cos(theta1 - theta2);
        ret = Math.sqrt(ret);

        System.out.printf("%.12f\n", ret);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double a = sc.nextInt(); a sc.nextInt() sc.nextInt sc double b = sc.nextInt(); b sc.nextInt() sc.nextInt sc double h = sc.nextInt(); h sc.nextInt() sc.nextInt sc double m = sc.nextInt(); m sc.nextInt() sc.nextInt sc double theta1 = (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2; theta1 (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2 (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2 (h / 12.0  + m / 60.0 / 12.0) h / 12.0 h 12.0 m / 60.0 / 12.0 m / 60.0 / 12.0 m 60.0 12.0 Math.PI Math Math.PI 2 double theta2 = m / 60.0 * Math.PI * 2; theta2 m / 60.0 * Math.PI * 2 m / 60.0 * Math.PI * 2 m / 60.0 m 60.0 Math.PI Math Math.PI 2 double ret = a * a + b * b - 2 * a * b * Math.cos(theta1 - theta2); ret a * a + b * b - 2 * a * b * Math.cos(theta1 - theta2) a * a + b * b a * a a a b * b b b 2 * a * b * Math.cos(theta1 - theta2) b 2 * a * b * Math.cos(theta1 - theta2) 2 a b Math.cos(theta1 - theta2) Math.cos Math theta1 - theta2 theta1 theta2 ret = Math.sqrt(ret) ret Math.sqrt(ret) Math.sqrt Math ret System.out.printf("%.12f\n", ret) System.out.printf System.out System System.out "%.12f\n" ret String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        double a = sc.nextInt();
        double b = sc.nextInt();
        double h = sc.nextInt();
        double m = sc.nextInt();

        double theta1 = (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2;
        double theta2 = m / 60.0 * Math.PI * 2;

        double ret = a * a + b * b - 2 * a * b * Math.cos(theta1 - theta2);
        ret = Math.sqrt(ret);

        System.out.printf("%.12f\n", ret);

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        double a = sc.nextInt();
        double b = sc.nextInt();
        double h = sc.nextInt();
        double m = sc.nextInt();

        double theta1 = (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2;
        double theta2 = m / 60.0 * Math.PI * 2;

        double ret = a * a + b * b - 2 * a * b * Math.cos(theta1 - theta2);
        ret = Math.sqrt(ret);

        System.out.printf("%.12f\n", ret);

    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        double a = sc.nextInt();
        double b = sc.nextInt();
        double h = sc.nextInt();
        double m = sc.nextInt();

        double theta1 = (h / 12.0  + m / 60.0 / 12.0) * Math.PI * 2;
        double theta2 = m / 60.0 * Math.PI * 2;

        double ret = a * a + b * b - 2 * a * b * Math.cos(theta1 - theta2);
        ret = Math.sqrt(ret);

        System.out.printf("%.12f\n", ret);

    }
}