import java.util.Scanner;
import java.lang.Math;
 
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 rad = Math.abs(H*30 + M*0.5 - M*6);
      		if(rad >= 180){
            rad = 360 - rad;
            }
      		double C = 0;
      		
      		C  =  Math.pow(A,2)+Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(rad));
      
		System.out.println(Math.pow(C,0.5));
	}
 
} import java.util.Scanner; Scanner java.util import java.lang.Math; Math java.lang 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 rad = Math.abs(H*30 + M*0.5 - M*6);
      		if(rad >= 180){
            rad = 360 - rad;
            }
      		double C = 0;
      		
      		C  =  Math.pow(A,2)+Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(rad));
      
		System.out.println(Math.pow(C,0.5));
	}
 
} 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 rad = Math.abs(H*30 + M*0.5 - M*6);
      		if(rad >= 180){
            rad = 360 - rad;
            }
      		double C = 0;
      		
      		C  =  Math.pow(A,2)+Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(rad));
      
		System.out.println(Math.pow(C,0.5));
	} main {
		Scanner sc = new Scanner(System.in);
			int A = sc.nextInt();
      		int B = sc.nextInt();
      		int H = sc.nextInt();
      		int M = sc.nextInt();
      		double rad = Math.abs(H*30 + M*0.5 - M*6);
      		if(rad >= 180){
            rad = 360 - rad;
            }
      		double C = 0;
      		
      		C  =  Math.pow(A,2)+Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(rad));
      
		System.out.println(Math.pow(C,0.5));
	} 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 rad = Math.abs(H*30 + M*0.5 - M*6); rad Math.abs(H*30 + M*0.5 - M*6) Math.abs Math H*30 + M*0.5 - M*6 H*30 + M*0.5 H*30 H 30 M*0.5 M 0.5 M*6 M 6 if(rad >= 180){
            rad = 360 - rad;
            } rad >= 180 rad 180 {
            rad = 360 - rad;
            } rad = 360 - rad rad 360 - rad 360 rad double C = 0; C 0 C  =  Math.pow(A,2)+Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(rad)) C Math.pow(A,2)+Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(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(Math.toRadians(rad)) B 2*A*B*Math.cos(Math.toRadians(rad)) 2 A B Math.cos(Math.toRadians(rad)) Math.cos Math Math.toRadians(rad) Math.toRadians Math rad System.out.println(Math.pow(C,0.5)) System.out.println System.out System System.out Math.pow(C,0.5) Math.pow Math C 0.5 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 rad = Math.abs(H*30 + M*0.5 - M*6);
      		if(rad >= 180){
            rad = 360 - rad;
            }
      		double C = 0;
      		
      		C  =  Math.pow(A,2)+Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(rad));
      
		System.out.println(Math.pow(C,0.5));
	}
 
} 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 rad = Math.abs(H*30 + M*0.5 - M*6);
      		if(rad >= 180){
            rad = 360 - rad;
            }
      		double C = 0;
      		
      		C  =  Math.pow(A,2)+Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(rad));
      
		System.out.println(Math.pow(C,0.5));
	}
 
} Main
import java.util.Scanner;
import java.lang.Math;
 
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 rad = Math.abs(H*30 + M*0.5 - M*6);
      		if(rad >= 180){
            rad = 360 - rad;
            }
      		double C = 0;
      		
      		C  =  Math.pow(A,2)+Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(rad));
      
		System.out.println(Math.pow(C,0.5));
	}
 
}