import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
      Double A = in.nextDouble();  
      Double B = in.nextDouble();  
      Double H = in.nextDouble();  
      double M = in.nextDouble();  
      double x = Math.abs(30*H+M/2-6*M);
      double X = Math.cos(Math.toRadians(x));
      double C = Math.sqrt(A*A+B*B-2*A*B*X);
      System.out.println(C);
        }
    } import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
      Double A = in.nextDouble();  
      Double B = in.nextDouble();  
      Double H = in.nextDouble();  
      double M = in.nextDouble();  
      double x = Math.abs(30*H+M/2-6*M);
      double X = Math.cos(Math.toRadians(x));
      double C = Math.sqrt(A*A+B*B-2*A*B*X);
      System.out.println(C);
        }
    } Main public static void main(String[] args){
        Scanner in = new Scanner(System.in);
      Double A = in.nextDouble();  
      Double B = in.nextDouble();  
      Double H = in.nextDouble();  
      double M = in.nextDouble();  
      double x = Math.abs(30*H+M/2-6*M);
      double X = Math.cos(Math.toRadians(x));
      double C = Math.sqrt(A*A+B*B-2*A*B*X);
      System.out.println(C);
        } main {
        Scanner in = new Scanner(System.in);
      Double A = in.nextDouble();  
      Double B = in.nextDouble();  
      Double H = in.nextDouble();  
      double M = in.nextDouble();  
      double x = Math.abs(30*H+M/2-6*M);
      double X = Math.cos(Math.toRadians(x));
      double C = Math.sqrt(A*A+B*B-2*A*B*X);
      System.out.println(C);
        } Scanner in = new Scanner(System.in); in new Scanner(System.in) Double A = in.nextDouble(); A in.nextDouble() in.nextDouble in Double B = in.nextDouble(); B in.nextDouble() in.nextDouble in Double H = in.nextDouble(); H in.nextDouble() in.nextDouble in double M = in.nextDouble(); M in.nextDouble() in.nextDouble in double x = Math.abs(30*H+M/2-6*M); x Math.abs(30*H+M/2-6*M) Math.abs Math 30*H+M/2-6*M 30*H+M/2 30*H 30 H M/2 M 2 6*M 6 M double X = Math.cos(Math.toRadians(x)); X Math.cos(Math.toRadians(x)) Math.cos Math Math.toRadians(x) Math.toRadians Math x double C = Math.sqrt(A*A+B*B-2*A*B*X); C Math.sqrt(A*A+B*B-2*A*B*X) Math.sqrt Math A*A+B*B-2*A*B*X A*A+B*B A*A A A B*B B B 2*A*B*X B 2*A*B*X 2 A B X 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){
        Scanner in = new Scanner(System.in);
      Double A = in.nextDouble();  
      Double B = in.nextDouble();  
      Double H = in.nextDouble();  
      double M = in.nextDouble();  
      double x = Math.abs(30*H+M/2-6*M);
      double X = Math.cos(Math.toRadians(x));
      double C = Math.sqrt(A*A+B*B-2*A*B*X);
      System.out.println(C);
        }
    } public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
      Double A = in.nextDouble();  
      Double B = in.nextDouble();  
      Double H = in.nextDouble();  
      double M = in.nextDouble();  
      double x = Math.abs(30*H+M/2-6*M);
      double X = Math.cos(Math.toRadians(x));
      double C = Math.sqrt(A*A+B*B-2*A*B*X);
      System.out.println(C);
        }
    } Main
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
      Double A = in.nextDouble();  
      Double B = in.nextDouble();  
      Double H = in.nextDouble();  
      double M = in.nextDouble();  
      double x = Math.abs(30*H+M/2-6*M);
      double X = Math.cos(Math.toRadians(x));
      double C = Math.sqrt(A*A+B*B-2*A*B*X);
      System.out.println(C);
        }
    }
