import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();
		double ab = 0;
		double other = 0;
		double longHand = 0;
		double shortHand = 0;
		double angle = 0;
		int min = H * 60 + M;
		
		ab = Math.pow(A, 2) + Math.pow(B, 2);
		
		longHand = 6 * M;
		shortHand = 0.5 * min;
		angle = shortHand - longHand;
		if (H > 6) {
			angle = 360 - angle;
		}
		
		other = (2 * A * B) * Math.cos(Math.toRadians(angle));
		if (angle == 90.0) {
			other = 0;
		}
		
		System.out.println(Math.sqrt(ab - other));
		/*
		System.out.println(ab);
		System.out.println(other);
		System.out.println(Math.cos(Math.toRadians(90.0)));
		System.out.println(angle);
		*/
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();
		double ab = 0;
		double other = 0;
		double longHand = 0;
		double shortHand = 0;
		double angle = 0;
		int min = H * 60 + M;
		
		ab = Math.pow(A, 2) + Math.pow(B, 2);
		
		longHand = 6 * M;
		shortHand = 0.5 * min;
		angle = shortHand - longHand;
		if (H > 6) {
			angle = 360 - angle;
		}
		
		other = (2 * A * B) * Math.cos(Math.toRadians(angle));
		if (angle == 90.0) {
			other = 0;
		}
		
		System.out.println(Math.sqrt(ab - other));
		/*
		System.out.println(ab);
		System.out.println(other);
		System.out.println(Math.cos(Math.toRadians(90.0)));
		System.out.println(angle);
		*/
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();
		double ab = 0;
		double other = 0;
		double longHand = 0;
		double shortHand = 0;
		double angle = 0;
		int min = H * 60 + M;
		
		ab = Math.pow(A, 2) + Math.pow(B, 2);
		
		longHand = 6 * M;
		shortHand = 0.5 * min;
		angle = shortHand - longHand;
		if (H > 6) {
			angle = 360 - angle;
		}
		
		other = (2 * A * B) * Math.cos(Math.toRadians(angle));
		if (angle == 90.0) {
			other = 0;
		}
		
		System.out.println(Math.sqrt(ab - other));
		/*
		System.out.println(ab);
		System.out.println(other);
		System.out.println(Math.cos(Math.toRadians(90.0)));
		System.out.println(angle);
		*/
	} main {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();
		double ab = 0;
		double other = 0;
		double longHand = 0;
		double shortHand = 0;
		double angle = 0;
		int min = H * 60 + M;
		
		ab = Math.pow(A, 2) + Math.pow(B, 2);
		
		longHand = 6 * M;
		shortHand = 0.5 * min;
		angle = shortHand - longHand;
		if (H > 6) {
			angle = 360 - angle;
		}
		
		other = (2 * A * B) * Math.cos(Math.toRadians(angle));
		if (angle == 90.0) {
			other = 0;
		}
		
		System.out.println(Math.sqrt(ab - other));
		/*
		System.out.println(ab);
		System.out.println(other);
		System.out.println(Math.cos(Math.toRadians(90.0)));
		System.out.println(angle);
		*/
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int A = scan.nextInt(); A scan.nextInt() scan.nextInt scan int B = scan.nextInt(); B scan.nextInt() scan.nextInt scan int H = scan.nextInt(); H scan.nextInt() scan.nextInt scan int M = scan.nextInt(); M scan.nextInt() scan.nextInt scan double ab = 0; ab 0 double other = 0; other 0 double longHand = 0; longHand 0 double shortHand = 0; shortHand 0 double angle = 0; angle 0 int min = H * 60 + M; min H * 60 + M H * 60 H 60 M ab = Math.pow(A, 2) + Math.pow(B, 2) ab 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 longHand = 6 * M longHand 6 * M 6 M shortHand = 0.5 * min shortHand 0.5 * min 0.5 min angle = shortHand - longHand angle shortHand - longHand shortHand longHand if (H > 6) {
			angle = 360 - angle;
		} H > 6 H 6 {
			angle = 360 - angle;
		} angle = 360 - angle angle 360 - angle 360 angle other = (2 * A * B) * Math.cos(Math.toRadians(angle)) other (2 * A * B) * Math.cos(Math.toRadians(angle)) (2 * A * B) 2 * A * B 2 A B Math.cos(Math.toRadians(angle)) Math.cos Math Math.toRadians(angle) Math.toRadians Math angle if (angle == 90.0) {
			other = 0;
		} angle == 90.0 angle 90.0 {
			other = 0;
		} other = 0 other 0 System.out.println(Math.sqrt(ab - other)) System.out.println System.out System System.out Math.sqrt(ab - other) Math.sqrt Math ab - other ab other String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();
		double ab = 0;
		double other = 0;
		double longHand = 0;
		double shortHand = 0;
		double angle = 0;
		int min = H * 60 + M;
		
		ab = Math.pow(A, 2) + Math.pow(B, 2);
		
		longHand = 6 * M;
		shortHand = 0.5 * min;
		angle = shortHand - longHand;
		if (H > 6) {
			angle = 360 - angle;
		}
		
		other = (2 * A * B) * Math.cos(Math.toRadians(angle));
		if (angle == 90.0) {
			other = 0;
		}
		
		System.out.println(Math.sqrt(ab - other));
		/*
		System.out.println(ab);
		System.out.println(other);
		System.out.println(Math.cos(Math.toRadians(90.0)));
		System.out.println(angle);
		*/
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();
		double ab = 0;
		double other = 0;
		double longHand = 0;
		double shortHand = 0;
		double angle = 0;
		int min = H * 60 + M;
		
		ab = Math.pow(A, 2) + Math.pow(B, 2);
		
		longHand = 6 * M;
		shortHand = 0.5 * min;
		angle = shortHand - longHand;
		if (H > 6) {
			angle = 360 - angle;
		}
		
		other = (2 * A * B) * Math.cos(Math.toRadians(angle));
		if (angle == 90.0) {
			other = 0;
		}
		
		System.out.println(Math.sqrt(ab - other));
		/*
		System.out.println(ab);
		System.out.println(other);
		System.out.println(Math.cos(Math.toRadians(90.0)));
		System.out.println(angle);
		*/
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int H = scan.nextInt();
		int M = scan.nextInt();
		double ab = 0;
		double other = 0;
		double longHand = 0;
		double shortHand = 0;
		double angle = 0;
		int min = H * 60 + M;
		
		ab = Math.pow(A, 2) + Math.pow(B, 2);
		
		longHand = 6 * M;
		shortHand = 0.5 * min;
		angle = shortHand - longHand;
		if (H > 6) {
			angle = 360 - angle;
		}
		
		other = (2 * A * B) * Math.cos(Math.toRadians(angle));
		if (angle == 90.0) {
			other = 0;
		}
		
		System.out.println(Math.sqrt(ab - other));
		/*
		System.out.println(ab);
		System.out.println(other);
		System.out.println(Math.cos(Math.toRadians(90.0)));
		System.out.println(angle);
		*/
	}
}