import java.util.Scanner;


class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   int C = sc.nextInt();
   int D = sc.nextInt();
   
    double radian = Math.PI*2*(C/12.0 + (D/60.0)/12.0 - D / 60.0);
   
  
   System.out.println(Math.sqrt((double)((A*A)+(B*B)-(2*A*B*Math.cos(radian)))));
 
 }
} import java.util.Scanner; Scanner java.util class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   int C = sc.nextInt();
   int D = sc.nextInt();
   
    double radian = Math.PI*2*(C/12.0 + (D/60.0)/12.0 - D / 60.0);
   
  
   System.out.println(Math.sqrt((double)((A*A)+(B*B)-(2*A*B*Math.cos(radian)))));
 
 }
} Main public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   int C = sc.nextInt();
   int D = sc.nextInt();
   
    double radian = Math.PI*2*(C/12.0 + (D/60.0)/12.0 - D / 60.0);
   
  
   System.out.println(Math.sqrt((double)((A*A)+(B*B)-(2*A*B*Math.cos(radian)))));
 
 } main {
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   int C = sc.nextInt();
   int D = sc.nextInt();
   
    double radian = Math.PI*2*(C/12.0 + (D/60.0)/12.0 - D / 60.0);
   
  
   System.out.println(Math.sqrt((double)((A*A)+(B*B)-(2*A*B*Math.cos(radian)))));
 
 } 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 C = sc.nextInt(); C sc.nextInt() sc.nextInt sc int D = sc.nextInt(); D sc.nextInt() sc.nextInt sc double radian = Math.PI*2*(C/12.0 + (D/60.0)/12.0 - D / 60.0); radian Math.PI*2*(C/12.0 + (D/60.0)/12.0 - D / 60.0) Math.PI*2*(C/12.0 + (D/60.0)/12.0 - D / 60.0) Math.PI Math Math.PI 2 (C/12.0 + (D/60.0)/12.0 - D / 60.0) C/12.0 + (D/60.0)/12.0 C/12.0 C 12.0 (D/60.0)/12.0 (D/60.0) D 60.0 12.0 D / 60.0 D 60.0 System.out.println(Math.sqrt((double)((A*A)+(B*B)-(2*A*B*Math.cos(radian))))) System.out.println System.out System System.out Math.sqrt((double)((A*A)+(B*B)-(2*A*B*Math.cos(radian)))) Math.sqrt Math (double)((A*A)+(B*B)-(2*A*B*Math.cos(radian))) (A*A)+(B*B) (A*A) A A (B*B) B B (2*A*B*Math.cos(radian)) B 2*A*B*Math.cos(radian) 2 A B Math.cos(radian) Math.cos Math radian String args[] args
import java.util.Scanner;


class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   int C = sc.nextInt();
   int D = sc.nextInt();
   
    double radian = Math.PI*2*(C/12.0 + (D/60.0)/12.0 - D / 60.0);
   
  
   System.out.println(Math.sqrt((double)((A*A)+(B*B)-(2*A*B*Math.cos(radian)))));
 
 }
}
