import java.util.Scanner;

/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        sc.close();

        double positionAx = A*Math.sin(((double)H+(double)M/60)/12*2*Math.PI);
        double positionAy = A*Math.cos(((double)H+(double)M/60)/12*2*Math.PI);

        double positionBx = B*Math.sin(((double)M/60)*2*Math.PI);
        double positionBy = B*Math.cos(((double)M/60)*2*Math.PI);


        double ans = Math.sqrt(Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2));

        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        sc.close();

        double positionAx = A*Math.sin(((double)H+(double)M/60)/12*2*Math.PI);
        double positionAy = A*Math.cos(((double)H+(double)M/60)/12*2*Math.PI);

        double positionBx = B*Math.sin(((double)M/60)*2*Math.PI);
        double positionBy = B*Math.cos(((double)M/60)*2*Math.PI);


        double ans = Math.sqrt(Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2));

        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        sc.close();

        double positionAx = A*Math.sin(((double)H+(double)M/60)/12*2*Math.PI);
        double positionAy = A*Math.cos(((double)H+(double)M/60)/12*2*Math.PI);

        double positionBx = B*Math.sin(((double)M/60)*2*Math.PI);
        double positionBy = B*Math.cos(((double)M/60)*2*Math.PI);


        double ans = Math.sqrt(Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2));

        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        sc.close();

        double positionAx = A*Math.sin(((double)H+(double)M/60)/12*2*Math.PI);
        double positionAy = A*Math.cos(((double)H+(double)M/60)/12*2*Math.PI);

        double positionBx = B*Math.sin(((double)M/60)*2*Math.PI);
        double positionBy = B*Math.cos(((double)M/60)*2*Math.PI);


        double ans = Math.sqrt(Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2));

        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B 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 sc.close() sc.close sc double positionAx = A*Math.sin(((double)H+(double)M/60)/12*2*Math.PI); positionAx A*Math.sin(((double)H+(double)M/60)/12*2*Math.PI) A Math.sin(((double)H+(double)M/60)/12*2*Math.PI) Math.sin Math ((double)H+(double)M/60)/12*2*Math.PI ((double)H+(double)M/60)/12*2*Math.PI ((double)H+(double)M/60)/12 ((double)H+(double)M/60) (double)H (double)M/60 (double)M 60 12 2 Math.PI Math Math.PI double positionAy = A*Math.cos(((double)H+(double)M/60)/12*2*Math.PI); positionAy A*Math.cos(((double)H+(double)M/60)/12*2*Math.PI) A Math.cos(((double)H+(double)M/60)/12*2*Math.PI) Math.cos Math ((double)H+(double)M/60)/12*2*Math.PI ((double)H+(double)M/60)/12*2*Math.PI ((double)H+(double)M/60)/12 ((double)H+(double)M/60) (double)H (double)M/60 (double)M 60 12 2 Math.PI Math Math.PI double positionBx = B*Math.sin(((double)M/60)*2*Math.PI); positionBx B*Math.sin(((double)M/60)*2*Math.PI) B Math.sin(((double)M/60)*2*Math.PI) Math.sin Math ((double)M/60)*2*Math.PI ((double)M/60)*2*Math.PI ((double)M/60) (double)M 60 2 Math.PI Math Math.PI double positionBy = B*Math.cos(((double)M/60)*2*Math.PI); positionBy B*Math.cos(((double)M/60)*2*Math.PI) B Math.cos(((double)M/60)*2*Math.PI) Math.cos Math ((double)M/60)*2*Math.PI ((double)M/60)*2*Math.PI ((double)M/60) (double)M 60 2 Math.PI Math Math.PI double ans = Math.sqrt(Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2)); ans Math.sqrt(Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2)) Math.sqrt Math Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2) Math.pow((positionAx-positionBx),2) Math.pow Math (positionAx-positionBx) positionAx positionBx 2 Math.pow((positionAy-positionBy), 2) Math.pow Math (positionAy-positionBy) positionAy positionBy 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        sc.close();

        double positionAx = A*Math.sin(((double)H+(double)M/60)/12*2*Math.PI);
        double positionAy = A*Math.cos(((double)H+(double)M/60)/12*2*Math.PI);

        double positionBx = B*Math.sin(((double)M/60)*2*Math.PI);
        double positionBy = B*Math.cos(((double)M/60)*2*Math.PI);


        double ans = Math.sqrt(Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2));

        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        sc.close();

        double positionAx = A*Math.sin(((double)H+(double)M/60)/12*2*Math.PI);
        double positionAy = A*Math.cos(((double)H+(double)M/60)/12*2*Math.PI);

        double positionBx = B*Math.sin(((double)M/60)*2*Math.PI);
        double positionBy = B*Math.cos(((double)M/60)*2*Math.PI);


        double ans = Math.sqrt(Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2));

        System.out.println(ans);
    }
} Main
import java.util.Scanner;

/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        sc.close();

        double positionAx = A*Math.sin(((double)H+(double)M/60)/12*2*Math.PI);
        double positionAy = A*Math.cos(((double)H+(double)M/60)/12*2*Math.PI);

        double positionBx = B*Math.sin(((double)M/60)*2*Math.PI);
        double positionBy = B*Math.cos(((double)M/60)*2*Math.PI);


        double ans = Math.sqrt(Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2));

        System.out.println(ans);
    }
}