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 ten_a = h*30 + m*0.5;
    double ten_b = m*6;
    
    double ax = Math.cos(Math.toRadians(ten_a)) * a;
    double ay = Math.sin(Math.toRadians(ten_a)) * a;
    
    double bx = Math.cos(Math.toRadians(ten_b)) * b;
    double by = Math.sin(Math.toRadians(ten_b)) * b;
    
    double ans = (Math.sqrt(Math.pow((ax-bx), 2) + Math.pow((ay-by), 2)));

    System.out.println(ans);
    
  }
} 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 ten_a = h*30 + m*0.5;
    double ten_b = m*6;
    
    double ax = Math.cos(Math.toRadians(ten_a)) * a;
    double ay = Math.sin(Math.toRadians(ten_a)) * a;
    
    double bx = Math.cos(Math.toRadians(ten_b)) * b;
    double by = Math.sin(Math.toRadians(ten_b)) * b;
    
    double ans = (Math.sqrt(Math.pow((ax-bx), 2) + Math.pow((ay-by), 2)));

    System.out.println(ans);
    
  }
} 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 ten_a = h*30 + m*0.5;
    double ten_b = m*6;
    
    double ax = Math.cos(Math.toRadians(ten_a)) * a;
    double ay = Math.sin(Math.toRadians(ten_a)) * a;
    
    double bx = Math.cos(Math.toRadians(ten_b)) * b;
    double by = Math.sin(Math.toRadians(ten_b)) * b;
    
    double ans = (Math.sqrt(Math.pow((ax-bx), 2) + Math.pow((ay-by), 2)));

    System.out.println(ans);
    
  } main {
    Scanner sc = new Scanner(System.in);
    double a = sc.nextDouble();
    double b = sc.nextDouble();
    double h = sc.nextDouble();
    double m = sc.nextDouble();
    
    double ten_a = h*30 + m*0.5;
    double ten_b = m*6;
    
    double ax = Math.cos(Math.toRadians(ten_a)) * a;
    double ay = Math.sin(Math.toRadians(ten_a)) * a;
    
    double bx = Math.cos(Math.toRadians(ten_b)) * b;
    double by = Math.sin(Math.toRadians(ten_b)) * b;
    
    double ans = (Math.sqrt(Math.pow((ax-bx), 2) + Math.pow((ay-by), 2)));

    System.out.println(ans);
    
  } 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 ten_a = h*30 + m*0.5; ten_a h*30 + m*0.5 h*30 h 30 m*0.5 m 0.5 double ten_b = m*6; ten_b m*6 m 6 double ax = Math.cos(Math.toRadians(ten_a)) * a; ax Math.cos(Math.toRadians(ten_a)) * a Math.cos(Math.toRadians(ten_a)) Math.cos Math Math.toRadians(ten_a) Math.toRadians Math ten_a a double ay = Math.sin(Math.toRadians(ten_a)) * a; ay Math.sin(Math.toRadians(ten_a)) * a Math.sin(Math.toRadians(ten_a)) Math.sin Math Math.toRadians(ten_a) Math.toRadians Math ten_a a double bx = Math.cos(Math.toRadians(ten_b)) * b; bx Math.cos(Math.toRadians(ten_b)) * b Math.cos(Math.toRadians(ten_b)) Math.cos Math Math.toRadians(ten_b) Math.toRadians Math ten_b b double by = Math.sin(Math.toRadians(ten_b)) * b; by Math.sin(Math.toRadians(ten_b)) * b Math.sin(Math.toRadians(ten_b)) Math.sin Math Math.toRadians(ten_b) Math.toRadians Math ten_b b double ans = (Math.sqrt(Math.pow((ax-bx), 2) + Math.pow((ay-by), 2))); ans (Math.sqrt(Math.pow((ax-bx), 2) + Math.pow((ay-by), 2))) Math.sqrt Math Math.pow((ax-bx), 2) + Math.pow((ay-by), 2) Math.pow((ax-bx), 2) Math.pow Math (ax-bx) ax bx 2 Math.pow((ay-by), 2) Math.pow Math (ay-by) ay by 2 System.out.println(ans) System.out.println System.out System System.out ans 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 ten_a = h*30 + m*0.5;
    double ten_b = m*6;
    
    double ax = Math.cos(Math.toRadians(ten_a)) * a;
    double ay = Math.sin(Math.toRadians(ten_a)) * a;
    
    double bx = Math.cos(Math.toRadians(ten_b)) * b;
    double by = Math.sin(Math.toRadians(ten_b)) * b;
    
    double ans = (Math.sqrt(Math.pow((ax-bx), 2) + Math.pow((ay-by), 2)));

    System.out.println(ans);
    
  }
} 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 ten_a = h*30 + m*0.5;
    double ten_b = m*6;
    
    double ax = Math.cos(Math.toRadians(ten_a)) * a;
    double ay = Math.sin(Math.toRadians(ten_a)) * a;
    
    double bx = Math.cos(Math.toRadians(ten_b)) * b;
    double by = Math.sin(Math.toRadians(ten_b)) * b;
    
    double ans = (Math.sqrt(Math.pow((ax-bx), 2) + Math.pow((ay-by), 2)));

    System.out.println(ans);
    
  }
} 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 ten_a = h*30 + m*0.5;
    double ten_b = m*6;
    
    double ax = Math.cos(Math.toRadians(ten_a)) * a;
    double ay = Math.sin(Math.toRadians(ten_a)) * a;
    
    double bx = Math.cos(Math.toRadians(ten_b)) * b;
    double by = Math.sin(Math.toRadians(ten_b)) * b;
    
    double ans = (Math.sqrt(Math.pow((ax-bx), 2) + Math.pow((ay-by), 2)));

    System.out.println(ans);
    
  }
}