
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		double a = sc.nextInt();
		double b = sc.nextInt();
		double h = sc.nextInt();
		double m = sc.nextInt();

		double angle_h = (30 * h) + 0.5 * m;
		double angle_m = 6 * m;
		double angle = 0;

		if(angle_h < angle_m) {
			angle = angle_m - angle_h;
		}else {
			angle = angle_h - angle_m;
		}

		double ans = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b *Math.cos(Math.toRadians(angle)));

		System.out.println(ans);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		double a = sc.nextInt();
		double b = sc.nextInt();
		double h = sc.nextInt();
		double m = sc.nextInt();

		double angle_h = (30 * h) + 0.5 * m;
		double angle_m = 6 * m;
		double angle = 0;

		if(angle_h < angle_m) {
			angle = angle_m - angle_h;
		}else {
			angle = angle_h - angle_m;
		}

		double ans = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b *Math.cos(Math.toRadians(angle)));

		System.out.println(ans);

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		double a = sc.nextInt();
		double b = sc.nextInt();
		double h = sc.nextInt();
		double m = sc.nextInt();

		double angle_h = (30 * h) + 0.5 * m;
		double angle_m = 6 * m;
		double angle = 0;

		if(angle_h < angle_m) {
			angle = angle_m - angle_h;
		}else {
			angle = angle_h - angle_m;
		}

		double ans = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b *Math.cos(Math.toRadians(angle)));

		System.out.println(ans);

	} main {
		Scanner sc = new Scanner(System.in);

		double a = sc.nextInt();
		double b = sc.nextInt();
		double h = sc.nextInt();
		double m = sc.nextInt();

		double angle_h = (30 * h) + 0.5 * m;
		double angle_m = 6 * m;
		double angle = 0;

		if(angle_h < angle_m) {
			angle = angle_m - angle_h;
		}else {
			angle = angle_h - angle_m;
		}

		double ans = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b *Math.cos(Math.toRadians(angle)));

		System.out.println(ans);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double a = sc.nextInt(); a sc.nextInt() sc.nextInt sc double b = sc.nextInt(); b sc.nextInt() sc.nextInt sc double h = sc.nextInt(); h sc.nextInt() sc.nextInt sc double m = sc.nextInt(); m sc.nextInt() sc.nextInt sc double angle_h = (30 * h) + 0.5 * m; angle_h (30 * h) + 0.5 * m (30 * h) 30 h 0.5 * m 0.5 m double angle_m = 6 * m; angle_m 6 * m 6 m double angle = 0; angle 0 if(angle_h < angle_m) {
			angle = angle_m - angle_h;
		}else {
			angle = angle_h - angle_m;
		} angle_h < angle_m angle_h angle_m {
			angle = angle_m - angle_h;
		} angle = angle_m - angle_h angle angle_m - angle_h angle_m angle_h {
			angle = angle_h - angle_m;
		} angle = angle_h - angle_m angle angle_h - angle_m angle_h angle_m double ans = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b *Math.cos(Math.toRadians(angle))); ans Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b *Math.cos(Math.toRadians(angle))) Math.sqrt Math Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b *Math.cos(Math.toRadians(angle)) Math.pow(a, 2) + Math.pow(b, 2) Math.pow(a, 2) Math.pow Math a 2 Math.pow(b, 2) Math.pow Math b 2 2 * a * b *Math.cos(Math.toRadians(angle)) b 2 * a * b *Math.cos(Math.toRadians(angle)) 2 a b Math.cos(Math.toRadians(angle)) Math.cos Math Math.toRadians(angle) Math.toRadians Math angle System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		double a = sc.nextInt();
		double b = sc.nextInt();
		double h = sc.nextInt();
		double m = sc.nextInt();

		double angle_h = (30 * h) + 0.5 * m;
		double angle_m = 6 * m;
		double angle = 0;

		if(angle_h < angle_m) {
			angle = angle_m - angle_h;
		}else {
			angle = angle_h - angle_m;
		}

		double ans = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b *Math.cos(Math.toRadians(angle)));

		System.out.println(ans);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		double a = sc.nextInt();
		double b = sc.nextInt();
		double h = sc.nextInt();
		double m = sc.nextInt();

		double angle_h = (30 * h) + 0.5 * m;
		double angle_m = 6 * m;
		double angle = 0;

		if(angle_h < angle_m) {
			angle = angle_m - angle_h;
		}else {
			angle = angle_h - angle_m;
		}

		double ans = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b *Math.cos(Math.toRadians(angle)));

		System.out.println(ans);

	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		double a = sc.nextInt();
		double b = sc.nextInt();
		double h = sc.nextInt();
		double m = sc.nextInt();

		double angle_h = (30 * h) + 0.5 * m;
		double angle_m = 6 * m;
		double angle = 0;

		if(angle_h < angle_m) {
			angle = angle_m - angle_h;
		}else {
			angle = angle_h - angle_m;
		}

		double ans = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b *Math.cos(Math.toRadians(angle)));

		System.out.println(ans);

	}

}
