import java.util.Scanner;

public class Main {

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

        double angleMinute = ((double)m) * 6;
        double angleHours = (((double)h) * 60 + m) / 2;
        double diff = Math.abs(angleHours - angleMinute);
        diff = diff > 180 ? 360 - diff : diff;

        double result = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(diff * (Math.PI / 180)));

        System.out.println(String.format("%.16f", result));
    }

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

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

        double angleMinute = ((double)m) * 6;
        double angleHours = (((double)h) * 60 + m) / 2;
        double diff = Math.abs(angleHours - angleMinute);
        diff = diff > 180 ? 360 - diff : diff;

        double result = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(diff * (Math.PI / 180)));

        System.out.println(String.format("%.16f", result));
    }

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

        double angleMinute = ((double)m) * 6;
        double angleHours = (((double)h) * 60 + m) / 2;
        double diff = Math.abs(angleHours - angleMinute);
        diff = diff > 180 ? 360 - diff : diff;

        double result = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(diff * (Math.PI / 180)));

        System.out.println(String.format("%.16f", result));
    } main {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int h = scanner.nextInt();
        int m = scanner.nextInt();

        double angleMinute = ((double)m) * 6;
        double angleHours = (((double)h) * 60 + m) / 2;
        double diff = Math.abs(angleHours - angleMinute);
        diff = diff > 180 ? 360 - diff : diff;

        double result = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(diff * (Math.PI / 180)));

        System.out.println(String.format("%.16f", result));
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner int h = scanner.nextInt(); h scanner.nextInt() scanner.nextInt scanner int m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner double angleMinute = ((double)m) * 6; angleMinute ((double)m) * 6 ((double)m) 6 double angleHours = (((double)h) * 60 + m) / 2; angleHours (((double)h) * 60 + m) / 2 (((double)h) * 60 + m) ((double)h) * 60 ((double)h) 60 m 2 double diff = Math.abs(angleHours - angleMinute); diff Math.abs(angleHours - angleMinute) Math.abs Math angleHours - angleMinute angleHours angleMinute diff = diff > 180 ? 360 - diff : diff diff diff > 180 ? 360 - diff : diff diff > 180 diff 180 360 - diff 360 diff diff double result = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(diff * (Math.PI / 180))); result Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(diff * (Math.PI / 180))) Math.sqrt Math a * a + b * b - 2 * a * b * Math.cos(diff * (Math.PI / 180)) a * a + b * b a * a a a b * b b b 2 * a * b * Math.cos(diff * (Math.PI / 180)) b 2 * a * b * Math.cos(diff * (Math.PI / 180)) 2 a b Math.cos(diff * (Math.PI / 180)) Math.cos Math diff * (Math.PI / 180) diff (Math.PI / 180) Math.PI Math Math.PI 180 System.out.println(String.format("%.16f", result)) System.out.println System.out System System.out String.format("%.16f", result) String.format String "%.16f" result String[] args args public class Main {

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

        double angleMinute = ((double)m) * 6;
        double angleHours = (((double)h) * 60 + m) / 2;
        double diff = Math.abs(angleHours - angleMinute);
        diff = diff > 180 ? 360 - diff : diff;

        double result = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(diff * (Math.PI / 180)));

        System.out.println(String.format("%.16f", result));
    }

} public class Main {

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

        double angleMinute = ((double)m) * 6;
        double angleHours = (((double)h) * 60 + m) / 2;
        double diff = Math.abs(angleHours - angleMinute);
        diff = diff > 180 ? 360 - diff : diff;

        double result = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(diff * (Math.PI / 180)));

        System.out.println(String.format("%.16f", result));
    }

} Main
import java.util.Scanner;

public class Main {

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

        double angleMinute = ((double)m) * 6;
        double angleHours = (((double)h) * 60 + m) / 2;
        double diff = Math.abs(angleHours - angleMinute);
        diff = diff > 180 ? 360 - diff : diff;

        double result = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(diff * (Math.PI / 180)));

        System.out.println(String.format("%.16f", result));
    }

}