import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int h = scanner.nextInt(), m = scanner.nextInt();
			double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double x2 = b * Math.sin(m / 30.d * Math.PI);
			double y2 = b * Math.cos(m / 30.d * Math.PI);
			System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int h = scanner.nextInt(), m = scanner.nextInt();
			double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double x2 = b * Math.sin(m / 30.d * Math.PI);
			double y2 = b * Math.cos(m / 30.d * Math.PI);
			System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
		}
	}
} Main public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int h = scanner.nextInt(), m = scanner.nextInt();
			double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double x2 = b * Math.sin(m / 30.d * Math.PI);
			double y2 = b * Math.cos(m / 30.d * Math.PI);
			System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
		}
	} main {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int h = scanner.nextInt(), m = scanner.nextInt();
			double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double x2 = b * Math.sin(m / 30.d * Math.PI);
			double y2 = b * Math.cos(m / 30.d * Math.PI);
			System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
		}
	} try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int h = scanner.nextInt(), m = scanner.nextInt();
			double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double x2 = b * Math.sin(m / 30.d * Math.PI);
			double y2 = b * Math.cos(m / 30.d * Math.PI);
			System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
		} {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int h = scanner.nextInt(), m = scanner.nextInt();
			double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double x2 = b * Math.sin(m / 30.d * Math.PI);
			double y2 = b * Math.cos(m / 30.d * Math.PI);
			System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) int a = scanner.nextInt() a scanner.nextInt() scanner.nextInt scanner b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner int h = scanner.nextInt() h scanner.nextInt() scanner.nextInt scanner m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI); x1 a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI) a Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI) Math.sin Math (h * 60.0d + m) / 12.0d / 30.0d * Math.PI (h * 60.0d + m) / 12.0d / 30.0d (h * 60.0d + m) / 12.0d / 30.0d (h * 60.0d + m) h * 60.0d h 60.0d m 12.0d 30.0d Math.PI Math Math.PI double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI); y1 a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI) a Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI) Math.cos Math (h * 60.0d + m) / 12.0d / 30.0d * Math.PI (h * 60.0d + m) / 12.0d / 30.0d (h * 60.0d + m) / 12.0d / 30.0d (h * 60.0d + m) h * 60.0d h 60.0d m 12.0d 30.0d Math.PI Math Math.PI double x2 = b * Math.sin(m / 30.d * Math.PI); x2 b * Math.sin(m / 30.d * Math.PI) b Math.sin(m / 30.d * Math.PI) Math.sin Math m / 30.d * Math.PI m / 30.d m 30.d Math.PI Math Math.PI double y2 = b * Math.cos(m / 30.d * Math.PI); y2 b * Math.cos(m / 30.d * Math.PI) b Math.cos(m / 30.d * Math.PI) Math.cos Math m / 30.d * Math.PI m / 30.d m 30.d Math.PI Math Math.PI System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))) System.out.println System.out System System.out Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) Math.sqrt Math (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) (x1 - x2) * (x1 - x2) (x1 - x2) x1 x2 (x1 - x2) x1 x2 (y1 - y2) * (y1 - y2) (y1 - y2) y1 y2 (y1 - y2) y1 y2 String[] args args public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int h = scanner.nextInt(), m = scanner.nextInt();
			double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double x2 = b * Math.sin(m / 30.d * Math.PI);
			double y2 = b * Math.cos(m / 30.d * Math.PI);
			System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
		}
	}
} public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int h = scanner.nextInt(), m = scanner.nextInt();
			double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double x2 = b * Math.sin(m / 30.d * Math.PI);
			double y2 = b * Math.cos(m / 30.d * Math.PI);
			System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int a = scanner.nextInt(), b = scanner.nextInt();
			int h = scanner.nextInt(), m = scanner.nextInt();
			double x1 = a * Math.sin((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double y1 = a * Math.cos((h * 60.0d + m) / 12.0d / 30.0d * Math.PI);
			double x2 = b * Math.sin(m / 30.d * Math.PI);
			double y2 = b * Math.cos(m / 30.d * Math.PI);
			System.out.println(Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
		}
	}
}
