import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        double hx = a * Math.cos(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double hy = a * Math.sin(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double mx = b * Math.cos(Math.toRadians(90.0 - (6.0 * m)));
        double my = b * Math.sin(Math.toRadians(90.0 - (6.0 * m)));
        double rad = Math.sqrt((mx - hx) * (mx - hx) + (my - hy) * (my - hy));
        System.out.println(rad);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        double hx = a * Math.cos(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double hy = a * Math.sin(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double mx = b * Math.cos(Math.toRadians(90.0 - (6.0 * m)));
        double my = b * Math.sin(Math.toRadians(90.0 - (6.0 * m)));
        double rad = Math.sqrt((mx - hx) * (mx - hx) + (my - hy) * (my - hy));
        System.out.println(rad);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        double hx = a * Math.cos(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double hy = a * Math.sin(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double mx = b * Math.cos(Math.toRadians(90.0 - (6.0 * m)));
        double my = b * Math.sin(Math.toRadians(90.0 - (6.0 * m)));
        double rad = Math.sqrt((mx - hx) * (mx - hx) + (my - hy) * (my - hy));
        System.out.println(rad);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        double hx = a * Math.cos(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double hy = a * Math.sin(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double mx = b * Math.cos(Math.toRadians(90.0 - (6.0 * m)));
        double my = b * Math.sin(Math.toRadians(90.0 - (6.0 * m)));
        double rad = Math.sqrt((mx - hx) * (mx - hx) + (my - hy) * (my - hy));
        System.out.println(rad);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = Integer.parseInt(sc.next()); a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int b = Integer.parseInt(sc.next()); b Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int h = Integer.parseInt(sc.next()); h Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int m = Integer.parseInt(sc.next()); m Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc double hx = a * Math.cos(Math.toRadians(90.0 - (30.0 * h + 0.5 * m))); hx a * Math.cos(Math.toRadians(90.0 - (30.0 * h + 0.5 * m))) a Math.cos(Math.toRadians(90.0 - (30.0 * h + 0.5 * m))) Math.cos Math Math.toRadians(90.0 - (30.0 * h + 0.5 * m)) Math.toRadians Math 90.0 - (30.0 * h + 0.5 * m) 90.0 (30.0 * h + 0.5 * m) 30.0 * h 30.0 h 0.5 * m 0.5 m double hy = a * Math.sin(Math.toRadians(90.0 - (30.0 * h + 0.5 * m))); hy a * Math.sin(Math.toRadians(90.0 - (30.0 * h + 0.5 * m))) a Math.sin(Math.toRadians(90.0 - (30.0 * h + 0.5 * m))) Math.sin Math Math.toRadians(90.0 - (30.0 * h + 0.5 * m)) Math.toRadians Math 90.0 - (30.0 * h + 0.5 * m) 90.0 (30.0 * h + 0.5 * m) 30.0 * h 30.0 h 0.5 * m 0.5 m double mx = b * Math.cos(Math.toRadians(90.0 - (6.0 * m))); mx b * Math.cos(Math.toRadians(90.0 - (6.0 * m))) b Math.cos(Math.toRadians(90.0 - (6.0 * m))) Math.cos Math Math.toRadians(90.0 - (6.0 * m)) Math.toRadians Math 90.0 - (6.0 * m) 90.0 (6.0 * m) 6.0 m double my = b * Math.sin(Math.toRadians(90.0 - (6.0 * m))); my b * Math.sin(Math.toRadians(90.0 - (6.0 * m))) b Math.sin(Math.toRadians(90.0 - (6.0 * m))) Math.sin Math Math.toRadians(90.0 - (6.0 * m)) Math.toRadians Math 90.0 - (6.0 * m) 90.0 (6.0 * m) 6.0 m double rad = Math.sqrt((mx - hx) * (mx - hx) + (my - hy) * (my - hy)); rad Math.sqrt((mx - hx) * (mx - hx) + (my - hy) * (my - hy)) Math.sqrt Math (mx - hx) * (mx - hx) + (my - hy) * (my - hy) (mx - hx) * (mx - hx) (mx - hx) mx hx (mx - hx) mx hx (my - hy) * (my - hy) (my - hy) my hy (my - hy) my hy System.out.println(rad) System.out.println System.out System System.out rad String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        double hx = a * Math.cos(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double hy = a * Math.sin(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double mx = b * Math.cos(Math.toRadians(90.0 - (6.0 * m)));
        double my = b * Math.sin(Math.toRadians(90.0 - (6.0 * m)));
        double rad = Math.sqrt((mx - hx) * (mx - hx) + (my - hy) * (my - hy));
        System.out.println(rad);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        double hx = a * Math.cos(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double hy = a * Math.sin(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double mx = b * Math.cos(Math.toRadians(90.0 - (6.0 * m)));
        double my = b * Math.sin(Math.toRadians(90.0 - (6.0 * m)));
        double rad = Math.sqrt((mx - hx) * (mx - hx) + (my - hy) * (my - hy));
        System.out.println(rad);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int h = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        double hx = a * Math.cos(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double hy = a * Math.sin(Math.toRadians(90.0 - (30.0 * h + 0.5 * m)));
        double mx = b * Math.cos(Math.toRadians(90.0 - (6.0 * m)));
        double my = b * Math.sin(Math.toRadians(90.0 - (6.0 * m)));
        double rad = Math.sqrt((mx - hx) * (mx - hx) + (my - hy) * (my - hy));
        System.out.println(rad);
    }
}
