    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();
    		double c = sc.nextDouble();
    		double d = sc.nextDouble();
    		double kaku = 0;
    		double answer = 0;
    		
    		
    		c=30*c+0.5*d;
    		d=6*d;
    		if(c>d) {
    			kaku=c-d;
    		}else {
    			kaku=d-c;
    		}
    		kaku=Math.cos(Math.toRadians(kaku));
    		
    		answer=a*a+b*b-2*a*b*kaku;
    		System.out.println(Math.sqrt(answer));
    		
    	}
    } 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();
    		double c = sc.nextDouble();
    		double d = sc.nextDouble();
    		double kaku = 0;
    		double answer = 0;
    		
    		
    		c=30*c+0.5*d;
    		d=6*d;
    		if(c>d) {
    			kaku=c-d;
    		}else {
    			kaku=d-c;
    		}
    		kaku=Math.cos(Math.toRadians(kaku));
    		
    		answer=a*a+b*b-2*a*b*kaku;
    		System.out.println(Math.sqrt(answer));
    		
    	}
    } Main public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
    		// 整数の入力
    		int a = sc.nextInt();
    		int b = sc.nextInt();
    		double c = sc.nextDouble();
    		double d = sc.nextDouble();
    		double kaku = 0;
    		double answer = 0;
    		
    		
    		c=30*c+0.5*d;
    		d=6*d;
    		if(c>d) {
    			kaku=c-d;
    		}else {
    			kaku=d-c;
    		}
    		kaku=Math.cos(Math.toRadians(kaku));
    		
    		answer=a*a+b*b-2*a*b*kaku;
    		System.out.println(Math.sqrt(answer));
    		
    	} main {
    		Scanner sc = new Scanner(System.in);
    		// 整数の入力
    		int a = sc.nextInt();
    		int b = sc.nextInt();
    		double c = sc.nextDouble();
    		double d = sc.nextDouble();
    		double kaku = 0;
    		double answer = 0;
    		
    		
    		c=30*c+0.5*d;
    		d=6*d;
    		if(c>d) {
    			kaku=c-d;
    		}else {
    			kaku=d-c;
    		}
    		kaku=Math.cos(Math.toRadians(kaku));
    		
    		answer=a*a+b*b-2*a*b*kaku;
    		System.out.println(Math.sqrt(answer));
    		
    	} 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 double c = sc.nextDouble(); c sc.nextDouble() sc.nextDouble sc double d = sc.nextDouble(); d sc.nextDouble() sc.nextDouble sc double kaku = 0; kaku 0 double answer = 0; answer 0 c=30*c+0.5*d c 30*c+0.5*d 30*c 30 c 0.5*d 0.5 d d=6*d d 6*d 6 d if(c>d) {
    			kaku=c-d;
    		}else {
    			kaku=d-c;
    		} c>d c d {
    			kaku=c-d;
    		} kaku=c-d kaku c-d c d {
    			kaku=d-c;
    		} kaku=d-c kaku d-c d c kaku=Math.cos(Math.toRadians(kaku)) kaku Math.cos(Math.toRadians(kaku)) Math.cos Math Math.toRadians(kaku) Math.toRadians Math kaku answer=a*a+b*b-2*a*b*kaku answer a*a+b*b-2*a*b*kaku a*a+b*b a*a a a b*b b b 2*a*b*kaku b 2*a*b*kaku 2 a b kaku System.out.println(Math.sqrt(answer)) System.out.println System.out System System.out Math.sqrt(answer) Math.sqrt Math answer 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();
    		double c = sc.nextDouble();
    		double d = sc.nextDouble();
    		double kaku = 0;
    		double answer = 0;
    		
    		
    		c=30*c+0.5*d;
    		d=6*d;
    		if(c>d) {
    			kaku=c-d;
    		}else {
    			kaku=d-c;
    		}
    		kaku=Math.cos(Math.toRadians(kaku));
    		
    		answer=a*a+b*b-2*a*b*kaku;
    		System.out.println(Math.sqrt(answer));
    		
    	}
    } public class Main {
    	public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
    		// 整数の入力
    		int a = sc.nextInt();
    		int b = sc.nextInt();
    		double c = sc.nextDouble();
    		double d = sc.nextDouble();
    		double kaku = 0;
    		double answer = 0;
    		
    		
    		c=30*c+0.5*d;
    		d=6*d;
    		if(c>d) {
    			kaku=c-d;
    		}else {
    			kaku=d-c;
    		}
    		kaku=Math.cos(Math.toRadians(kaku));
    		
    		answer=a*a+b*b-2*a*b*kaku;
    		System.out.println(Math.sqrt(answer));
    		
    	}
    } 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();
    		double c = sc.nextDouble();
    		double d = sc.nextDouble();
    		double kaku = 0;
    		double answer = 0;
    		
    		
    		c=30*c+0.5*d;
    		d=6*d;
    		if(c>d) {
    			kaku=c-d;
    		}else {
    			kaku=d-c;
    		}
    		kaku=Math.cos(Math.toRadians(kaku));
    		
    		answer=a*a+b*b-2*a*b*kaku;
    		System.out.println(Math.sqrt(answer));
    		
    	}
    }