import java.util.*; 
import java.io.*;

public class Main{
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        int A = nextInt();
        int B = nextInt();
        int H = nextInt();
        int M = nextInt();
        
        double M_Angle = M * 360/60;
        double H_Angle = H * 360/12 + (double)M * 30/60;
        double M_Angle1 = M_Angle * Math.PI / 180;
        double H_Angle1 = H_Angle * Math.PI / 180;

        double xM = B * Math.sin(M_Angle1);
        double yM = B * Math.cos(M_Angle1);
        double xH = A * Math.sin(H_Angle1);
        double yH = A * Math.cos(H_Angle1);

        double ans = Math.sqrt((xM-xH)*(xM-xH) + (yM-yH)*(yM-yH));
       
        System.out.println(ans);
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        int A = nextInt();
        int B = nextInt();
        int H = nextInt();
        int M = nextInt();
        
        double M_Angle = M * 360/60;
        double H_Angle = H * 360/12 + (double)M * 30/60;
        double M_Angle1 = M_Angle * Math.PI / 180;
        double H_Angle1 = H_Angle * Math.PI / 180;

        double xM = B * Math.sin(M_Angle1);
        double yM = B * Math.cos(M_Angle1);
        double xH = A * Math.sin(H_Angle1);
        double yH = A * Math.cos(H_Angle1);

        double ans = Math.sqrt((xM-xH)*(xM-xH) + (yM-yH)*(yM-yH));
       
        System.out.println(ans);
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
} Main static StringTokenizer st; st static BufferedReader br; br static PrintWriter out; out public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        int A = nextInt();
        int B = nextInt();
        int H = nextInt();
        int M = nextInt();
        
        double M_Angle = M * 360/60;
        double H_Angle = H * 360/12 + (double)M * 30/60;
        double M_Angle1 = M_Angle * Math.PI / 180;
        double H_Angle1 = H_Angle * Math.PI / 180;

        double xM = B * Math.sin(M_Angle1);
        double yM = B * Math.cos(M_Angle1);
        double xH = A * Math.sin(H_Angle1);
        double yH = A * Math.cos(H_Angle1);

        double ans = Math.sqrt((xM-xH)*(xM-xH) + (yM-yH)*(yM-yH));
       
        System.out.println(ans);
    } main {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        int A = nextInt();
        int B = nextInt();
        int H = nextInt();
        int M = nextInt();
        
        double M_Angle = M * 360/60;
        double H_Angle = H * 360/12 + (double)M * 30/60;
        double M_Angle1 = M_Angle * Math.PI / 180;
        double H_Angle1 = H_Angle * Math.PI / 180;

        double xM = B * Math.sin(M_Angle1);
        double yM = B * Math.cos(M_Angle1);
        double xH = A * Math.sin(H_Angle1);
        double yH = A * Math.cos(H_Angle1);

        double ans = Math.sqrt((xM-xH)*(xM-xH) + (yM-yH)*(yM-yH));
       
        System.out.println(ans);
    } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) int A = nextInt(); A nextInt() nextInt int B = nextInt(); B nextInt() nextInt int H = nextInt(); H nextInt() nextInt int M = nextInt(); M nextInt() nextInt double M_Angle = M * 360/60; M_Angle M * 360/60 M * 360 M 360 60 double H_Angle = H * 360/12 + (double)M * 30/60; H_Angle H * 360/12 + (double)M * 30/60 H * 360/12 H * 360 H 360 12 (double)M * 30/60 (double)M * 30 (double)M 30 60 double M_Angle1 = M_Angle * Math.PI / 180; M_Angle1 M_Angle * Math.PI / 180 M_Angle * Math.PI M_Angle Math.PI Math Math.PI 180 double H_Angle1 = H_Angle * Math.PI / 180; H_Angle1 H_Angle * Math.PI / 180 H_Angle * Math.PI H_Angle Math.PI Math Math.PI 180 double xM = B * Math.sin(M_Angle1); xM B * Math.sin(M_Angle1) B Math.sin(M_Angle1) Math.sin Math M_Angle1 double yM = B * Math.cos(M_Angle1); yM B * Math.cos(M_Angle1) B Math.cos(M_Angle1) Math.cos Math M_Angle1 double xH = A * Math.sin(H_Angle1); xH A * Math.sin(H_Angle1) A Math.sin(H_Angle1) Math.sin Math H_Angle1 double yH = A * Math.cos(H_Angle1); yH A * Math.cos(H_Angle1) A Math.cos(H_Angle1) Math.cos Math H_Angle1 double ans = Math.sqrt((xM-xH)*(xM-xH) + (yM-yH)*(yM-yH)); ans Math.sqrt((xM-xH)*(xM-xH) + (yM-yH)*(yM-yH)) Math.sqrt Math (xM-xH)*(xM-xH) + (yM-yH)*(yM-yH) (xM-xH)*(xM-xH) (xM-xH) xM xH (xM-xH) xM xH (yM-yH)*(yM-yH) (yM-yH) yM yH (yM-yH) yM yH System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    } nextInt {
        return Integer.parseInt(next());
    } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public static long nextLong() throws IOException {
        return Long.parseLong(next());
    } nextLong {
        return Long.parseLong(next());
    } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    } nextDouble {
        return Double.parseDouble(next());
    } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    } next {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    } while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim()); st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(br.readLine().trim()) st new StringTokenizer(br.readLine().trim()) return st.nextToken(); st.nextToken() st.nextToken st public class Main{
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        int A = nextInt();
        int B = nextInt();
        int H = nextInt();
        int M = nextInt();
        
        double M_Angle = M * 360/60;
        double H_Angle = H * 360/12 + (double)M * 30/60;
        double M_Angle1 = M_Angle * Math.PI / 180;
        double H_Angle1 = H_Angle * Math.PI / 180;

        double xM = B * Math.sin(M_Angle1);
        double yM = B * Math.cos(M_Angle1);
        double xH = A * Math.sin(H_Angle1);
        double yH = A * Math.cos(H_Angle1);

        double ans = Math.sqrt((xM-xH)*(xM-xH) + (yM-yH)*(yM-yH));
       
        System.out.println(ans);
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
} public class Main{
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        int A = nextInt();
        int B = nextInt();
        int H = nextInt();
        int M = nextInt();
        
        double M_Angle = M * 360/60;
        double H_Angle = H * 360/12 + (double)M * 30/60;
        double M_Angle1 = M_Angle * Math.PI / 180;
        double H_Angle1 = H_Angle * Math.PI / 180;

        double xM = B * Math.sin(M_Angle1);
        double yM = B * Math.cos(M_Angle1);
        double xH = A * Math.sin(H_Angle1);
        double yH = A * Math.cos(H_Angle1);

        double ans = Math.sqrt((xM-xH)*(xM-xH) + (yM-yH)*(yM-yH));
       
        System.out.println(ans);
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
} Main
import java.util.*; 
import java.io.*;

public class Main{
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
 
        int A = nextInt();
        int B = nextInt();
        int H = nextInt();
        int M = nextInt();
        
        double M_Angle = M * 360/60;
        double H_Angle = H * 360/12 + (double)M * 30/60;
        double M_Angle1 = M_Angle * Math.PI / 180;
        double H_Angle1 = H_Angle * Math.PI / 180;

        double xM = B * Math.sin(M_Angle1);
        double yM = B * Math.cos(M_Angle1);
        double xH = A * Math.sin(H_Angle1);
        double yH = A * Math.cos(H_Angle1);

        double ans = Math.sqrt((xM-xH)*(xM-xH) + (yM-yH)*(yM-yH));
       
        System.out.println(ans);
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}