import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double A = sc.nextDouble();
    double B = sc.nextDouble();
    double H = sc.nextDouble();
    double M = sc.nextDouble();
    
    double H1 = A*Math.sin(Math.toRadians(H*30+M*0.5));
    double H2 = A*Math.cos(Math.toRadians(H*30+M*0.5));
    double M1 = B*Math.sin(Math.toRadians(M*6));
    double M2 = B*Math.cos(Math.toRadians(M*6));
    
    System.out.println(Math.sqrt(Math.pow((H1-M1), 2) + Math.pow((H2-M2), 2)));
    
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double A = sc.nextDouble();
    double B = sc.nextDouble();
    double H = sc.nextDouble();
    double M = sc.nextDouble();
    
    double H1 = A*Math.sin(Math.toRadians(H*30+M*0.5));
    double H2 = A*Math.cos(Math.toRadians(H*30+M*0.5));
    double M1 = B*Math.sin(Math.toRadians(M*6));
    double M2 = B*Math.cos(Math.toRadians(M*6));
    
    System.out.println(Math.sqrt(Math.pow((H1-M1), 2) + Math.pow((H2-M2), 2)));
    
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double A = sc.nextDouble();
    double B = sc.nextDouble();
    double H = sc.nextDouble();
    double M = sc.nextDouble();
    
    double H1 = A*Math.sin(Math.toRadians(H*30+M*0.5));
    double H2 = A*Math.cos(Math.toRadians(H*30+M*0.5));
    double M1 = B*Math.sin(Math.toRadians(M*6));
    double M2 = B*Math.cos(Math.toRadians(M*6));
    
    System.out.println(Math.sqrt(Math.pow((H1-M1), 2) + Math.pow((H2-M2), 2)));
    
  } main {
    Scanner sc = new Scanner(System.in);
    double A = sc.nextDouble();
    double B = sc.nextDouble();
    double H = sc.nextDouble();
    double M = sc.nextDouble();
    
    double H1 = A*Math.sin(Math.toRadians(H*30+M*0.5));
    double H2 = A*Math.cos(Math.toRadians(H*30+M*0.5));
    double M1 = B*Math.sin(Math.toRadians(M*6));
    double M2 = B*Math.cos(Math.toRadians(M*6));
    
    System.out.println(Math.sqrt(Math.pow((H1-M1), 2) + Math.pow((H2-M2), 2)));
    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double A = sc.nextDouble(); A sc.nextDouble() sc.nextDouble sc double B = sc.nextDouble(); B sc.nextDouble() sc.nextDouble sc double H = sc.nextDouble(); H sc.nextDouble() sc.nextDouble sc double M = sc.nextDouble(); M sc.nextDouble() sc.nextDouble sc double H1 = A*Math.sin(Math.toRadians(H*30+M*0.5)); H1 A*Math.sin(Math.toRadians(H*30+M*0.5)) A Math.sin(Math.toRadians(H*30+M*0.5)) Math.sin Math Math.toRadians(H*30+M*0.5) Math.toRadians Math H*30+M*0.5 H*30 H 30 M*0.5 M 0.5 double H2 = A*Math.cos(Math.toRadians(H*30+M*0.5)); H2 A*Math.cos(Math.toRadians(H*30+M*0.5)) A Math.cos(Math.toRadians(H*30+M*0.5)) Math.cos Math Math.toRadians(H*30+M*0.5) Math.toRadians Math H*30+M*0.5 H*30 H 30 M*0.5 M 0.5 double M1 = B*Math.sin(Math.toRadians(M*6)); M1 B*Math.sin(Math.toRadians(M*6)) B Math.sin(Math.toRadians(M*6)) Math.sin Math Math.toRadians(M*6) Math.toRadians Math M*6 M 6 double M2 = B*Math.cos(Math.toRadians(M*6)); M2 B*Math.cos(Math.toRadians(M*6)) B Math.cos(Math.toRadians(M*6)) Math.cos Math Math.toRadians(M*6) Math.toRadians Math M*6 M 6 System.out.println(Math.sqrt(Math.pow((H1-M1), 2) + Math.pow((H2-M2), 2))) System.out.println System.out System System.out Math.sqrt(Math.pow((H1-M1), 2) + Math.pow((H2-M2), 2)) Math.sqrt Math Math.pow((H1-M1), 2) + Math.pow((H2-M2), 2) Math.pow((H1-M1), 2) Math.pow Math (H1-M1) H1 M1 2 Math.pow((H2-M2), 2) Math.pow Math (H2-M2) H2 M2 2 String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double A = sc.nextDouble();
    double B = sc.nextDouble();
    double H = sc.nextDouble();
    double M = sc.nextDouble();
    
    double H1 = A*Math.sin(Math.toRadians(H*30+M*0.5));
    double H2 = A*Math.cos(Math.toRadians(H*30+M*0.5));
    double M1 = B*Math.sin(Math.toRadians(M*6));
    double M2 = B*Math.cos(Math.toRadians(M*6));
    
    System.out.println(Math.sqrt(Math.pow((H1-M1), 2) + Math.pow((H2-M2), 2)));
    
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double A = sc.nextDouble();
    double B = sc.nextDouble();
    double H = sc.nextDouble();
    double M = sc.nextDouble();
    
    double H1 = A*Math.sin(Math.toRadians(H*30+M*0.5));
    double H2 = A*Math.cos(Math.toRadians(H*30+M*0.5));
    double M1 = B*Math.sin(Math.toRadians(M*6));
    double M2 = B*Math.cos(Math.toRadians(M*6));
    
    System.out.println(Math.sqrt(Math.pow((H1-M1), 2) + Math.pow((H2-M2), 2)));
    
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double A = sc.nextDouble();
    double B = sc.nextDouble();
    double H = sc.nextDouble();
    double M = sc.nextDouble();
    
    double H1 = A*Math.sin(Math.toRadians(H*30+M*0.5));
    double H2 = A*Math.cos(Math.toRadians(H*30+M*0.5));
    double M1 = B*Math.sin(Math.toRadians(M*6));
    double M2 = B*Math.cos(Math.toRadians(M*6));
    
    System.out.println(Math.sqrt(Math.pow((H1-M1), 2) + Math.pow((H2-M2), 2)));
    
  }
}