import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double mrad = 6*M;
        double hrad = (30*H) + (0.5*M);
        double angle = Math.abs(mrad - hrad);
        double C = Math.sqrt(Math.pow(A,2) + Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(angle)));
        System.out.println(C);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double mrad = 6*M;
        double hrad = (30*H) + (0.5*M);
        double angle = Math.abs(mrad - hrad);
        double C = Math.sqrt(Math.pow(A,2) + Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(angle)));
        System.out.println(C);
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double mrad = 6*M;
        double hrad = (30*H) + (0.5*M);
        double angle = Math.abs(mrad - hrad);
        double C = Math.sqrt(Math.pow(A,2) + Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(angle)));
        System.out.println(C);
    } main {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double mrad = 6*M;
        double hrad = (30*H) + (0.5*M);
        double angle = Math.abs(mrad - hrad);
        double C = Math.sqrt(Math.pow(A,2) + Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(angle)));
        System.out.println(C);
    } 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 mrad = 6*M; mrad 6*M 6 M double hrad = (30*H) + (0.5*M); hrad (30*H) + (0.5*M) (30*H) 30 H (0.5*M) 0.5 M double angle = Math.abs(mrad - hrad); angle Math.abs(mrad - hrad) Math.abs Math mrad - hrad mrad hrad double C = Math.sqrt(Math.pow(A,2) + Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(angle))); C Math.sqrt(Math.pow(A,2) + Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(angle))) Math.sqrt Math Math.pow(A,2) + Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(angle)) Math.pow(A,2) + Math.pow(B,2) Math.pow(A,2) Math.pow Math A 2 Math.pow(B,2) Math.pow Math B 2 2*A*B*Math.cos(Math.toRadians(angle)) B 2*A*B*Math.cos(Math.toRadians(angle)) 2 A B Math.cos(Math.toRadians(angle)) Math.cos Math Math.toRadians(angle) Math.toRadians Math angle System.out.println(C) System.out.println System.out System System.out C String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double mrad = 6*M;
        double hrad = (30*H) + (0.5*M);
        double angle = Math.abs(mrad - hrad);
        double C = Math.sqrt(Math.pow(A,2) + Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(angle)));
        System.out.println(C);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double mrad = 6*M;
        double hrad = (30*H) + (0.5*M);
        double angle = Math.abs(mrad - hrad);
        double C = Math.sqrt(Math.pow(A,2) + Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(angle)));
        System.out.println(C);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        double mrad = 6*M;
        double hrad = (30*H) + (0.5*M);
        double angle = Math.abs(mrad - hrad);
        double C = Math.sqrt(Math.pow(A,2) + Math.pow(B,2) - 2*A*B*Math.cos(Math.toRadians(angle)));
        System.out.println(C);
    }
}
