import java.util.Scanner;

class Main {

      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int a_h = sc.nextInt();
            int b_m = sc.nextInt();
            int h = sc.nextInt();
            int m = sc.nextInt();
            
            
            double dh = (h*60+m)*2*Math.PI/(12*60) ;
            double hx = a_h*Math.cos(dh) ;
            double hy = a_h*Math.sin(dh) ;
            
            double dm = m*2*Math.PI/60 ;
            double mx = b_m*Math.cos(dm) ;
            double my = b_m*Math.sin(dm) ;
            
            double dx = mx-hx ;
            double dy = my-hy ;

            double result = Math.sqrt( dx*dx+dy*dy) ;
            System.out.println(result);
      }

} import java.util.Scanner; Scanner java.util class Main {

      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int a_h = sc.nextInt();
            int b_m = sc.nextInt();
            int h = sc.nextInt();
            int m = sc.nextInt();
            
            
            double dh = (h*60+m)*2*Math.PI/(12*60) ;
            double hx = a_h*Math.cos(dh) ;
            double hy = a_h*Math.sin(dh) ;
            
            double dm = m*2*Math.PI/60 ;
            double mx = b_m*Math.cos(dm) ;
            double my = b_m*Math.sin(dm) ;
            
            double dx = mx-hx ;
            double dy = my-hy ;

            double result = Math.sqrt( dx*dx+dy*dy) ;
            System.out.println(result);
      }

} Main public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int a_h = sc.nextInt();
            int b_m = sc.nextInt();
            int h = sc.nextInt();
            int m = sc.nextInt();
            
            
            double dh = (h*60+m)*2*Math.PI/(12*60) ;
            double hx = a_h*Math.cos(dh) ;
            double hy = a_h*Math.sin(dh) ;
            
            double dm = m*2*Math.PI/60 ;
            double mx = b_m*Math.cos(dm) ;
            double my = b_m*Math.sin(dm) ;
            
            double dx = mx-hx ;
            double dy = my-hy ;

            double result = Math.sqrt( dx*dx+dy*dy) ;
            System.out.println(result);
      } main {
            Scanner sc = new Scanner(System.in);
            int a_h = sc.nextInt();
            int b_m = sc.nextInt();
            int h = sc.nextInt();
            int m = sc.nextInt();
            
            
            double dh = (h*60+m)*2*Math.PI/(12*60) ;
            double hx = a_h*Math.cos(dh) ;
            double hy = a_h*Math.sin(dh) ;
            
            double dm = m*2*Math.PI/60 ;
            double mx = b_m*Math.cos(dm) ;
            double my = b_m*Math.sin(dm) ;
            
            double dx = mx-hx ;
            double dy = my-hy ;

            double result = Math.sqrt( dx*dx+dy*dy) ;
            System.out.println(result);
      } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a_h = sc.nextInt(); a_h sc.nextInt() sc.nextInt sc int b_m = sc.nextInt(); b_m 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 dh = (h*60+m)*2*Math.PI/(12*60) ; dh (h*60+m)*2*Math.PI/(12*60) (h*60+m)*2*Math.PI (h*60+m)*2*Math.PI (h*60+m) h*60 h 60 m 2 Math.PI Math Math.PI (12*60) 12 60 double hx = a_h*Math.cos(dh) ; hx a_h*Math.cos(dh) a_h Math.cos(dh) Math.cos Math dh double hy = a_h*Math.sin(dh) ; hy a_h*Math.sin(dh) a_h Math.sin(dh) Math.sin Math dh double dm = m*2*Math.PI/60 ; dm m*2*Math.PI/60 m*2*Math.PI m*2*Math.PI m 2 Math.PI Math Math.PI 60 double mx = b_m*Math.cos(dm) ; mx b_m*Math.cos(dm) b_m Math.cos(dm) Math.cos Math dm double my = b_m*Math.sin(dm) ; my b_m*Math.sin(dm) b_m Math.sin(dm) Math.sin Math dm double dx = mx-hx ; dx mx-hx mx hx double dy = my-hy ; dy my-hy my hy double result = Math.sqrt( dx*dx+dy*dy) ; result Math.sqrt( dx*dx+dy*dy) Math.sqrt Math dx*dx+dy*dy dx*dx dx dx dy*dy dy dy System.out.println(result) System.out.println System.out System System.out result String[] args args
import java.util.Scanner;

class Main {

      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int a_h = sc.nextInt();
            int b_m = sc.nextInt();
            int h = sc.nextInt();
            int m = sc.nextInt();
            
            
            double dh = (h*60+m)*2*Math.PI/(12*60) ;
            double hx = a_h*Math.cos(dh) ;
            double hy = a_h*Math.sin(dh) ;
            
            double dm = m*2*Math.PI/60 ;
            double mx = b_m*Math.cos(dm) ;
            double my = b_m*Math.sin(dm) ;
            
            double dx = mx-hx ;
            double dy = my-hy ;

            double result = Math.sqrt( dx*dx+dy*dy) ;
            System.out.println(result);
      }

}