import java.util.Scanner;
import java.lang.Math;

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        int hour = sc.nextInt();
        int minute = sc.nextInt();

        int time = hour * 60 + minute;

        double[] aPosition = new double[2];
        double[] bPosition = new double[2];

        double shortRad = 2.0 * Math.PI * (double)time / (60.0 * 12.0);
        double longRad = 2.0 * Math.PI * (double)time / 60.0;


        aPosition[0] = A * Math.sin(shortRad);
        aPosition[1] = A * Math.cos(shortRad);

        bPosition[0] = B * Math.sin(longRad);
        bPosition[1] = B * Math.cos(longRad);

        double distance;
        distance = Math.sqrt((aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) + (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1]));
        System.out.println(distance);
    }
} import java.util.Scanner; Scanner java.util import java.lang.Math; Math java.lang public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int hour = sc.nextInt();
        int minute = sc.nextInt();

        int time = hour * 60 + minute;

        double[] aPosition = new double[2];
        double[] bPosition = new double[2];

        double shortRad = 2.0 * Math.PI * (double)time / (60.0 * 12.0);
        double longRad = 2.0 * Math.PI * (double)time / 60.0;


        aPosition[0] = A * Math.sin(shortRad);
        aPosition[1] = A * Math.cos(shortRad);

        bPosition[0] = B * Math.sin(longRad);
        bPosition[1] = B * Math.cos(longRad);

        double distance;
        distance = Math.sqrt((aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) + (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1]));
        System.out.println(distance);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int hour = sc.nextInt();
        int minute = sc.nextInt();

        int time = hour * 60 + minute;

        double[] aPosition = new double[2];
        double[] bPosition = new double[2];

        double shortRad = 2.0 * Math.PI * (double)time / (60.0 * 12.0);
        double longRad = 2.0 * Math.PI * (double)time / 60.0;


        aPosition[0] = A * Math.sin(shortRad);
        aPosition[1] = A * Math.cos(shortRad);

        bPosition[0] = B * Math.sin(longRad);
        bPosition[1] = B * Math.cos(longRad);

        double distance;
        distance = Math.sqrt((aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) + (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1]));
        System.out.println(distance);
    } main {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int hour = sc.nextInt();
        int minute = sc.nextInt();

        int time = hour * 60 + minute;

        double[] aPosition = new double[2];
        double[] bPosition = new double[2];

        double shortRad = 2.0 * Math.PI * (double)time / (60.0 * 12.0);
        double longRad = 2.0 * Math.PI * (double)time / 60.0;


        aPosition[0] = A * Math.sin(shortRad);
        aPosition[1] = A * Math.cos(shortRad);

        bPosition[0] = B * Math.sin(longRad);
        bPosition[1] = B * Math.cos(longRad);

        double distance;
        distance = Math.sqrt((aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) + (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1]));
        System.out.println(distance);
    } 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 hour = sc.nextInt(); hour sc.nextInt() sc.nextInt sc int minute = sc.nextInt(); minute sc.nextInt() sc.nextInt sc int time = hour * 60 + minute; time hour * 60 + minute hour * 60 hour 60 minute double[] aPosition = new double[2]; aPosition new double[2] 2 double[] bPosition = new double[2]; bPosition new double[2] 2 double shortRad = 2.0 * Math.PI * (double)time / (60.0 * 12.0); shortRad 2.0 * Math.PI * (double)time / (60.0 * 12.0) 2.0 * Math.PI * (double)time 2.0 * Math.PI * (double)time 2.0 Math.PI Math Math.PI (double)time (60.0 * 12.0) 60.0 12.0 double longRad = 2.0 * Math.PI * (double)time / 60.0; longRad 2.0 * Math.PI * (double)time / 60.0 2.0 * Math.PI * (double)time 2.0 * Math.PI * (double)time 2.0 Math.PI Math Math.PI (double)time 60.0 aPosition[0] = A * Math.sin(shortRad) aPosition[0] aPosition 0 A * Math.sin(shortRad) A Math.sin(shortRad) Math.sin Math shortRad aPosition[1] = A * Math.cos(shortRad) aPosition[1] aPosition 1 A * Math.cos(shortRad) A Math.cos(shortRad) Math.cos Math shortRad bPosition[0] = B * Math.sin(longRad) bPosition[0] bPosition 0 B * Math.sin(longRad) B Math.sin(longRad) Math.sin Math longRad bPosition[1] = B * Math.cos(longRad) bPosition[1] bPosition 1 B * Math.cos(longRad) B Math.cos(longRad) Math.cos Math longRad double distance; distance distance = Math.sqrt((aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) + (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1])) distance Math.sqrt((aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) + (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1])) Math.sqrt Math (aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) + (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1]) (aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) (aPosition[0] - bPosition[0]) aPosition[0] aPosition 0 bPosition[0] bPosition 0 (aPosition[0] - bPosition[0]) aPosition[0] aPosition 0 bPosition[0] bPosition 0 (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1]) (aPosition[1] - bPosition[1]) aPosition[1] aPosition 1 bPosition[1] bPosition 1 (aPosition[1] - bPosition[1]) aPosition[1] aPosition 1 bPosition[1] bPosition 1 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);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int hour = sc.nextInt();
        int minute = sc.nextInt();

        int time = hour * 60 + minute;

        double[] aPosition = new double[2];
        double[] bPosition = new double[2];

        double shortRad = 2.0 * Math.PI * (double)time / (60.0 * 12.0);
        double longRad = 2.0 * Math.PI * (double)time / 60.0;


        aPosition[0] = A * Math.sin(shortRad);
        aPosition[1] = A * Math.cos(shortRad);

        bPosition[0] = B * Math.sin(longRad);
        bPosition[1] = B * Math.cos(longRad);

        double distance;
        distance = Math.sqrt((aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) + (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1]));
        System.out.println(distance);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int hour = sc.nextInt();
        int minute = sc.nextInt();

        int time = hour * 60 + minute;

        double[] aPosition = new double[2];
        double[] bPosition = new double[2];

        double shortRad = 2.0 * Math.PI * (double)time / (60.0 * 12.0);
        double longRad = 2.0 * Math.PI * (double)time / 60.0;


        aPosition[0] = A * Math.sin(shortRad);
        aPosition[1] = A * Math.cos(shortRad);

        bPosition[0] = B * Math.sin(longRad);
        bPosition[1] = B * Math.cos(longRad);

        double distance;
        distance = Math.sqrt((aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) + (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1]));
        System.out.println(distance);
    }
} Main
import java.util.Scanner;
import java.lang.Math;

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        int hour = sc.nextInt();
        int minute = sc.nextInt();

        int time = hour * 60 + minute;

        double[] aPosition = new double[2];
        double[] bPosition = new double[2];

        double shortRad = 2.0 * Math.PI * (double)time / (60.0 * 12.0);
        double longRad = 2.0 * Math.PI * (double)time / 60.0;


        aPosition[0] = A * Math.sin(shortRad);
        aPosition[1] = A * Math.cos(shortRad);

        bPosition[0] = B * Math.sin(longRad);
        bPosition[1] = B * Math.cos(longRad);

        double distance;
        distance = Math.sqrt((aPosition[0] - bPosition[0])*(aPosition[0] - bPosition[0]) + (aPosition[1] - bPosition[1])*(aPosition[1] - bPosition[1]));
        System.out.println(distance);
    }
}