import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    int A=in.nextInt();
    int B=in.nextInt();
    int H=in.nextInt();
    int M=in.nextInt();
    
    double t=(2*3.141592654*H)/12+(2*3.141592654*M)/(12*60);
    
    double t1=(2*3.141592654*M)/60;
    
    double p=Math.abs(t-t1);
    double y=Math.cos(p);
    double k=((y*2*A*B)-(A*A)-(B*B))*-1;
    double h=Math.sqrt(k);
    System.out.println(h);
  }
}
  


    
    
     import java.util.*; util.* java class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    int A=in.nextInt();
    int B=in.nextInt();
    int H=in.nextInt();
    int M=in.nextInt();
    
    double t=(2*3.141592654*H)/12+(2*3.141592654*M)/(12*60);
    
    double t1=(2*3.141592654*M)/60;
    
    double p=Math.abs(t-t1);
    double y=Math.cos(p);
    double k=((y*2*A*B)-(A*A)-(B*B))*-1;
    double h=Math.sqrt(k);
    System.out.println(h);
  }
} Main public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    int A=in.nextInt();
    int B=in.nextInt();
    int H=in.nextInt();
    int M=in.nextInt();
    
    double t=(2*3.141592654*H)/12+(2*3.141592654*M)/(12*60);
    
    double t1=(2*3.141592654*M)/60;
    
    double p=Math.abs(t-t1);
    double y=Math.cos(p);
    double k=((y*2*A*B)-(A*A)-(B*B))*-1;
    double h=Math.sqrt(k);
    System.out.println(h);
  } main {
    Scanner in=new Scanner(System.in);
    int A=in.nextInt();
    int B=in.nextInt();
    int H=in.nextInt();
    int M=in.nextInt();
    
    double t=(2*3.141592654*H)/12+(2*3.141592654*M)/(12*60);
    
    double t1=(2*3.141592654*M)/60;
    
    double p=Math.abs(t-t1);
    double y=Math.cos(p);
    double k=((y*2*A*B)-(A*A)-(B*B))*-1;
    double h=Math.sqrt(k);
    System.out.println(h);
  } Scanner in=new Scanner(System.in); in new Scanner(System.in) int A=in.nextInt(); A in.nextInt() in.nextInt in int B=in.nextInt(); B in.nextInt() in.nextInt in int H=in.nextInt(); H in.nextInt() in.nextInt in int M=in.nextInt(); M in.nextInt() in.nextInt in double t=(2*3.141592654*H)/12+(2*3.141592654*M)/(12*60); t (2*3.141592654*H)/12+(2*3.141592654*M)/(12*60) (2*3.141592654*H)/12 (2*3.141592654*H) 2*3.141592654*H 2 3.141592654 H 12 (2*3.141592654*M)/(12*60) (2*3.141592654*M) 2*3.141592654*M 2 3.141592654 M (12*60) 12 60 double t1=(2*3.141592654*M)/60; t1 (2*3.141592654*M)/60 (2*3.141592654*M) 2*3.141592654*M 2 3.141592654 M 60 double p=Math.abs(t-t1); p Math.abs(t-t1) Math.abs Math t-t1 t t1 double y=Math.cos(p); y Math.cos(p) Math.cos Math p double k=((y*2*A*B)-(A*A)-(B*B))*-1; k ((y*2*A*B)-(A*A)-(B*B))*-1 ((y*2*A*B)-(A*A)-(B*B)) (y*2*A*B)-(A*A)-(B*B) (y*2*A*B) A y*2*A*B y 2 A B (A*A) A A (B*B) B B -1 1 double h=Math.sqrt(k); h Math.sqrt(k) Math.sqrt Math k System.out.println(h) System.out.println System.out System System.out h String args[] args
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    int A=in.nextInt();
    int B=in.nextInt();
    int H=in.nextInt();
    int M=in.nextInt();
    
    double t=(2*3.141592654*H)/12+(2*3.141592654*M)/(12*60);
    
    double t1=(2*3.141592654*M)/60;
    
    double p=Math.abs(t-t1);
    double y=Math.cos(p);
    double k=((y*2*A*B)-(A*A)-(B*B))*-1;
    double h=Math.sqrt(k);
    System.out.println(h);
  }
}
  


    
    
    
