import java.util.Scanner;
public class Main {

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

        double a = scanner.nextDouble();
        double b = scanner.nextDouble();
        int h = scanner.nextInt();
        int m = scanner.nextInt();

//        角度を求める
        double angle = (h * 30.0 + m * 0.5) - ( m * 6.0 );
        double angles = Math.abs(angle);

        double before = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)
                                    - (2.0 * a * b * Math.cos(Math.toRadians(angles))));
        System.out.println(before);

        scanner.close();
    }

} import java.util.Scanner; Scanner java.util public class Main {

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

        double a = scanner.nextDouble();
        double b = scanner.nextDouble();
        int h = scanner.nextInt();
        int m = scanner.nextInt();

//        角度を求める
        double angle = (h * 30.0 + m * 0.5) - ( m * 6.0 );
        double angles = Math.abs(angle);

        double before = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)
                                    - (2.0 * a * b * Math.cos(Math.toRadians(angles))));
        System.out.println(before);

        scanner.close();
    }

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

        double a = scanner.nextDouble();
        double b = scanner.nextDouble();
        int h = scanner.nextInt();
        int m = scanner.nextInt();

//        角度を求める
        double angle = (h * 30.0 + m * 0.5) - ( m * 6.0 );
        double angles = Math.abs(angle);

        double before = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)
                                    - (2.0 * a * b * Math.cos(Math.toRadians(angles))));
        System.out.println(before);

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

        double a = scanner.nextDouble();
        double b = scanner.nextDouble();
        int h = scanner.nextInt();
        int m = scanner.nextInt();

//        角度を求める
        double angle = (h * 30.0 + m * 0.5) - ( m * 6.0 );
        double angles = Math.abs(angle);

        double before = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)
                                    - (2.0 * a * b * Math.cos(Math.toRadians(angles))));
        System.out.println(before);

        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) double a = scanner.nextDouble(); a scanner.nextDouble() scanner.nextDouble scanner double b = scanner.nextDouble(); b scanner.nextDouble() scanner.nextDouble scanner int h = scanner.nextInt(); h scanner.nextInt() scanner.nextInt scanner int m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner double angle = (h * 30.0 + m * 0.5) - ( m * 6.0 ); angle (h * 30.0 + m * 0.5) - ( m * 6.0 ) (h * 30.0 + m * 0.5) h * 30.0 h 30.0 m * 0.5 m 0.5 ( m * 6.0 ) m 6.0 double angles = Math.abs(angle); angles Math.abs(angle) Math.abs Math angle double before = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)
                                    - (2.0 * a * b * Math.cos(Math.toRadians(angles)))); before Math.sqrt(Math.pow(a,2) + Math.pow(b,2)
                                    - (2.0 * a * b * Math.cos(Math.toRadians(angles)))) Math.sqrt Math Math.pow(a,2) + Math.pow(b,2)
                                    - (2.0 * a * b * Math.cos(Math.toRadians(angles))) Math.pow(a,2) + Math.pow(b,2) Math.pow(a,2) Math.pow Math a 2 Math.pow(b,2) Math.pow Math b 2 (2.0 * a * b * Math.cos(Math.toRadians(angles))) b 2.0 * a * b * Math.cos(Math.toRadians(angles)) 2.0 a b Math.cos(Math.toRadians(angles)) Math.cos Math Math.toRadians(angles) Math.toRadians Math angles System.out.println(before) System.out.println System.out System System.out before scanner.close() scanner.close scanner String[] args args public class Main {

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

        double a = scanner.nextDouble();
        double b = scanner.nextDouble();
        int h = scanner.nextInt();
        int m = scanner.nextInt();

//        角度を求める
        double angle = (h * 30.0 + m * 0.5) - ( m * 6.0 );
        double angles = Math.abs(angle);

        double before = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)
                                    - (2.0 * a * b * Math.cos(Math.toRadians(angles))));
        System.out.println(before);

        scanner.close();
    }

} public class Main {

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

        double a = scanner.nextDouble();
        double b = scanner.nextDouble();
        int h = scanner.nextInt();
        int m = scanner.nextInt();

//        角度を求める
        double angle = (h * 30.0 + m * 0.5) - ( m * 6.0 );
        double angles = Math.abs(angle);

        double before = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)
                                    - (2.0 * a * b * Math.cos(Math.toRadians(angles))));
        System.out.println(before);

        scanner.close();
    }

} Main
import java.util.Scanner;
public class Main {

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

        double a = scanner.nextDouble();
        double b = scanner.nextDouble();
        int h = scanner.nextInt();
        int m = scanner.nextInt();

//        角度を求める
        double angle = (h * 30.0 + m * 0.5) - ( m * 6.0 );
        double angles = Math.abs(angle);

        double before = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)
                                    - (2.0 * a * b * Math.cos(Math.toRadians(angles))));
        System.out.println(before);

        scanner.close();
    }

}