import java.util.Scanner;
class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = 5*sc.nextDouble();
        double M = sc.nextDouble();
        H = H+M/12;
      	double RAD =Math.toRadians((M-H)*6);
        double COS = Math.cos(RAD);
        double ans = (A*A)+(B*B)-(2*A*B*COS);
        ans = Math.sqrt(ans);
      	System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = 5*sc.nextDouble();
        double M = sc.nextDouble();
        H = H+M/12;
      	double RAD =Math.toRadians((M-H)*6);
        double COS = Math.cos(RAD);
        double ans = (A*A)+(B*B)-(2*A*B*COS);
        ans = Math.sqrt(ans);
      	System.out.println(ans);
    }
} Main static Scanner sc=new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = 5*sc.nextDouble();
        double M = sc.nextDouble();
        H = H+M/12;
      	double RAD =Math.toRadians((M-H)*6);
        double COS = Math.cos(RAD);
        double ans = (A*A)+(B*B)-(2*A*B*COS);
        ans = Math.sqrt(ans);
      	System.out.println(ans);
    } main {
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = 5*sc.nextDouble();
        double M = sc.nextDouble();
        H = H+M/12;
      	double RAD =Math.toRadians((M-H)*6);
        double COS = Math.cos(RAD);
        double ans = (A*A)+(B*B)-(2*A*B*COS);
        ans = Math.sqrt(ans);
      	System.out.println(ans);
    } int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc double H = 5*sc.nextDouble(); H 5*sc.nextDouble() 5 sc.nextDouble() sc.nextDouble sc double M = sc.nextDouble(); M sc.nextDouble() sc.nextDouble sc H = H+M/12 H H+M/12 H M/12 M 12 double RAD =Math.toRadians((M-H)*6); RAD Math.toRadians((M-H)*6) Math.toRadians Math (M-H)*6 (M-H) M H 6 double COS = Math.cos(RAD); COS Math.cos(RAD) Math.cos Math RAD double ans = (A*A)+(B*B)-(2*A*B*COS); ans (A*A)+(B*B)-(2*A*B*COS) (A*A)+(B*B) (A*A) A A (B*B) B B (2*A*B*COS) B 2*A*B*COS 2 A B COS ans = Math.sqrt(ans) ans Math.sqrt(ans) Math.sqrt Math ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.Scanner;
class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int A = sc.nextInt();
        int B = sc.nextInt();
        double H = 5*sc.nextDouble();
        double M = sc.nextDouble();
        H = H+M/12;
      	double RAD =Math.toRadians((M-H)*6);
        double COS = Math.cos(RAD);
        double ans = (A*A)+(B*B)-(2*A*B*COS);
        ans = Math.sqrt(ans);
      	System.out.println(ans);
    }
}