import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double a = scan.nextDouble();
        double b = scan.nextDouble();
        double h = scan.nextDouble();
        double m = scan.nextDouble();
        double naga = m * 360 / 60;
        double miji = (h * 60 + m) * 360 / (12 * 60);
        double kaku = miji - naga;
        double result = Math.sqrt(a*a + b*b - 2*a*b* Math.cos(Math.toRadians(kaku)));
        System.out.println(result);

    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double a = scan.nextDouble();
        double b = scan.nextDouble();
        double h = scan.nextDouble();
        double m = scan.nextDouble();
        double naga = m * 360 / 60;
        double miji = (h * 60 + m) * 360 / (12 * 60);
        double kaku = miji - naga;
        double result = Math.sqrt(a*a + b*b - 2*a*b* Math.cos(Math.toRadians(kaku)));
        System.out.println(result);

    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double a = scan.nextDouble();
        double b = scan.nextDouble();
        double h = scan.nextDouble();
        double m = scan.nextDouble();
        double naga = m * 360 / 60;
        double miji = (h * 60 + m) * 360 / (12 * 60);
        double kaku = miji - naga;
        double result = Math.sqrt(a*a + b*b - 2*a*b* Math.cos(Math.toRadians(kaku)));
        System.out.println(result);

    } main {
        Scanner scan = new Scanner(System.in);
        double a = scan.nextDouble();
        double b = scan.nextDouble();
        double h = scan.nextDouble();
        double m = scan.nextDouble();
        double naga = m * 360 / 60;
        double miji = (h * 60 + m) * 360 / (12 * 60);
        double kaku = miji - naga;
        double result = Math.sqrt(a*a + b*b - 2*a*b* Math.cos(Math.toRadians(kaku)));
        System.out.println(result);

    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) double a = scan.nextDouble(); a scan.nextDouble() scan.nextDouble scan double b = scan.nextDouble(); b scan.nextDouble() scan.nextDouble scan double h = scan.nextDouble(); h scan.nextDouble() scan.nextDouble scan double m = scan.nextDouble(); m scan.nextDouble() scan.nextDouble scan double naga = m * 360 / 60; naga m * 360 / 60 m * 360 m 360 60 double miji = (h * 60 + m) * 360 / (12 * 60); miji (h * 60 + m) * 360 / (12 * 60) (h * 60 + m) * 360 (h * 60 + m) h * 60 h 60 m 360 (12 * 60) 12 60 double kaku = miji - naga; kaku miji - naga miji naga double result = Math.sqrt(a*a + b*b - 2*a*b* Math.cos(Math.toRadians(kaku))); result Math.sqrt(a*a + b*b - 2*a*b* Math.cos(Math.toRadians(kaku))) Math.sqrt Math a*a + b*b - 2*a*b* Math.cos(Math.toRadians(kaku)) a*a + b*b a*a a a b*b b b 2*a*b* Math.cos(Math.toRadians(kaku)) b 2*a*b* Math.cos(Math.toRadians(kaku)) 2 a b Math.cos(Math.toRadians(kaku)) Math.cos Math Math.toRadians(kaku) Math.toRadians Math kaku System.out.println(result) System.out.println System.out System System.out result String[] args args
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double a = scan.nextDouble();
        double b = scan.nextDouble();
        double h = scan.nextDouble();
        double m = scan.nextDouble();
        double naga = m * 360 / 60;
        double miji = (h * 60 + m) * 360 / (12 * 60);
        double kaku = miji - naga;
        double result = Math.sqrt(a*a + b*b - 2*a*b* Math.cos(Math.toRadians(kaku)));
        System.out.println(result);

    }
}