
import java.util.Scanner;

public class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    double A = sc.nextInt();
    double B = sc.nextInt();

    double Hour = sc.nextInt();
    double Minute = sc.nextInt();

    double x1 = A * Math.cos(2 * Math.PI * (Hour + Minute / 60) / 12);
    double y1 = A * Math.sin(2 * Math.PI * (Hour + Minute / 60) / 12);
    double x2 = B * Math.cos(2 * Math.PI * Minute / 60);
    double y2 = B * Math.sin(2 * Math.PI * Minute / 60);
    
    System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));

  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    double A = sc.nextInt();
    double B = sc.nextInt();

    double Hour = sc.nextInt();
    double Minute = sc.nextInt();

    double x1 = A * Math.cos(2 * Math.PI * (Hour + Minute / 60) / 12);
    double y1 = A * Math.sin(2 * Math.PI * (Hour + Minute / 60) / 12);
    double x2 = B * Math.cos(2 * Math.PI * Minute / 60);
    double y2 = B * Math.sin(2 * Math.PI * Minute / 60);
    
    System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));

  }
} Main public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    double A = sc.nextInt();
    double B = sc.nextInt();

    double Hour = sc.nextInt();
    double Minute = sc.nextInt();

    double x1 = A * Math.cos(2 * Math.PI * (Hour + Minute / 60) / 12);
    double y1 = A * Math.sin(2 * Math.PI * (Hour + Minute / 60) / 12);
    double x2 = B * Math.cos(2 * Math.PI * Minute / 60);
    double y2 = B * Math.sin(2 * Math.PI * Minute / 60);
    
    System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));

  } main {

    Scanner sc = new Scanner(System.in);

    double A = sc.nextInt();
    double B = sc.nextInt();

    double Hour = sc.nextInt();
    double Minute = sc.nextInt();

    double x1 = A * Math.cos(2 * Math.PI * (Hour + Minute / 60) / 12);
    double y1 = A * Math.sin(2 * Math.PI * (Hour + Minute / 60) / 12);
    double x2 = B * Math.cos(2 * Math.PI * Minute / 60);
    double y2 = B * Math.sin(2 * Math.PI * Minute / 60);
    
    System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double A = sc.nextInt(); A sc.nextInt() sc.nextInt sc double B = sc.nextInt(); B sc.nextInt() sc.nextInt sc double Hour = sc.nextInt(); Hour sc.nextInt() sc.nextInt sc double Minute = sc.nextInt(); Minute sc.nextInt() sc.nextInt sc double x1 = A * Math.cos(2 * Math.PI * (Hour + Minute / 60) / 12); x1 A * Math.cos(2 * Math.PI * (Hour + Minute / 60) / 12) A Math.cos(2 * Math.PI * (Hour + Minute / 60) / 12) Math.cos Math 2 * Math.PI * (Hour + Minute / 60) / 12 2 * Math.PI * (Hour + Minute / 60) 2 * Math.PI * (Hour + Minute / 60) 2 Math.PI Math Math.PI (Hour + Minute / 60) Hour Minute / 60 Minute 60 12 double y1 = A * Math.sin(2 * Math.PI * (Hour + Minute / 60) / 12); y1 A * Math.sin(2 * Math.PI * (Hour + Minute / 60) / 12) A Math.sin(2 * Math.PI * (Hour + Minute / 60) / 12) Math.sin Math 2 * Math.PI * (Hour + Minute / 60) / 12 2 * Math.PI * (Hour + Minute / 60) 2 * Math.PI * (Hour + Minute / 60) 2 Math.PI Math Math.PI (Hour + Minute / 60) Hour Minute / 60 Minute 60 12 double x2 = B * Math.cos(2 * Math.PI * Minute / 60); x2 B * Math.cos(2 * Math.PI * Minute / 60) B Math.cos(2 * Math.PI * Minute / 60) Math.cos Math 2 * Math.PI * Minute / 60 2 * Math.PI * Minute 2 * Math.PI * Minute 2 Math.PI Math Math.PI Minute 60 double y2 = B * Math.sin(2 * Math.PI * Minute / 60); y2 B * Math.sin(2 * Math.PI * Minute / 60) B Math.sin(2 * Math.PI * Minute / 60) Math.sin Math 2 * Math.PI * Minute / 60 2 * Math.PI * Minute 2 * Math.PI * Minute 2 Math.PI Math Math.PI Minute 60 System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))) System.out.println System.out System System.out Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) Math.sqrt Math (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) (x1 - x2) * (x1 - x2) (x1 - x2) x1 x2 (x1 - x2) x1 x2 (y1 - y2) * (y1 - y2) (y1 - y2) y1 y2 (y1 - y2) y1 y2 String[] args args public class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    double A = sc.nextInt();
    double B = sc.nextInt();

    double Hour = sc.nextInt();
    double Minute = sc.nextInt();

    double x1 = A * Math.cos(2 * Math.PI * (Hour + Minute / 60) / 12);
    double y1 = A * Math.sin(2 * Math.PI * (Hour + Minute / 60) / 12);
    double x2 = B * Math.cos(2 * Math.PI * Minute / 60);
    double y2 = B * Math.sin(2 * Math.PI * Minute / 60);
    
    System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));

  }
} public class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    double A = sc.nextInt();
    double B = sc.nextInt();

    double Hour = sc.nextInt();
    double Minute = sc.nextInt();

    double x1 = A * Math.cos(2 * Math.PI * (Hour + Minute / 60) / 12);
    double y1 = A * Math.sin(2 * Math.PI * (Hour + Minute / 60) / 12);
    double x2 = B * Math.cos(2 * Math.PI * Minute / 60);
    double y2 = B * Math.sin(2 * Math.PI * Minute / 60);
    
    System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));

  }
} Main

import java.util.Scanner;

public class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    double A = sc.nextInt();
    double B = sc.nextInt();

    double Hour = sc.nextInt();
    double Minute = sc.nextInt();

    double x1 = A * Math.cos(2 * Math.PI * (Hour + Minute / 60) / 12);
    double y1 = A * Math.sin(2 * Math.PI * (Hour + Minute / 60) / 12);
    double x2 = B * Math.cos(2 * Math.PI * Minute / 60);
    double y2 = B * Math.sin(2 * Math.PI * Minute / 60);
    
    System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));

  }
}