import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int Hlength=sc.nextInt();
        int Mlength=sc.nextInt();
        int H=sc.nextInt();
        int M=sc.nextInt();
        double Hdiff=(double)M/60;
        double Hdeg=90-(360*(H+Hdiff)/12);
        double Mdeg=90-(360*M/60);
 
        double Hth=Math.toRadians(Hdeg);
        double Mth=Math.toRadians(Mdeg);
 
        double Hx=Hlength*Math.cos(Hth);
        double Hy=Hlength*Math.sin(Hth);
        double Mx=Mlength*Math.cos(Mth);
        double My=Mlength*Math.sin(Mth);
 
        double dis=Math.sqrt(Math.pow((Hx-Mx),2)+Math.pow((Hy-My),2));
        System.out.println(dis);
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int Hlength=sc.nextInt();
        int Mlength=sc.nextInt();
        int H=sc.nextInt();
        int M=sc.nextInt();
        double Hdiff=(double)M/60;
        double Hdeg=90-(360*(H+Hdiff)/12);
        double Mdeg=90-(360*M/60);
 
        double Hth=Math.toRadians(Hdeg);
        double Mth=Math.toRadians(Mdeg);
 
        double Hx=Hlength*Math.cos(Hth);
        double Hy=Hlength*Math.sin(Hth);
        double Mx=Mlength*Math.cos(Mth);
        double My=Mlength*Math.sin(Mth);
 
        double dis=Math.sqrt(Math.pow((Hx-Mx),2)+Math.pow((Hy-My),2));
        System.out.println(dis);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int Hlength=sc.nextInt();
        int Mlength=sc.nextInt();
        int H=sc.nextInt();
        int M=sc.nextInt();
        double Hdiff=(double)M/60;
        double Hdeg=90-(360*(H+Hdiff)/12);
        double Mdeg=90-(360*M/60);
 
        double Hth=Math.toRadians(Hdeg);
        double Mth=Math.toRadians(Mdeg);
 
        double Hx=Hlength*Math.cos(Hth);
        double Hy=Hlength*Math.sin(Hth);
        double Mx=Mlength*Math.cos(Mth);
        double My=Mlength*Math.sin(Mth);
 
        double dis=Math.sqrt(Math.pow((Hx-Mx),2)+Math.pow((Hy-My),2));
        System.out.println(dis);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int Hlength=sc.nextInt();
        int Mlength=sc.nextInt();
        int H=sc.nextInt();
        int M=sc.nextInt();
        double Hdiff=(double)M/60;
        double Hdeg=90-(360*(H+Hdiff)/12);
        double Mdeg=90-(360*M/60);
 
        double Hth=Math.toRadians(Hdeg);
        double Mth=Math.toRadians(Mdeg);
 
        double Hx=Hlength*Math.cos(Hth);
        double Hy=Hlength*Math.sin(Hth);
        double Mx=Mlength*Math.cos(Mth);
        double My=Mlength*Math.sin(Mth);
 
        double dis=Math.sqrt(Math.pow((Hx-Mx),2)+Math.pow((Hy-My),2));
        System.out.println(dis);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int Hlength=sc.nextInt(); Hlength sc.nextInt() sc.nextInt sc int Mlength=sc.nextInt(); Mlength sc.nextInt() sc.nextInt sc int H=sc.nextInt(); H sc.nextInt() sc.nextInt sc int M=sc.nextInt(); M sc.nextInt() sc.nextInt sc double Hdiff=(double)M/60; Hdiff (double)M/60 (double)M 60 double Hdeg=90-(360*(H+Hdiff)/12); Hdeg 90-(360*(H+Hdiff)/12) 90 (360*(H+Hdiff)/12) 360*(H+Hdiff) 360 (H+Hdiff) H Hdiff 12 double Mdeg=90-(360*M/60); Mdeg 90-(360*M/60) 90 (360*M/60) 360*M 360 M 60 double Hth=Math.toRadians(Hdeg); Hth Math.toRadians(Hdeg) Math.toRadians Math Hdeg double Mth=Math.toRadians(Mdeg); Mth Math.toRadians(Mdeg) Math.toRadians Math Mdeg double Hx=Hlength*Math.cos(Hth); Hx Hlength*Math.cos(Hth) Hlength Math.cos(Hth) Math.cos Math Hth double Hy=Hlength*Math.sin(Hth); Hy Hlength*Math.sin(Hth) Hlength Math.sin(Hth) Math.sin Math Hth double Mx=Mlength*Math.cos(Mth); Mx Mlength*Math.cos(Mth) Mlength Math.cos(Mth) Math.cos Math Mth double My=Mlength*Math.sin(Mth); My Mlength*Math.sin(Mth) Mlength Math.sin(Mth) Math.sin Math Mth double dis=Math.sqrt(Math.pow((Hx-Mx),2)+Math.pow((Hy-My),2)); dis Math.sqrt(Math.pow((Hx-Mx),2)+Math.pow((Hy-My),2)) Math.sqrt Math Math.pow((Hx-Mx),2)+Math.pow((Hy-My),2) Math.pow((Hx-Mx),2) Math.pow Math (Hx-Mx) Hx Mx 2 Math.pow((Hy-My),2) Math.pow Math (Hy-My) Hy My 2 System.out.println(dis) System.out.println System.out System System.out dis sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int Hlength=sc.nextInt();
        int Mlength=sc.nextInt();
        int H=sc.nextInt();
        int M=sc.nextInt();
        double Hdiff=(double)M/60;
        double Hdeg=90-(360*(H+Hdiff)/12);
        double Mdeg=90-(360*M/60);
 
        double Hth=Math.toRadians(Hdeg);
        double Mth=Math.toRadians(Mdeg);
 
        double Hx=Hlength*Math.cos(Hth);
        double Hy=Hlength*Math.sin(Hth);
        double Mx=Mlength*Math.cos(Mth);
        double My=Mlength*Math.sin(Mth);
 
        double dis=Math.sqrt(Math.pow((Hx-Mx),2)+Math.pow((Hy-My),2));
        System.out.println(dis);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int Hlength=sc.nextInt();
        int Mlength=sc.nextInt();
        int H=sc.nextInt();
        int M=sc.nextInt();
        double Hdiff=(double)M/60;
        double Hdeg=90-(360*(H+Hdiff)/12);
        double Mdeg=90-(360*M/60);
 
        double Hth=Math.toRadians(Hdeg);
        double Mth=Math.toRadians(Mdeg);
 
        double Hx=Hlength*Math.cos(Hth);
        double Hy=Hlength*Math.sin(Hth);
        double Mx=Mlength*Math.cos(Mth);
        double My=Mlength*Math.sin(Mth);
 
        double dis=Math.sqrt(Math.pow((Hx-Mx),2)+Math.pow((Hy-My),2));
        System.out.println(dis);
        sc.close();
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int Hlength=sc.nextInt();
        int Mlength=sc.nextInt();
        int H=sc.nextInt();
        int M=sc.nextInt();
        double Hdiff=(double)M/60;
        double Hdeg=90-(360*(H+Hdiff)/12);
        double Mdeg=90-(360*M/60);
 
        double Hth=Math.toRadians(Hdeg);
        double Mth=Math.toRadians(Mdeg);
 
        double Hx=Hlength*Math.cos(Hth);
        double Hy=Hlength*Math.sin(Hth);
        double Mx=Mlength*Math.cos(Mth);
        double My=Mlength*Math.sin(Mth);
 
        double dis=Math.sqrt(Math.pow((Hx-Mx),2)+Math.pow((Hy-My),2));
        System.out.println(dis);
        sc.close();
    }
}