import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int H = sc.nextInt();
            int M = sc.nextInt();

            double thetaH = Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0));
            double thetaM = Math.toRadians(360.0 * M / 60.0);

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

            double dx = xH - xM;
            double dy = yH - yM;

            double distance = Math.sqrt(dx * dx + dy * dy);

            System.out.println(distance);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int H = sc.nextInt();
            int M = sc.nextInt();

            double thetaH = Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0));
            double thetaM = Math.toRadians(360.0 * M / 60.0);

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

            double dx = xH - xM;
            double dy = yH - yM;

            double distance = Math.sqrt(dx * dx + dy * dy);

            System.out.println(distance);
        }
    }
} Main public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int H = sc.nextInt();
            int M = sc.nextInt();

            double thetaH = Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0));
            double thetaM = Math.toRadians(360.0 * M / 60.0);

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

            double dx = xH - xM;
            double dy = yH - yM;

            double distance = Math.sqrt(dx * dx + dy * dy);

            System.out.println(distance);
        }
    } main {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int H = sc.nextInt();
            int M = sc.nextInt();

            double thetaH = Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0));
            double thetaM = Math.toRadians(360.0 * M / 60.0);

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

            double dx = xH - xM;
            double dy = yH - yM;

            double distance = Math.sqrt(dx * dx + dy * dy);

            System.out.println(distance);
        }
    } try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int H = sc.nextInt();
            int M = sc.nextInt();

            double thetaH = Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0));
            double thetaM = Math.toRadians(360.0 * M / 60.0);

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

            double dx = xH - xM;
            double dy = yH - yM;

            double distance = Math.sqrt(dx * dx + dy * dy);

            System.out.println(distance);
        } {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int H = sc.nextInt();
            int M = sc.nextInt();

            double thetaH = Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0));
            double thetaM = Math.toRadians(360.0 * M / 60.0);

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

            double dx = xH - xM;
            double dy = yH - yM;

            double distance = Math.sqrt(dx * dx + dy * dy);

            System.out.println(distance);
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int H = sc.nextInt(); H sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc double thetaH = Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0)); thetaH Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0)) Math.toRadians Math 360.0 * (H * 60 + M) / (12.0 * 60.0) 360.0 * (H * 60 + M) 360.0 (H * 60 + M) H * 60 H 60 M (12.0 * 60.0) 12.0 60.0 double thetaM = Math.toRadians(360.0 * M / 60.0); thetaM Math.toRadians(360.0 * M / 60.0) Math.toRadians Math 360.0 * M / 60.0 360.0 * M 360.0 M 60.0 double xH = A * Math.cos(thetaH); xH A * Math.cos(thetaH) A Math.cos(thetaH) Math.cos Math thetaH double yH = A * Math.sin(thetaH); yH A * Math.sin(thetaH) A Math.sin(thetaH) Math.sin Math thetaH double xM = B * Math.cos(thetaM); xM B * Math.cos(thetaM) B Math.cos(thetaM) Math.cos Math thetaM double yM = B * Math.sin(thetaM); yM B * Math.sin(thetaM) B Math.sin(thetaM) Math.sin Math thetaM double dx = xH - xM; dx xH - xM xH xM double dy = yH - yM; dy yH - yM yH yM double distance = Math.sqrt(dx * dx + dy * dy); distance Math.sqrt(dx * dx + dy * dy) Math.sqrt Math dx * dx + dy * dy dx * dx dx dx dy * dy dy dy System.out.println(distance) System.out.println System.out System System.out distance String[] args args public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int H = sc.nextInt();
            int M = sc.nextInt();

            double thetaH = Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0));
            double thetaM = Math.toRadians(360.0 * M / 60.0);

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

            double dx = xH - xM;
            double dy = yH - yM;

            double distance = Math.sqrt(dx * dx + dy * dy);

            System.out.println(distance);
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int H = sc.nextInt();
            int M = sc.nextInt();

            double thetaH = Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0));
            double thetaM = Math.toRadians(360.0 * M / 60.0);

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

            double dx = xH - xM;
            double dy = yH - yM;

            double distance = Math.sqrt(dx * dx + dy * dy);

            System.out.println(distance);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int H = sc.nextInt();
            int M = sc.nextInt();

            double thetaH = Math.toRadians(360.0 * (H * 60 + M) / (12.0 * 60.0));
            double thetaM = Math.toRadians(360.0 * M / 60.0);

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

            double dx = xH - xM;
            double dy = yH - yM;

            double distance = Math.sqrt(dx * dx + dy * dy);

            System.out.println(distance);
        }
    }
}
