import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer a = scanner.nextInt();
        Integer b = scanner.nextInt();
        Integer h = scanner.nextInt();
        Integer m = scanner.nextInt();

        double result;

        double rad = Math.PI * 2 * ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60);

        result = Math.sqrt(Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(rad));

        System.out.printf("%.20f",result);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer a = scanner.nextInt();
        Integer b = scanner.nextInt();
        Integer h = scanner.nextInt();
        Integer m = scanner.nextInt();

        double result;

        double rad = Math.PI * 2 * ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60);

        result = Math.sqrt(Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(rad));

        System.out.printf("%.20f",result);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer a = scanner.nextInt();
        Integer b = scanner.nextInt();
        Integer h = scanner.nextInt();
        Integer m = scanner.nextInt();

        double result;

        double rad = Math.PI * 2 * ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60);

        result = Math.sqrt(Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(rad));

        System.out.printf("%.20f",result);
    } main {
        Scanner scanner = new Scanner(System.in);
        Integer a = scanner.nextInt();
        Integer b = scanner.nextInt();
        Integer h = scanner.nextInt();
        Integer m = scanner.nextInt();

        double result;

        double rad = Math.PI * 2 * ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60);

        result = Math.sqrt(Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(rad));

        System.out.printf("%.20f",result);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) Integer a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner Integer b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner Integer h = scanner.nextInt(); h scanner.nextInt() scanner.nextInt scanner Integer m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner double result; result double rad = Math.PI * 2 * ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60); rad Math.PI * 2 * ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60) Math.PI * 2 * ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60) Math.PI Math Math.PI 2 ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60) (double)h / 12 + ((double)m / 60) / 12 (double)h / 12 (double)h 12 ((double)m / 60) / 12 ((double)m / 60) (double)m 60 12 (double)m / 60 (double)m 60 result = Math.sqrt(Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(rad)) result Math.sqrt(Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(rad)) Math.sqrt Math Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(rad) 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*a*b*Math.cos(rad) b 2*a*b*Math.cos(rad) 2 a b Math.cos(rad) Math.cos Math rad System.out.printf("%.20f",result) System.out.printf System.out System System.out "%.20f" result String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer a = scanner.nextInt();
        Integer b = scanner.nextInt();
        Integer h = scanner.nextInt();
        Integer m = scanner.nextInt();

        double result;

        double rad = Math.PI * 2 * ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60);

        result = Math.sqrt(Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(rad));

        System.out.printf("%.20f",result);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer a = scanner.nextInt();
        Integer b = scanner.nextInt();
        Integer h = scanner.nextInt();
        Integer m = scanner.nextInt();

        double result;

        double rad = Math.PI * 2 * ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60);

        result = Math.sqrt(Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(rad));

        System.out.printf("%.20f",result);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer a = scanner.nextInt();
        Integer b = scanner.nextInt();
        Integer h = scanner.nextInt();
        Integer m = scanner.nextInt();

        double result;

        double rad = Math.PI * 2 * ((double)h / 12 + ((double)m / 60) / 12 - (double)m / 60);

        result = Math.sqrt(Math.pow(a,2) + Math.pow(b,2) - 2*a*b*Math.cos(rad));

        System.out.printf("%.20f",result);
    }
}
