/* C - :(Colon) */

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int A = scan.nextInt();
    int B = scan.nextInt();
    int H = scan.nextInt();
    int M = scan.nextInt();
    double arg1 = 30 * H + 0.5 * M;
    double arg2 = 6 * M;
    double x1 = A * Math.cos(Math.toRadians(arg1));
    double y1 = A * Math.sin(Math.toRadians(arg1));
    double x2 = B * Math.cos(Math.toRadians(arg2));
    double y2 = B * Math.sin(Math.toRadians(arg2));
    System.out.println(Math.hypot(x2 - x1, y2 - y1));
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int A = scan.nextInt();
    int B = scan.nextInt();
    int H = scan.nextInt();
    int M = scan.nextInt();
    double arg1 = 30 * H + 0.5 * M;
    double arg2 = 6 * M;
    double x1 = A * Math.cos(Math.toRadians(arg1));
    double y1 = A * Math.sin(Math.toRadians(arg1));
    double x2 = B * Math.cos(Math.toRadians(arg2));
    double y2 = B * Math.sin(Math.toRadians(arg2));
    System.out.println(Math.hypot(x2 - x1, y2 - y1));
  }
} Main public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int A = scan.nextInt();
    int B = scan.nextInt();
    int H = scan.nextInt();
    int M = scan.nextInt();
    double arg1 = 30 * H + 0.5 * M;
    double arg2 = 6 * M;
    double x1 = A * Math.cos(Math.toRadians(arg1));
    double y1 = A * Math.sin(Math.toRadians(arg1));
    double x2 = B * Math.cos(Math.toRadians(arg2));
    double y2 = B * Math.sin(Math.toRadians(arg2));
    System.out.println(Math.hypot(x2 - x1, y2 - y1));
  } main {
    Scanner scan = new Scanner(System.in);
    int A = scan.nextInt();
    int B = scan.nextInt();
    int H = scan.nextInt();
    int M = scan.nextInt();
    double arg1 = 30 * H + 0.5 * M;
    double arg2 = 6 * M;
    double x1 = A * Math.cos(Math.toRadians(arg1));
    double y1 = A * Math.sin(Math.toRadians(arg1));
    double x2 = B * Math.cos(Math.toRadians(arg2));
    double y2 = B * Math.sin(Math.toRadians(arg2));
    System.out.println(Math.hypot(x2 - x1, y2 - y1));
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int A = scan.nextInt(); A scan.nextInt() scan.nextInt scan int B = scan.nextInt(); B scan.nextInt() scan.nextInt scan int H = scan.nextInt(); H scan.nextInt() scan.nextInt scan int M = scan.nextInt(); M scan.nextInt() scan.nextInt scan double arg1 = 30 * H + 0.5 * M; arg1 30 * H + 0.5 * M 30 * H 30 H 0.5 * M 0.5 M double arg2 = 6 * M; arg2 6 * M 6 M double x1 = A * Math.cos(Math.toRadians(arg1)); x1 A * Math.cos(Math.toRadians(arg1)) A Math.cos(Math.toRadians(arg1)) Math.cos Math Math.toRadians(arg1) Math.toRadians Math arg1 double y1 = A * Math.sin(Math.toRadians(arg1)); y1 A * Math.sin(Math.toRadians(arg1)) A Math.sin(Math.toRadians(arg1)) Math.sin Math Math.toRadians(arg1) Math.toRadians Math arg1 double x2 = B * Math.cos(Math.toRadians(arg2)); x2 B * Math.cos(Math.toRadians(arg2)) B Math.cos(Math.toRadians(arg2)) Math.cos Math Math.toRadians(arg2) Math.toRadians Math arg2 double y2 = B * Math.sin(Math.toRadians(arg2)); y2 B * Math.sin(Math.toRadians(arg2)) B Math.sin(Math.toRadians(arg2)) Math.sin Math Math.toRadians(arg2) Math.toRadians Math arg2 System.out.println(Math.hypot(x2 - x1, y2 - y1)) System.out.println System.out System System.out Math.hypot(x2 - x1, y2 - y1) Math.hypot Math x2 - x1 x2 x1 y2 - y1 y2 y1 String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int A = scan.nextInt();
    int B = scan.nextInt();
    int H = scan.nextInt();
    int M = scan.nextInt();
    double arg1 = 30 * H + 0.5 * M;
    double arg2 = 6 * M;
    double x1 = A * Math.cos(Math.toRadians(arg1));
    double y1 = A * Math.sin(Math.toRadians(arg1));
    double x2 = B * Math.cos(Math.toRadians(arg2));
    double y2 = B * Math.sin(Math.toRadians(arg2));
    System.out.println(Math.hypot(x2 - x1, y2 - y1));
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int A = scan.nextInt();
    int B = scan.nextInt();
    int H = scan.nextInt();
    int M = scan.nextInt();
    double arg1 = 30 * H + 0.5 * M;
    double arg2 = 6 * M;
    double x1 = A * Math.cos(Math.toRadians(arg1));
    double y1 = A * Math.sin(Math.toRadians(arg1));
    double x2 = B * Math.cos(Math.toRadians(arg2));
    double y2 = B * Math.sin(Math.toRadians(arg2));
    System.out.println(Math.hypot(x2 - x1, y2 - y1));
  }
} Main
/* C - :(Colon) */

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int A = scan.nextInt();
    int B = scan.nextInt();
    int H = scan.nextInt();
    int M = scan.nextInt();
    double arg1 = 30 * H + 0.5 * M;
    double arg2 = 6 * M;
    double x1 = A * Math.cos(Math.toRadians(arg1));
    double y1 = A * Math.sin(Math.toRadians(arg1));
    double x2 = B * Math.cos(Math.toRadians(arg2));
    double y2 = B * Math.sin(Math.toRadians(arg2));
    System.out.println(Math.hypot(x2 - x1, y2 - y1));
  }
}
