import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        double hourLen = sc.nextDouble();
        double minLen = sc.nextDouble();
        double hour = sc.nextDouble();
        double min = sc.nextDouble();

        double hRad = 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0);
        double mRad = 2 * Math.PI * min / 60.0;

        double theta = hRad - mRad;

        double ans = Math.pow(hourLen, 2) + Math.pow(minLen, 2) - 2.0 * hourLen * minLen * Math.cos(theta);

        System.out.println(Math.sqrt(ans));

    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        double hourLen = sc.nextDouble();
        double minLen = sc.nextDouble();
        double hour = sc.nextDouble();
        double min = sc.nextDouble();

        double hRad = 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0);
        double mRad = 2 * Math.PI * min / 60.0;

        double theta = hRad - mRad;

        double ans = Math.pow(hourLen, 2) + Math.pow(minLen, 2) - 2.0 * hourLen * minLen * Math.cos(theta);

        System.out.println(Math.sqrt(ans));

    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        double hourLen = sc.nextDouble();
        double minLen = sc.nextDouble();
        double hour = sc.nextDouble();
        double min = sc.nextDouble();

        double hRad = 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0);
        double mRad = 2 * Math.PI * min / 60.0;

        double theta = hRad - mRad;

        double ans = Math.pow(hourLen, 2) + Math.pow(minLen, 2) - 2.0 * hourLen * minLen * Math.cos(theta);

        System.out.println(Math.sqrt(ans));

    } main {

        Scanner sc = new Scanner(System.in);

        double hourLen = sc.nextDouble();
        double minLen = sc.nextDouble();
        double hour = sc.nextDouble();
        double min = sc.nextDouble();

        double hRad = 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0);
        double mRad = 2 * Math.PI * min / 60.0;

        double theta = hRad - mRad;

        double ans = Math.pow(hourLen, 2) + Math.pow(minLen, 2) - 2.0 * hourLen * minLen * Math.cos(theta);

        System.out.println(Math.sqrt(ans));

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double hourLen = sc.nextDouble(); hourLen sc.nextDouble() sc.nextDouble sc double minLen = sc.nextDouble(); minLen sc.nextDouble() sc.nextDouble sc double hour = sc.nextDouble(); hour sc.nextDouble() sc.nextDouble sc double min = sc.nextDouble(); min sc.nextDouble() sc.nextDouble sc double hRad = 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0); hRad 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0) 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0) 2 Math.PI Math Math.PI (hour / 12.0 + min / 60.0 / 12.0) hour / 12.0 hour 12.0 min / 60.0 / 12.0 min / 60.0 / 12.0 min 60.0 12.0 double mRad = 2 * Math.PI * min / 60.0; mRad 2 * Math.PI * min / 60.0 2 * Math.PI * min 2 * Math.PI * min 2 Math.PI Math Math.PI min 60.0 double theta = hRad - mRad; theta hRad - mRad hRad mRad double ans = Math.pow(hourLen, 2) + Math.pow(minLen, 2) - 2.0 * hourLen * minLen * Math.cos(theta); ans Math.pow(hourLen, 2) + Math.pow(minLen, 2) - 2.0 * hourLen * minLen * Math.cos(theta) Math.pow(hourLen, 2) + Math.pow(minLen, 2) Math.pow(hourLen, 2) Math.pow Math hourLen 2 Math.pow(minLen, 2) Math.pow Math minLen 2 2.0 * hourLen * minLen * Math.cos(theta) minLen 2.0 * hourLen * minLen * Math.cos(theta) 2.0 hourLen minLen Math.cos(theta) Math.cos Math theta System.out.println(Math.sqrt(ans)) System.out.println System.out System System.out Math.sqrt(ans) Math.sqrt Math ans String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        double hourLen = sc.nextDouble();
        double minLen = sc.nextDouble();
        double hour = sc.nextDouble();
        double min = sc.nextDouble();

        double hRad = 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0);
        double mRad = 2 * Math.PI * min / 60.0;

        double theta = hRad - mRad;

        double ans = Math.pow(hourLen, 2) + Math.pow(minLen, 2) - 2.0 * hourLen * minLen * Math.cos(theta);

        System.out.println(Math.sqrt(ans));

    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        double hourLen = sc.nextDouble();
        double minLen = sc.nextDouble();
        double hour = sc.nextDouble();
        double min = sc.nextDouble();

        double hRad = 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0);
        double mRad = 2 * Math.PI * min / 60.0;

        double theta = hRad - mRad;

        double ans = Math.pow(hourLen, 2) + Math.pow(minLen, 2) - 2.0 * hourLen * minLen * Math.cos(theta);

        System.out.println(Math.sqrt(ans));

    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        double hourLen = sc.nextDouble();
        double minLen = sc.nextDouble();
        double hour = sc.nextDouble();
        double min = sc.nextDouble();

        double hRad = 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0);
        double mRad = 2 * Math.PI * min / 60.0;

        double theta = hRad - mRad;

        double ans = Math.pow(hourLen, 2) + Math.pow(minLen, 2) - 2.0 * hourLen * minLen * Math.cos(theta);

        System.out.println(Math.sqrt(ans));

    }
}
