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)));
		}
	}
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz