

import java.math.*;
import java.io.*;
import java.util.*;
import java.lang.*;

//solution classes here

public class Main {

    //main solution here

    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    static long mod = (long)1e9+7;
    static long MOD = 998244353;
    static long INF = (long)1e18;
    static int inf = (int)1e9;
    //static ArrayList<Integer> list[] = new ArrayList[(int)3e3+1];
    //static int color[] = new int[(int)2e6+1];
    //static int visit[] = new int[(int)1e4+1];
    //static int level[] = new int[(int)1e4+1];
    //static Deque<Integer> q = new ArrayDeque<>();

    public static void main(String[] args) throws IOException {
        double a,b,h,m;
        a = sc.nextDouble();
        b = sc.nextDouble();
        h = sc.nextDouble();
        m = sc.nextDouble();
        h= h + m/60;
        double y = 2 * a * b * Math.cos((Math.PI*Math.abs(h*30-m*6))/180);
        double ans = a*a+b*b-y;
        out.println(Math.sqrt(ans));

        out.flush();
        out.close();
    }

    //solution functions here

    //---templates---
    public static boolean ispal(char[] c) {
        int n = c.length;
        for(int i=0;i<n/2;i++) {
            if(c[i]!=c[n-i-1])
                return false;
        }
        return true;
    }

    static long pow(long base, long exp)
    {
        long t = 1L;
        while (exp > 0) {
            if (exp % 2 != 0)
                t = (t * base) % mod;

            base = (base * base) % mod;
            exp /= 2;
        }
        return t % mod;
    }
    public static void reverse (long[] array) {
        int len = array.length;
        for(int i=0;i<len/2;i++) {
            array[i]^=array[len-1-i];
            array[len-i-1]^=array[i];
            array[i]^=array[len-i-1];
        }
    }

    public static int low_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]<=value) {
                lo=mid+1;
                ans=mid;
            }
            else
                hi=mid-1;
        }
        return ans;
    }

    public static int up_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]>=value) {
                hi=mid-1;
                ans=mid;
            }
            else
                lo=mid+1;
        }
        return ans;
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }

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

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}

