
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public  static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(in.readLine()," ");
        int a=Integer.parseInt(st.nextToken());
        int b=Integer.parseInt(st.nextToken());
        int h=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        double angle=Math.abs((m*6)-(h*30+m*0.5));
        double rad=Math.toRadians(angle);
        double ans=2*a*b*Math.cos(rad);
        ans=a*a+b*b-ans;
        ans=Math.sqrt(ans);
        System.out.println(ans);
    }
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    public  static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(in.readLine()," ");
        int a=Integer.parseInt(st.nextToken());
        int b=Integer.parseInt(st.nextToken());
        int h=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        double angle=Math.abs((m*6)-(h*30+m*0.5));
        double rad=Math.toRadians(angle);
        double ans=2*a*b*Math.cos(rad);
        ans=a*a+b*b-ans;
        ans=Math.sqrt(ans);
        System.out.println(ans);
    }
} Main public  static void main(String args[]) throws IOException{
        process();
    } main {
        process();
    } process() process String args[] args public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(in.readLine()," ");
        int a=Integer.parseInt(st.nextToken());
        int b=Integer.parseInt(st.nextToken());
        int h=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        double angle=Math.abs((m*6)-(h*30+m*0.5));
        double rad=Math.toRadians(angle);
        double ans=2*a*b*Math.cos(rad);
        ans=a*a+b*b-ans;
        ans=Math.sqrt(ans);
        System.out.println(ans);
    } process {
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(in.readLine()," ");
        int a=Integer.parseInt(st.nextToken());
        int b=Integer.parseInt(st.nextToken());
        int h=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        double angle=Math.abs((m*6)-(h*30+m*0.5));
        double rad=Math.toRadians(angle);
        double ans=2*a*b*Math.cos(rad);
        ans=a*a+b*b-ans;
        ans=Math.sqrt(ans);
        System.out.println(ans);
    } BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st=new StringTokenizer(in.readLine()," "); st new StringTokenizer(in.readLine()," ") int a=Integer.parseInt(st.nextToken()); a Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int b=Integer.parseInt(st.nextToken()); b Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int h=Integer.parseInt(st.nextToken()); h Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int m=Integer.parseInt(st.nextToken()); m Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st double angle=Math.abs((m*6)-(h*30+m*0.5)); angle Math.abs((m*6)-(h*30+m*0.5)) Math.abs Math (m*6)-(h*30+m*0.5) (m*6) m 6 (h*30+m*0.5) h*30 h 30 m*0.5 m 0.5 double rad=Math.toRadians(angle); rad Math.toRadians(angle) Math.toRadians Math angle double ans=2*a*b*Math.cos(rad); ans 2*a*b*Math.cos(rad) b 2*a*b*Math.cos(rad) 2 a b Math.cos(rad) Math.cos Math rad ans=a*a+b*b-ans ans a*a+b*b-ans a*a+b*b a*a a a b*b b b ans ans=Math.sqrt(ans) ans Math.sqrt(ans) Math.sqrt Math ans System.out.println(ans) System.out.println System.out System System.out ans public class Main {
    public  static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(in.readLine()," ");
        int a=Integer.parseInt(st.nextToken());
        int b=Integer.parseInt(st.nextToken());
        int h=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        double angle=Math.abs((m*6)-(h*30+m*0.5));
        double rad=Math.toRadians(angle);
        double ans=2*a*b*Math.cos(rad);
        ans=a*a+b*b-ans;
        ans=Math.sqrt(ans);
        System.out.println(ans);
    }
} public class Main {
    public  static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(in.readLine()," ");
        int a=Integer.parseInt(st.nextToken());
        int b=Integer.parseInt(st.nextToken());
        int h=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        double angle=Math.abs((m*6)-(h*30+m*0.5));
        double rad=Math.toRadians(angle);
        double ans=2*a*b*Math.cos(rad);
        ans=a*a+b*b-ans;
        ans=Math.sqrt(ans);
        System.out.println(ans);
    }
} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public  static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(in.readLine()," ");
        int a=Integer.parseInt(st.nextToken());
        int b=Integer.parseInt(st.nextToken());
        int h=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        double angle=Math.abs((m*6)-(h*30+m*0.5));
        double rad=Math.toRadians(angle);
        double ans=2*a*b*Math.cos(rad);
        ans=a*a+b*b-ans;
        ans=Math.sqrt(ans);
        System.out.println(ans);
    }
}

