import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextDouble();
        double m = sc.nextDouble();
        double x = (m*11/360 - h/6) * Math.PI;
		System.out.println(Math.pow(a*a+b*b-2*a*b*Math.cos(x), 0.5));
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextDouble();
        double m = sc.nextDouble();
        double x = (m*11/360 - h/6) * Math.PI;
		System.out.println(Math.pow(a*a+b*b-2*a*b*Math.cos(x), 0.5));
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextDouble();
        double m = sc.nextDouble();
        double x = (m*11/360 - h/6) * Math.PI;
		System.out.println(Math.pow(a*a+b*b-2*a*b*Math.cos(x), 0.5));
    } main {
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextDouble();
        double m = sc.nextDouble();
        double x = (m*11/360 - h/6) * Math.PI;
		System.out.println(Math.pow(a*a+b*b-2*a*b*Math.cos(x), 0.5));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double a = sc.nextDouble(); a sc.nextDouble() sc.nextDouble sc double b = sc.nextDouble(); b sc.nextDouble() sc.nextDouble sc double h = sc.nextDouble(); h sc.nextDouble() sc.nextDouble sc double m = sc.nextDouble(); m sc.nextDouble() sc.nextDouble sc double x = (m*11/360 - h/6) * Math.PI; x (m*11/360 - h/6) * Math.PI (m*11/360 - h/6) m*11/360 m*11 m 11 360 h/6 h 6 Math.PI Math Math.PI System.out.println(Math.pow(a*a+b*b-2*a*b*Math.cos(x), 0.5)) System.out.println System.out System System.out Math.pow(a*a+b*b-2*a*b*Math.cos(x), 0.5) Math.pow Math a*a+b*b-2*a*b*Math.cos(x) a*a+b*b a*a a a b*b b b 2*a*b*Math.cos(x) b 2*a*b*Math.cos(x) 2 a b Math.cos(x) Math.cos Math x 0.5 String[] args args
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextDouble();
        double m = sc.nextDouble();
        double x = (m*11/360 - h/6) * Math.PI;
		System.out.println(Math.pow(a*a+b*b-2*a*b*Math.cos(x), 0.5));
    }
}