
import java.util.Scanner;


public class Main {    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();
        double min = h * 60 + m;
        double ar = min * 0.5;
        double br = m * 6;
        double rad = Math.abs(ar - br);
        double cos = Math.cos(Math.toRadians(rad));
//        System.out.println(ar + "ar");
//        System.out.println(br + "br");
//        System.out.println(rad + "rad");
//        System.out.println(cos + "cos");
        double ans = a * a + b * b - (2 * a * b * cos); 
        System.out.println(Math.sqrt(ans));
        sc.close();
    }   
} import java.util.Scanner; Scanner java.util public class Main {    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();
        double min = h * 60 + m;
        double ar = min * 0.5;
        double br = m * 6;
        double rad = Math.abs(ar - br);
        double cos = Math.cos(Math.toRadians(rad));
//        System.out.println(ar + "ar");
//        System.out.println(br + "br");
//        System.out.println(rad + "rad");
//        System.out.println(cos + "cos");
        double ans = a * a + b * b - (2 * a * b * cos); 
        System.out.println(Math.sqrt(ans));
        sc.close();
    }   
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();
        double min = h * 60 + m;
        double ar = min * 0.5;
        double br = m * 6;
        double rad = Math.abs(ar - br);
        double cos = Math.cos(Math.toRadians(rad));
//        System.out.println(ar + "ar");
//        System.out.println(br + "br");
//        System.out.println(rad + "rad");
//        System.out.println(cos + "cos");
        double ans = a * a + b * b - (2 * a * b * cos); 
        System.out.println(Math.sqrt(ans));
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();
        double min = h * 60 + m;
        double ar = min * 0.5;
        double br = m * 6;
        double rad = Math.abs(ar - br);
        double cos = Math.cos(Math.toRadians(rad));
//        System.out.println(ar + "ar");
//        System.out.println(br + "br");
//        System.out.println(rad + "rad");
//        System.out.println(cos + "cos");
        double ans = a * a + b * b - (2 * a * b * cos); 
        System.out.println(Math.sqrt(ans));
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int h = sc.nextInt(); h sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc double min = h * 60 + m; min h * 60 + m h * 60 h 60 m double ar = min * 0.5; ar min * 0.5 min 0.5 double br = m * 6; br m * 6 m 6 double rad = Math.abs(ar - br); rad Math.abs(ar - br) Math.abs Math ar - br ar br double cos = Math.cos(Math.toRadians(rad)); cos Math.cos(Math.toRadians(rad)) Math.cos Math Math.toRadians(rad) Math.toRadians Math rad double ans = a * a + b * b - (2 * a * b * cos); ans a * a + b * b - (2 * a * b * cos) a * a + b * b a * a a a b * b b b (2 * a * b * cos) b 2 * a * b * cos 2 a b cos System.out.println(Math.sqrt(ans)) System.out.println System.out System System.out Math.sqrt(ans) Math.sqrt Math ans sc.close() sc.close sc String[] args args public class Main {    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();
        double min = h * 60 + m;
        double ar = min * 0.5;
        double br = m * 6;
        double rad = Math.abs(ar - br);
        double cos = Math.cos(Math.toRadians(rad));
//        System.out.println(ar + "ar");
//        System.out.println(br + "br");
//        System.out.println(rad + "rad");
//        System.out.println(cos + "cos");
        double ans = a * a + b * b - (2 * a * b * cos); 
        System.out.println(Math.sqrt(ans));
        sc.close();
    }   
} public class Main {    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();
        double min = h * 60 + m;
        double ar = min * 0.5;
        double br = m * 6;
        double rad = Math.abs(ar - br);
        double cos = Math.cos(Math.toRadians(rad));
//        System.out.println(ar + "ar");
//        System.out.println(br + "br");
//        System.out.println(rad + "rad");
//        System.out.println(cos + "cos");
        double ans = a * a + b * b - (2 * a * b * cos); 
        System.out.println(Math.sqrt(ans));
        sc.close();
    }   
} Main

import java.util.Scanner;


public class Main {    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();
        double min = h * 60 + m;
        double ar = min * 0.5;
        double br = m * 6;
        double rad = Math.abs(ar - br);
        double cos = Math.cos(Math.toRadians(rad));
//        System.out.println(ar + "ar");
//        System.out.println(br + "br");
//        System.out.println(rad + "rad");
//        System.out.println(cos + "cos");
        double ans = a * a + b * b - (2 * a * b * cos); 
        System.out.println(Math.sqrt(ans));
        sc.close();
    }   
}
