import java.util.Scanner;
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 ang = Math.toRadians(Math.abs(angH - angM));
    double c = 0;
    c = Math.sqrt(a*a + b*b - 2*a*b*Math.cos(ang));
    System.out.print(c);
  }
} import java.util.Scanner; Scanner java.util 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 ang = Math.toRadians(Math.abs(angH - angM));
    double c = 0;
    c = Math.sqrt(a*a + b*b - 2*a*b*Math.cos(ang));
    System.out.print(c);
  }
} 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 ang = Math.toRadians(Math.abs(angH - angM));
    double c = 0;
    c = Math.sqrt(a*a + b*b - 2*a*b*Math.cos(ang));
    System.out.print(c);
  } 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 ang = Math.toRadians(Math.abs(angH - angM));
    double c = 0;
    c = Math.sqrt(a*a + b*b - 2*a*b*Math.cos(ang));
    System.out.print(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 angH = 30*h; angH 30*h 30 h double angM = 5.5*m; angM 5.5*m 5.5 m double ang = Math.toRadians(Math.abs(angH - angM)); ang Math.toRadians(Math.abs(angH - angM)) Math.toRadians Math Math.abs(angH - angM) Math.abs Math angH - angM angH angM double c = 0; c 0 c = Math.sqrt(a*a + b*b - 2*a*b*Math.cos(ang)) c Math.sqrt(a*a + b*b - 2*a*b*Math.cos(ang)) Math.sqrt Math a*a + b*b - 2*a*b*Math.cos(ang) a*a + b*b a*a a a b*b b b 2*a*b*Math.cos(ang) b 2*a*b*Math.cos(ang) 2 a b Math.cos(ang) Math.cos Math ang System.out.print(c) System.out.print System.out System System.out c String[] args args
import java.util.Scanner;
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 ang = Math.toRadians(Math.abs(angH - angM));
    double c = 0;
    c = Math.sqrt(a*a + b*b - 2*a*b*Math.cos(ang));
    System.out.print(c);
  }
}
