import 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();
        double angH = 30 * H;
        double angM =  5.5 * M;
        double red = Math.toRadians(Math.abs(angH-angM));
        double res = 0;
        res = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(red));
        System.out.println(res);
    }
} import java.util.*; util.* java 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();
        double angH = 30 * H;
        double angM =  5.5 * M;
        double red = Math.toRadians(Math.abs(angH-angM));
        double res = 0;
        res = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(red));
        System.out.println(res);
    }
} 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();
        double angH = 30 * H;
        double angM =  5.5 * M;
        double red = Math.toRadians(Math.abs(angH-angM));
        double res = 0;
        res = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(red));
        System.out.println(res);
    } main {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double angH = 30 * H;
        double angM =  5.5 * M;
        double red = Math.toRadians(Math.abs(angH-angM));
        double res = 0;
        res = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(red));
        System.out.println(res);
    } 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 double angH = 30 * H; angH 30 * H 30 H double angM =  5.5 * M; angM 5.5 * M 5.5 M double red = Math.toRadians(Math.abs(angH-angM)); red Math.toRadians(Math.abs(angH-angM)) Math.toRadians Math Math.abs(angH-angM) Math.abs Math angH-angM angH angM double res = 0; res 0 res = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(red)) res Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(red)) Math.sqrt Math A * A + B * B - 2 * A * B * Math.cos(red) A * A + B * B A * A A A B * B B B 2 * A * B * Math.cos(red) B 2 * A * B * Math.cos(red) 2 A B Math.cos(red) Math.cos Math red System.out.println(res) System.out.println System.out System System.out res 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();
        double angH = 30 * H;
        double angM =  5.5 * M;
        double red = Math.toRadians(Math.abs(angH-angM));
        double res = 0;
        res = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(red));
        System.out.println(res);
    }
} 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();
        double angH = 30 * H;
        double angM =  5.5 * M;
        double red = Math.toRadians(Math.abs(angH-angM));
        double res = 0;
        res = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(red));
        System.out.println(res);
    }
} Main
import 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();
        double angH = 30 * H;
        double angM =  5.5 * M;
        double red = Math.toRadians(Math.abs(angH-angM));
        double res = 0;
        res = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(red));
        System.out.println(res);
    }
}