import java.util.Scanner;

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 xShort;
    double yShort;
    double degreeShort = 90 - (30 * H) - (30 * M / 60); // 時針は分針のぶんもちょっぴり動く
    double xLong;
    double yLong;
    double degreeLong = 90 - (6 * M);

    double radianShort = degreeShort * Math.PI / 180;
    yShort = Math.sin(radianShort) * A;
    xShort = Math.cos(radianShort) * A;

    double radianLong = degreeLong * Math.PI / 180;
    yLong = Math.sin(radianLong) * B;
    xLong = Math.cos(radianLong) * B;

    double distance =
        Math.sqrt((xLong - xShort) * (xLong - xShort) + (yLong - yShort) * (yLong - yShort));
    System.out.println(distance);
  }
} 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.nextDouble();
    double B = sc.nextDouble();
    double H = sc.nextDouble();
    double M = sc.nextDouble();
    double xShort;
    double yShort;
    double degreeShort = 90 - (30 * H) - (30 * M / 60); // 時針は分針のぶんもちょっぴり動く
    double xLong;
    double yLong;
    double degreeLong = 90 - (6 * M);

    double radianShort = degreeShort * Math.PI / 180;
    yShort = Math.sin(radianShort) * A;
    xShort = Math.cos(radianShort) * A;

    double radianLong = degreeLong * Math.PI / 180;
    yLong = Math.sin(radianLong) * B;
    xLong = Math.cos(radianLong) * B;

    double distance =
        Math.sqrt((xLong - xShort) * (xLong - xShort) + (yLong - yShort) * (yLong - yShort));
    System.out.println(distance);
  }
} 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 xShort;
    double yShort;
    double degreeShort = 90 - (30 * H) - (30 * M / 60); // 時針は分針のぶんもちょっぴり動く
    double xLong;
    double yLong;
    double degreeLong = 90 - (6 * M);

    double radianShort = degreeShort * Math.PI / 180;
    yShort = Math.sin(radianShort) * A;
    xShort = Math.cos(radianShort) * A;

    double radianLong = degreeLong * Math.PI / 180;
    yLong = Math.sin(radianLong) * B;
    xLong = Math.cos(radianLong) * B;

    double distance =
        Math.sqrt((xLong - xShort) * (xLong - xShort) + (yLong - yShort) * (yLong - yShort));
    System.out.println(distance);
  } main {
    Scanner sc = new Scanner(System.in);
    double A = sc.nextDouble();
    double B = sc.nextDouble();
    double H = sc.nextDouble();
    double M = sc.nextDouble();
    double xShort;
    double yShort;
    double degreeShort = 90 - (30 * H) - (30 * M / 60); // 時針は分針のぶんもちょっぴり動く
    double xLong;
    double yLong;
    double degreeLong = 90 - (6 * M);

    double radianShort = degreeShort * Math.PI / 180;
    yShort = Math.sin(radianShort) * A;
    xShort = Math.cos(radianShort) * A;

    double radianLong = degreeLong * Math.PI / 180;
    yLong = Math.sin(radianLong) * B;
    xLong = Math.cos(radianLong) * B;

    double distance =
        Math.sqrt((xLong - xShort) * (xLong - xShort) + (yLong - yShort) * (yLong - yShort));
    System.out.println(distance);
  } 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 xShort; xShort double yShort; yShort double degreeShort = 90 - (30 * H) - (30 * M / 60); degreeShort 90 - (30 * H) - (30 * M / 60) 90 - (30 * H) - (30 * M / 60) 90 (30 * H) 30 H (30 * M / 60) 30 * M 30 M 60 double xLong; xLong double yLong; yLong double degreeLong = 90 - (6 * M); degreeLong 90 - (6 * M) 90 (6 * M) 6 M double radianShort = degreeShort * Math.PI / 180; radianShort degreeShort * Math.PI / 180 degreeShort * Math.PI degreeShort Math.PI Math Math.PI 180 yShort = Math.sin(radianShort) * A yShort Math.sin(radianShort) * A Math.sin(radianShort) Math.sin Math radianShort A xShort = Math.cos(radianShort) * A xShort Math.cos(radianShort) * A Math.cos(radianShort) Math.cos Math radianShort A double radianLong = degreeLong * Math.PI / 180; radianLong degreeLong * Math.PI / 180 degreeLong * Math.PI degreeLong Math.PI Math Math.PI 180 yLong = Math.sin(radianLong) * B yLong Math.sin(radianLong) * B Math.sin(radianLong) Math.sin Math radianLong B xLong = Math.cos(radianLong) * B xLong Math.cos(radianLong) * B Math.cos(radianLong) Math.cos Math radianLong B double distance =
        Math.sqrt((xLong - xShort) * (xLong - xShort) + (yLong - yShort) * (yLong - yShort)); distance Math.sqrt((xLong - xShort) * (xLong - xShort) + (yLong - yShort) * (yLong - yShort)) Math.sqrt Math (xLong - xShort) * (xLong - xShort) + (yLong - yShort) * (yLong - yShort) (xLong - xShort) * (xLong - xShort) (xLong - xShort) xLong xShort (xLong - xShort) xLong xShort (yLong - yShort) * (yLong - yShort) (yLong - yShort) yLong yShort (yLong - yShort) yLong yShort System.out.println(distance) System.out.println System.out System System.out distance 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 xShort;
    double yShort;
    double degreeShort = 90 - (30 * H) - (30 * M / 60); // 時針は分針のぶんもちょっぴり動く
    double xLong;
    double yLong;
    double degreeLong = 90 - (6 * M);

    double radianShort = degreeShort * Math.PI / 180;
    yShort = Math.sin(radianShort) * A;
    xShort = Math.cos(radianShort) * A;

    double radianLong = degreeLong * Math.PI / 180;
    yLong = Math.sin(radianLong) * B;
    xLong = Math.cos(radianLong) * B;

    double distance =
        Math.sqrt((xLong - xShort) * (xLong - xShort) + (yLong - yShort) * (yLong - yShort));
    System.out.println(distance);
  }
} 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 xShort;
    double yShort;
    double degreeShort = 90 - (30 * H) - (30 * M / 60); // 時針は分針のぶんもちょっぴり動く
    double xLong;
    double yLong;
    double degreeLong = 90 - (6 * M);

    double radianShort = degreeShort * Math.PI / 180;
    yShort = Math.sin(radianShort) * A;
    xShort = Math.cos(radianShort) * A;

    double radianLong = degreeLong * Math.PI / 180;
    yLong = Math.sin(radianLong) * B;
    xLong = Math.cos(radianLong) * B;

    double distance =
        Math.sqrt((xLong - xShort) * (xLong - xShort) + (yLong - yShort) * (yLong - yShort));
    System.out.println(distance);
  }
} Main
import java.util.Scanner;

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 xShort;
    double yShort;
    double degreeShort = 90 - (30 * H) - (30 * M / 60); // 時針は分針のぶんもちょっぴり動く
    double xLong;
    double yLong;
    double degreeLong = 90 - (6 * M);

    double radianShort = degreeShort * Math.PI / 180;
    yShort = Math.sin(radianShort) * A;
    xShort = Math.cos(radianShort) * A;

    double radianLong = degreeLong * Math.PI / 180;
    yLong = Math.sin(radianLong) * B;
    xLong = Math.cos(radianLong) * B;

    double distance =
        Math.sqrt((xLong - xShort) * (xLong - xShort) + (yLong - yShort) * (yLong - yShort));
    System.out.println(distance);
  }
}