/* *****************************************************************************************************************************
 * I'M NOT IN DANGER, I'M THE DANGER!!!
 * *****************************************************************************************************************************
 */ import java.math.*; math.* java import java.io.*; io.* java import java.util.*; util.* java import java.lang.*; lang.* java public class Main {

    //main solution here

    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    static long mod = (long)1e9+7;
    static long MOD = 998244353;
    static long INF = (long)1e18;
    static int inf = (int)1e9;
    //static ArrayList<Integer> list[] = new ArrayList[(int)3e3+1];
    //static int color[] = new int[(int)2e6+1];
    //static int visit[] = new int[(int)1e4+1];
    //static int level[] = new int[(int)1e4+1];
    //static Deque<Integer> q = new ArrayDeque<>();

    public static void main(String[] args) throws IOException {
        double a,b,h,m;
        a = sc.nextDouble();
        b = sc.nextDouble();
        h = sc.nextDouble();
        m = sc.nextDouble();
        h= h + m/60;
        double y = 2 * a * b * Math.cos((Math.PI*Math.abs(h*30-m*6))/180);
        double ans = a*a+b*b-y;
        out.println(Math.sqrt(ans));

        out.flush();
        out.close();
    }

    //solution functions here

    //---templates---
    public static boolean ispal(char[] c) {
        int n = c.length;
        for(int i=0;i<n/2;i++) {
            if(c[i]!=c[n-i-1])
                return false;
        }
        return true;
    }

    static long pow(long base, long exp)
    {
        long t = 1L;
        while (exp > 0) {
            if (exp % 2 != 0)
                t = (t * base) % mod;

            base = (base * base) % mod;
            exp /= 2;
        }
        return t % mod;
    }
    public static void reverse (long[] array) {
        int len = array.length;
        for(int i=0;i<len/2;i++) {
            array[i]^=array[len-1-i];
            array[len-i-1]^=array[i];
            array[i]^=array[len-i-1];
        }
    }

    public static int low_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]<=value) {
                lo=mid+1;
                ans=mid;
            }
            else
                hi=mid-1;
        }
        return ans;
    }

    public static int up_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]>=value) {
                hi=mid-1;
                ans=mid;
            }
            else
                lo=mid+1;
        }
        return ans;
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }

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

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) static long mod = (long)1e9+7; mod (long)1e9+7 (long)1e9 7 static long MOD = 998244353; MOD 998244353 static long INF = (long)1e18; INF (long)1e18 static int inf = (int)1e9; inf (int)1e9 public static void main(String[] args) throws IOException {
        double a,b,h,m;
        a = sc.nextDouble();
        b = sc.nextDouble();
        h = sc.nextDouble();
        m = sc.nextDouble();
        h= h + m/60;
        double y = 2 * a * b * Math.cos((Math.PI*Math.abs(h*30-m*6))/180);
        double ans = a*a+b*b-y;
        out.println(Math.sqrt(ans));

        out.flush();
        out.close();
    } main {
        double a,b,h,m;
        a = sc.nextDouble();
        b = sc.nextDouble();
        h = sc.nextDouble();
        m = sc.nextDouble();
        h= h + m/60;
        double y = 2 * a * b * Math.cos((Math.PI*Math.abs(h*30-m*6))/180);
        double ans = a*a+b*b-y;
        out.println(Math.sqrt(ans));

        out.flush();
        out.close();
    } double a a b b h h m; m a = sc.nextDouble() a sc.nextDouble() sc.nextDouble sc b = sc.nextDouble() b sc.nextDouble() sc.nextDouble sc h = sc.nextDouble() h sc.nextDouble() sc.nextDouble sc m = sc.nextDouble() m sc.nextDouble() sc.nextDouble sc h= h + m/60 h h + m/60 h m/60 m 60 double y = 2 * a * b * Math.cos((Math.PI*Math.abs(h*30-m*6))/180); y 2 * a * b * Math.cos((Math.PI*Math.abs(h*30-m*6))/180) b 2 * a * b * Math.cos((Math.PI*Math.abs(h*30-m*6))/180) 2 a b Math.cos((Math.PI*Math.abs(h*30-m*6))/180) Math.cos Math (Math.PI*Math.abs(h*30-m*6))/180 (Math.PI*Math.abs(h*30-m*6)) Math.PI Math Math.PI Math.abs(h*30-m*6) Math.abs Math h*30-m*6 h*30 h 30 m*6 m 6 180 double ans = a*a+b*b-y; ans a*a+b*b-y a*a+b*b a*a a a b*b b b y out.println(Math.sqrt(ans)) out.println out Math.sqrt(ans) Math.sqrt Math ans out.flush() out.flush out out.close() out.close out String[] args args //---templates---
    public static boolean ispal(char[] c) {
        int n = c.length;
        for(int i=0;i<n/2;i++) {
            if(c[i]!=c[n-i-1])
                return false;
        }
        return true;
    } ispal {
        int n = c.length;
        for(int i=0;i<n/2;i++) {
            if(c[i]!=c[n-i-1])
                return false;
        }
        return true;
    } int n = c.length; n c.length c c.length for(int i=0;i<n/2;i++) {
            if(c[i]!=c[n-i-1])
                return false;
        } int i=0; int i=0; i 0 i<n/2 i n/2 n 2 i++ i++ i {
            if(c[i]!=c[n-i-1])
                return false;
        } {
            if(c[i]!=c[n-i-1])
                return false;
        } if(c[i]!=c[n-i-1])
                return false; c[i]!=c[n-i-1] c[i] c i c[n-i-1] c n-i-1 n-i-1 n i 1 return false; false return true; true char[] c c static long pow(long base, long exp)
    {
        long t = 1L;
        while (exp > 0) {
            if (exp % 2 != 0)
                t = (t * base) % mod;

            base = (base * base) % mod;
            exp /= 2;
        }
        return t % mod;
    } pow {
        long t = 1L;
        while (exp > 0) {
            if (exp % 2 != 0)
                t = (t * base) % mod;

            base = (base * base) % mod;
            exp /= 2;
        }
        return t % mod;
    } long t = 1L; t 1L while (exp > 0) {
            if (exp % 2 != 0)
                t = (t * base) % mod;

            base = (base * base) % mod;
            exp /= 2;
        } exp > 0 exp 0 {
            if (exp % 2 != 0)
                t = (t * base) % mod;

            base = (base * base) % mod;
            exp /= 2;
        } if (exp % 2 != 0)
                t = (t * base) % mod; exp % 2 != 0 exp % 2 exp 2 0 t = (t * base) % mod t (t * base) % mod (t * base) t base mod base = (base * base) % mod base (base * base) % mod (base * base) base base mod exp /= 2 exp 2 return t % mod; t % mod t mod long base base long exp exp public static void reverse (long[] array) {
        int len = array.length;
        for(int i=0;i<len/2;i++) {
            array[i]^=array[len-1-i];
            array[len-i-1]^=array[i];
            array[i]^=array[len-i-1];
        }
    } reverse {
        int len = array.length;
        for(int i=0;i<len/2;i++) {
            array[i]^=array[len-1-i];
            array[len-i-1]^=array[i];
            array[i]^=array[len-i-1];
        }
    } int len = array.length; len array.length array array.length for(int i=0;i<len/2;i++) {
            array[i]^=array[len-1-i];
            array[len-i-1]^=array[i];
            array[i]^=array[len-i-1];
        } int i=0; int i=0; i 0 i<len/2 i len/2 len 2 i++ i++ i {
            array[i]^=array[len-1-i];
            array[len-i-1]^=array[i];
            array[i]^=array[len-i-1];
        } {
            array[i]^=array[len-1-i];
            array[len-i-1]^=array[i];
            array[i]^=array[len-i-1];
        } array[i]^=array[len-1-i] array[i] array i array[len-1-i] array len-1-i len-1-i len 1 i array[len-i-1]^=array[i] array[len-i-1] array len-i-1 len-i-1 len i 1 array[i] array i array[i]^=array[len-i-1] array[i] array i array[len-i-1] array len-i-1 len-i-1 len i 1 long[] array array public static int low_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]<=value) {
                lo=mid+1;
                ans=mid;
            }
            else
                hi=mid-1;
        }
        return ans;
    } low_bound {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]<=value) {
                lo=mid+1;
                ans=mid;
            }
            else
                hi=mid-1;
        }
        return ans;
    } int len = array.length; len array.length array array.length int lo = 0; lo 0 int hi = len-1; hi len-1 len 1 int ans = -1; ans -1 1 while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]<=value) {
                lo=mid+1;
                ans=mid;
            }
            else
                hi=mid-1;
        } lo<=hi lo hi {
            int mid = lo+(hi-lo)/2;
            if(array[mid]<=value) {
                lo=mid+1;
                ans=mid;
            }
            else
                hi=mid-1;
        } int mid = lo+(hi-lo)/2; mid lo+(hi-lo)/2 lo (hi-lo)/2 (hi-lo) hi lo 2 if(array[mid]<=value) {
                lo=mid+1;
                ans=mid;
            }
            else
                hi=mid-1; array[mid]<=value array[mid] array mid value {
                lo=mid+1;
                ans=mid;
            } lo=mid+1 lo mid+1 mid 1 ans=mid ans mid hi=mid-1 hi mid-1 mid 1 return ans; ans long[] array array long value value public static int up_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]>=value) {
                hi=mid-1;
                ans=mid;
            }
            else
                lo=mid+1;
        }
        return ans;
    } up_bound {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]>=value) {
                hi=mid-1;
                ans=mid;
            }
            else
                lo=mid+1;
        }
        return ans;
    } int len = array.length; len array.length array array.length int lo = 0; lo 0 int hi = len-1; hi len-1 len 1 int ans = -1; ans -1 1 while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]>=value) {
                hi=mid-1;
                ans=mid;
            }
            else
                lo=mid+1;
        } lo<=hi lo hi {
            int mid = lo+(hi-lo)/2;
            if(array[mid]>=value) {
                hi=mid-1;
                ans=mid;
            }
            else
                lo=mid+1;
        } int mid = lo+(hi-lo)/2; mid lo+(hi-lo)/2 lo (hi-lo)/2 (hi-lo) hi lo 2 if(array[mid]>=value) {
                hi=mid-1;
                ans=mid;
            }
            else
                lo=mid+1; array[mid]>=value array[mid] array mid value {
                hi=mid-1;
                ans=mid;
            } hi=mid-1 hi mid-1 mid 1 ans=mid ans mid lo=mid+1 lo mid+1 mid 1 return ans; ans long[] array array long value value static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }

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

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    } Scanner StringTokenizer st; st BufferedReader br; br public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        } Scanner {
            br = new BufferedReader(new InputStreamReader(s));
        } br = new BufferedReader(new InputStreamReader(s)) br new BufferedReader(new InputStreamReader(s)) InputStream s s public Scanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        } Scanner {
            br = new BufferedReader(fileReader);
        } br = new BufferedReader(fileReader) br new BufferedReader(fileReader) FileReader fileReader fileReader public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        } while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine()); st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public 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 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 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 public String nextLine() throws IOException {
            return br.readLine();
        } nextLine {
            return br.readLine();
        } return br.readLine(); br.readLine() br.readLine br public boolean ready() throws IOException {
            return br.ready();
        } ready {
            return br.ready();
        } return br.ready(); br.ready() br.ready br public class Main {

    //main solution here

    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    static long mod = (long)1e9+7;
    static long MOD = 998244353;
    static long INF = (long)1e18;
    static int inf = (int)1e9;
    //static ArrayList<Integer> list[] = new ArrayList[(int)3e3+1];
    //static int color[] = new int[(int)2e6+1];
    //static int visit[] = new int[(int)1e4+1];
    //static int level[] = new int[(int)1e4+1];
    //static Deque<Integer> q = new ArrayDeque<>();

    public static void main(String[] args) throws IOException {
        double a,b,h,m;
        a = sc.nextDouble();
        b = sc.nextDouble();
        h = sc.nextDouble();
        m = sc.nextDouble();
        h= h + m/60;
        double y = 2 * a * b * Math.cos((Math.PI*Math.abs(h*30-m*6))/180);
        double ans = a*a+b*b-y;
        out.println(Math.sqrt(ans));

        out.flush();
        out.close();
    }

    //solution functions here

    //---templates---
    public static boolean ispal(char[] c) {
        int n = c.length;
        for(int i=0;i<n/2;i++) {
            if(c[i]!=c[n-i-1])
                return false;
        }
        return true;
    }

    static long pow(long base, long exp)
    {
        long t = 1L;
        while (exp > 0) {
            if (exp % 2 != 0)
                t = (t * base) % mod;

            base = (base * base) % mod;
            exp /= 2;
        }
        return t % mod;
    }
    public static void reverse (long[] array) {
        int len = array.length;
        for(int i=0;i<len/2;i++) {
            array[i]^=array[len-1-i];
            array[len-i-1]^=array[i];
            array[i]^=array[len-i-1];
        }
    }

    public static int low_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]<=value) {
                lo=mid+1;
                ans=mid;
            }
            else
                hi=mid-1;
        }
        return ans;
    }

    public static int up_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]>=value) {
                hi=mid-1;
                ans=mid;
            }
            else
                lo=mid+1;
        }
        return ans;
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }

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

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
} public class Main {

    //main solution here

    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    static long mod = (long)1e9+7;
    static long MOD = 998244353;
    static long INF = (long)1e18;
    static int inf = (int)1e9;
    //static ArrayList<Integer> list[] = new ArrayList[(int)3e3+1];
    //static int color[] = new int[(int)2e6+1];
    //static int visit[] = new int[(int)1e4+1];
    //static int level[] = new int[(int)1e4+1];
    //static Deque<Integer> q = new ArrayDeque<>();

    public static void main(String[] args) throws IOException {
        double a,b,h,m;
        a = sc.nextDouble();
        b = sc.nextDouble();
        h = sc.nextDouble();
        m = sc.nextDouble();
        h= h + m/60;
        double y = 2 * a * b * Math.cos((Math.PI*Math.abs(h*30-m*6))/180);
        double ans = a*a+b*b-y;
        out.println(Math.sqrt(ans));

        out.flush();
        out.close();
    }

    //solution functions here

    //---templates---
    public static boolean ispal(char[] c) {
        int n = c.length;
        for(int i=0;i<n/2;i++) {
            if(c[i]!=c[n-i-1])
                return false;
        }
        return true;
    }

    static long pow(long base, long exp)
    {
        long t = 1L;
        while (exp > 0) {
            if (exp % 2 != 0)
                t = (t * base) % mod;

            base = (base * base) % mod;
            exp /= 2;
        }
        return t % mod;
    }
    public static void reverse (long[] array) {
        int len = array.length;
        for(int i=0;i<len/2;i++) {
            array[i]^=array[len-1-i];
            array[len-i-1]^=array[i];
            array[i]^=array[len-i-1];
        }
    }

    public static int low_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]<=value) {
                lo=mid+1;
                ans=mid;
            }
            else
                hi=mid-1;
        }
        return ans;
    }

    public static int up_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]>=value) {
                hi=mid-1;
                ans=mid;
            }
            else
                lo=mid+1;
        }
        return ans;
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }

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

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
} Main


