import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //String str = sc.next();
        double A = sc.nextDouble();
        double B = sc.nextDouble();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        
        double hx = A*Math.sin(Math.toRadians(H*30+M*0.5));
        double hy = A*Math.cos(Math.toRadians(H*30+M*0.5));
        double mx = B*Math.sin(Math.toRadians(M*6));
        double my = B*Math.cos(Math.toRadians(M*6));
        
        //System.out.println(hx);
        //System.out.println(hy);
        //System.out.println(mx);
        //System.out.println(my);
        
        double dist = Math.sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
        System.out.println(dist);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //String str = sc.next();
        double A = sc.nextDouble();
        double B = sc.nextDouble();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        
        double hx = A*Math.sin(Math.toRadians(H*30+M*0.5));
        double hy = A*Math.cos(Math.toRadians(H*30+M*0.5));
        double mx = B*Math.sin(Math.toRadians(M*6));
        double my = B*Math.cos(Math.toRadians(M*6));
        
        //System.out.println(hx);
        //System.out.println(hy);
        //System.out.println(mx);
        //System.out.println(my);
        
        double dist = Math.sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
        System.out.println(dist);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //String str = sc.next();
        double A = sc.nextDouble();
        double B = sc.nextDouble();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        
        double hx = A*Math.sin(Math.toRadians(H*30+M*0.5));
        double hy = A*Math.cos(Math.toRadians(H*30+M*0.5));
        double mx = B*Math.sin(Math.toRadians(M*6));
        double my = B*Math.cos(Math.toRadians(M*6));
        
        //System.out.println(hx);
        //System.out.println(hy);
        //System.out.println(mx);
        //System.out.println(my);
        
        double dist = Math.sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
        System.out.println(dist);
    } main {
        Scanner sc = new Scanner(System.in);
        //String str = sc.next();
        double A = sc.nextDouble();
        double B = sc.nextDouble();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        
        double hx = A*Math.sin(Math.toRadians(H*30+M*0.5));
        double hy = A*Math.cos(Math.toRadians(H*30+M*0.5));
        double mx = B*Math.sin(Math.toRadians(M*6));
        double my = B*Math.cos(Math.toRadians(M*6));
        
        //System.out.println(hx);
        //System.out.println(hy);
        //System.out.println(mx);
        //System.out.println(my);
        
        double dist = Math.sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
        System.out.println(dist);
    } 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 hx = A*Math.sin(Math.toRadians(H*30+M*0.5)); hx A*Math.sin(Math.toRadians(H*30+M*0.5)) A Math.sin(Math.toRadians(H*30+M*0.5)) Math.sin Math Math.toRadians(H*30+M*0.5) Math.toRadians Math H*30+M*0.5 H*30 H 30 M*0.5 M 0.5 double hy = A*Math.cos(Math.toRadians(H*30+M*0.5)); hy A*Math.cos(Math.toRadians(H*30+M*0.5)) A Math.cos(Math.toRadians(H*30+M*0.5)) Math.cos Math Math.toRadians(H*30+M*0.5) Math.toRadians Math H*30+M*0.5 H*30 H 30 M*0.5 M 0.5 double mx = B*Math.sin(Math.toRadians(M*6)); mx B*Math.sin(Math.toRadians(M*6)) B Math.sin(Math.toRadians(M*6)) Math.sin Math Math.toRadians(M*6) Math.toRadians Math M*6 M 6 double my = B*Math.cos(Math.toRadians(M*6)); my B*Math.cos(Math.toRadians(M*6)) B Math.cos(Math.toRadians(M*6)) Math.cos Math Math.toRadians(M*6) Math.toRadians Math M*6 M 6 double dist = Math.sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my)); dist Math.sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my)) Math.sqrt Math (hx-mx)*(hx-mx)+(hy-my)*(hy-my) (hx-mx)*(hx-mx) (hx-mx) hx mx (hx-mx) hx mx (hy-my)*(hy-my) (hy-my) hy my (hy-my) hy my System.out.println(dist) System.out.println System.out System System.out dist String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //String str = sc.next();
        double A = sc.nextDouble();
        double B = sc.nextDouble();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        
        double hx = A*Math.sin(Math.toRadians(H*30+M*0.5));
        double hy = A*Math.cos(Math.toRadians(H*30+M*0.5));
        double mx = B*Math.sin(Math.toRadians(M*6));
        double my = B*Math.cos(Math.toRadians(M*6));
        
        //System.out.println(hx);
        //System.out.println(hy);
        //System.out.println(mx);
        //System.out.println(my);
        
        double dist = Math.sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
        System.out.println(dist);
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //String str = sc.next();
        double A = sc.nextDouble();
        double B = sc.nextDouble();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        
        double hx = A*Math.sin(Math.toRadians(H*30+M*0.5));
        double hy = A*Math.cos(Math.toRadians(H*30+M*0.5));
        double mx = B*Math.sin(Math.toRadians(M*6));
        double my = B*Math.cos(Math.toRadians(M*6));
        
        //System.out.println(hx);
        //System.out.println(hy);
        //System.out.println(mx);
        //System.out.println(my);
        
        double dist = Math.sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
        System.out.println(dist);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //String str = sc.next();
        double A = sc.nextDouble();
        double B = sc.nextDouble();
        double H = sc.nextDouble();
        double M = sc.nextDouble();
        
        double hx = A*Math.sin(Math.toRadians(H*30+M*0.5));
        double hy = A*Math.cos(Math.toRadians(H*30+M*0.5));
        double mx = B*Math.sin(Math.toRadians(M*6));
        double my = B*Math.cos(Math.toRadians(M*6));
        
        //System.out.println(hx);
        //System.out.println(hy);
        //System.out.println(mx);
        //System.out.println(my);
        
        double dist = Math.sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
        System.out.println(dist);
    }
}
