
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int H = scan.nextInt();
        int M = scan.nextInt();

        double ax = A*Math.cos(Math.toRadians(90-30*H-M/2.0));
        double ay = A*Math.sin(Math.toRadians(90-30*H-M/2.0));
        double bx = B*Math.cos(Math.toRadians(90-6*M));
        double by = B*Math.sin(Math.toRadians(90-6*M));

        double ans = Math.sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));

        os.println(ans);
    }


} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.HashSet; HashSet java.util import java.util.List; List java.util import java.util.Map; Map java.util import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int H = scan.nextInt();
        int M = scan.nextInt();

        double ax = A*Math.cos(Math.toRadians(90-30*H-M/2.0));
        double ay = A*Math.sin(Math.toRadians(90-30*H-M/2.0));
        double bx = B*Math.cos(Math.toRadians(90-6*M));
        double by = B*Math.sin(Math.toRadians(90-6*M));

        double ans = Math.sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));

        os.println(ans);
    }


} Main public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    } main {
        solve(System.in, System.out);
    } solve(System.in, System.out) solve System.in System System.in System.out System System.out String[] args args static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int H = scan.nextInt();
        int M = scan.nextInt();

        double ax = A*Math.cos(Math.toRadians(90-30*H-M/2.0));
        double ay = A*Math.sin(Math.toRadians(90-30*H-M/2.0));
        double bx = B*Math.cos(Math.toRadians(90-6*M));
        double by = B*Math.sin(Math.toRadians(90-6*M));

        double ans = Math.sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));

        os.println(ans);
    } solve {
        // Your code here!
        Scanner scan = new Scanner(is);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int H = scan.nextInt();
        int M = scan.nextInt();

        double ax = A*Math.cos(Math.toRadians(90-30*H-M/2.0));
        double ay = A*Math.sin(Math.toRadians(90-30*H-M/2.0));
        double bx = B*Math.cos(Math.toRadians(90-6*M));
        double by = B*Math.sin(Math.toRadians(90-6*M));

        double ans = Math.sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));

        os.println(ans);
    } Scanner scan = new Scanner(is); scan new Scanner(is) int A = scan.nextInt(); A scan.nextInt() scan.nextInt scan int B = scan.nextInt(); B scan.nextInt() scan.nextInt scan int H = scan.nextInt(); H scan.nextInt() scan.nextInt scan int M = scan.nextInt(); M scan.nextInt() scan.nextInt scan double ax = A*Math.cos(Math.toRadians(90-30*H-M/2.0)); ax A*Math.cos(Math.toRadians(90-30*H-M/2.0)) A Math.cos(Math.toRadians(90-30*H-M/2.0)) Math.cos Math Math.toRadians(90-30*H-M/2.0) Math.toRadians Math 90-30*H-M/2.0 90-30*H-M/2.0 90 30*H 30 H M/2.0 M 2.0 double ay = A*Math.sin(Math.toRadians(90-30*H-M/2.0)); ay A*Math.sin(Math.toRadians(90-30*H-M/2.0)) A Math.sin(Math.toRadians(90-30*H-M/2.0)) Math.sin Math Math.toRadians(90-30*H-M/2.0) Math.toRadians Math 90-30*H-M/2.0 90-30*H-M/2.0 90 30*H 30 H M/2.0 M 2.0 double bx = B*Math.cos(Math.toRadians(90-6*M)); bx B*Math.cos(Math.toRadians(90-6*M)) B Math.cos(Math.toRadians(90-6*M)) Math.cos Math Math.toRadians(90-6*M) Math.toRadians Math 90-6*M 90 6*M 6 M double by = B*Math.sin(Math.toRadians(90-6*M)); by B*Math.sin(Math.toRadians(90-6*M)) B Math.sin(Math.toRadians(90-6*M)) Math.sin Math Math.toRadians(90-6*M) Math.toRadians Math 90-6*M 90 6*M 6 M double ans = Math.sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by)); ans Math.sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by)) Math.sqrt Math (ax-bx)*(ax-bx)+(ay-by)*(ay-by) (ax-bx)*(ax-bx) (ax-bx) ax bx (ax-bx) ax bx (ay-by)*(ay-by) (ay-by) ay by (ay-by) ay by os.println(ans) os.println os ans InputStream is is PrintStream os os public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int H = scan.nextInt();
        int M = scan.nextInt();

        double ax = A*Math.cos(Math.toRadians(90-30*H-M/2.0));
        double ay = A*Math.sin(Math.toRadians(90-30*H-M/2.0));
        double bx = B*Math.cos(Math.toRadians(90-6*M));
        double by = B*Math.sin(Math.toRadians(90-6*M));

        double ans = Math.sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));

        os.println(ans);
    }


} public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int H = scan.nextInt();
        int M = scan.nextInt();

        double ax = A*Math.cos(Math.toRadians(90-30*H-M/2.0));
        double ay = A*Math.sin(Math.toRadians(90-30*H-M/2.0));
        double bx = B*Math.cos(Math.toRadians(90-6*M));
        double by = B*Math.sin(Math.toRadians(90-6*M));

        double ans = Math.sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));

        os.println(ans);
    }


} Main

import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int H = scan.nextInt();
        int M = scan.nextInt();

        double ax = A*Math.cos(Math.toRadians(90-30*H-M/2.0));
        double ay = A*Math.sin(Math.toRadians(90-30*H-M/2.0));
        double bx = B*Math.cos(Math.toRadians(90-6*M));
        double by = B*Math.sin(Math.toRadians(90-6*M));

        double ans = Math.sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));

        os.println(ans);
    }


}