import java.math.*;
import java.io.*;
import java.util.*;
import java.lang.*;

//solution classes here

public class Main {

    //main solution here

    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);
    static long mod = (long)1e9+7;
    static long MOD = 998244353;
    static long INF = (long)1e18;
    static int inf = (int)1e9;
    //static ArrayList<Integer> list[] = new ArrayList[(int)3e3+1];
    //static int color[] = new int[(int)2e6+1];
    //static int visit[] = new int[(int)1e4+1];
    //static int level[] = new int[(int)1e4+1];
    //static Deque<Integer> q = new ArrayDeque<>();

    public static void main(String[] args) throws IOException {
        double a,b,h,m;
        a = sc.nextDouble();
        b = sc.nextDouble();
        h = sc.nextDouble();
        m = sc.nextDouble();
        h= h + m/60;
        double y = 2 * a * b * Math.cos((Math.PI*Math.abs(h*30-m*6))/180);
        double ans = a*a+b*b-y;
        out.println(Math.sqrt(ans));

        out.flush();
        out.close();
    }

    //solution functions here

    //---templates---
    public static boolean ispal(char[] c) {
        int n = c.length;
        for(int i=0;i<n/2;i++) {
            if(c[i]!=c[n-i-1])
                return false;
        }
        return true;
    }

    static long pow(long base, long exp)
    {
        long t = 1L;
        while (exp > 0) {
            if (exp % 2 != 0)
                t = (t * base) % mod;

            base = (base * base) % mod;
            exp /= 2;
        }
        return t % mod;
    }
    public static void reverse (long[] array) {
        int len = array.length;
        for(int i=0;i<len/2;i++) {
            array[i]^=array[len-1-i];
            array[len-i-1]^=array[i];
            array[i]^=array[len-i-1];
        }
    }

    public static int low_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]<=value) {
                lo=mid+1;
                ans=mid;
            }
            else
                hi=mid-1;
        }
        return ans;
    }

    public static int up_bound(long[] array, long value) {
        int len = array.length;
        int lo = 0;
        int hi = len-1;
        int ans = -1;
        while(lo<=hi) {
            int mid = lo+(hi-lo)/2;
            if(array[mid]>=value) {
                hi=mid-1;
                ans=mid;
            }
            else
                lo=mid+1;
        }
        return ans;
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }

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

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}

/* *****************************************************************************************************************************
 * I'M NOT IN DANGER, I'M THE DANGER!!!
 * *****************************************************************************************************************************
 */