import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int int1 = sc.nextInt();
		int int2 = sc.nextInt();
		double hour = sc.nextInt();
		double minit = sc.nextInt();
		sc.close();

		double rad1 = (hour % 12 * 60 + minit * 1) / (6 * 60) * Math.PI;
		double rad2 = ((minit * 12) / (6 * 60)) * Math.PI;



		// 余弦定理
		double tmp = Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) + Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2);
		System.out.println(Math.sqrt(tmp));

	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int int1 = sc.nextInt();
		int int2 = sc.nextInt();
		double hour = sc.nextInt();
		double minit = sc.nextInt();
		sc.close();

		double rad1 = (hour % 12 * 60 + minit * 1) / (6 * 60) * Math.PI;
		double rad2 = ((minit * 12) / (6 * 60)) * Math.PI;



		// 余弦定理
		double tmp = Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) + Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2);
		System.out.println(Math.sqrt(tmp));

	}

} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int int1 = sc.nextInt();
		int int2 = sc.nextInt();
		double hour = sc.nextInt();
		double minit = sc.nextInt();
		sc.close();

		double rad1 = (hour % 12 * 60 + minit * 1) / (6 * 60) * Math.PI;
		double rad2 = ((minit * 12) / (6 * 60)) * Math.PI;



		// 余弦定理
		double tmp = Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) + Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2);
		System.out.println(Math.sqrt(tmp));

	} main {
		Scanner sc = new Scanner(System.in);
		int int1 = sc.nextInt();
		int int2 = sc.nextInt();
		double hour = sc.nextInt();
		double minit = sc.nextInt();
		sc.close();

		double rad1 = (hour % 12 * 60 + minit * 1) / (6 * 60) * Math.PI;
		double rad2 = ((minit * 12) / (6 * 60)) * Math.PI;



		// 余弦定理
		double tmp = Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) + Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2);
		System.out.println(Math.sqrt(tmp));

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int int1 = sc.nextInt(); int1 sc.nextInt() sc.nextInt sc int int2 = sc.nextInt(); int2 sc.nextInt() sc.nextInt sc double hour = sc.nextInt(); hour sc.nextInt() sc.nextInt sc double minit = sc.nextInt(); minit sc.nextInt() sc.nextInt sc sc.close() sc.close sc double rad1 = (hour % 12 * 60 + minit * 1) / (6 * 60) * Math.PI; rad1 (hour % 12 * 60 + minit * 1) / (6 * 60) * Math.PI (hour % 12 * 60 + minit * 1) / (6 * 60) (hour % 12 * 60 + minit * 1) hour % 12 * 60 hour % 12 hour 12 60 minit * 1 minit 1 (6 * 60) 6 60 Math.PI Math Math.PI double rad2 = ((minit * 12) / (6 * 60)) * Math.PI; rad2 ((minit * 12) / (6 * 60)) * Math.PI ((minit * 12) / (6 * 60)) (minit * 12) minit 12 (6 * 60) 6 60 Math.PI Math Math.PI double tmp = Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) + Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2); tmp Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) + Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2) Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) Math.pow Math int1*Math.sin(rad1)-int2*Math.sin(rad2) int1*Math.sin(rad1) int1 Math.sin(rad1) Math.sin Math rad1 int2*Math.sin(rad2) int2 Math.sin(rad2) Math.sin Math rad2 2 Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2) Math.pow Math int1*Math.cos(rad1)-int2*Math.cos(rad2) int1*Math.cos(rad1) int1 Math.cos(rad1) Math.cos Math rad1 int2*Math.cos(rad2) int2 Math.cos(rad2) Math.cos Math rad2 2 System.out.println(Math.sqrt(tmp)) System.out.println System.out System System.out Math.sqrt(tmp) Math.sqrt Math tmp String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int int1 = sc.nextInt();
		int int2 = sc.nextInt();
		double hour = sc.nextInt();
		double minit = sc.nextInt();
		sc.close();

		double rad1 = (hour % 12 * 60 + minit * 1) / (6 * 60) * Math.PI;
		double rad2 = ((minit * 12) / (6 * 60)) * Math.PI;



		// 余弦定理
		double tmp = Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) + Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2);
		System.out.println(Math.sqrt(tmp));

	}

} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int int1 = sc.nextInt();
		int int2 = sc.nextInt();
		double hour = sc.nextInt();
		double minit = sc.nextInt();
		sc.close();

		double rad1 = (hour % 12 * 60 + minit * 1) / (6 * 60) * Math.PI;
		double rad2 = ((minit * 12) / (6 * 60)) * Math.PI;



		// 余弦定理
		double tmp = Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) + Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2);
		System.out.println(Math.sqrt(tmp));

	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int int1 = sc.nextInt();
		int int2 = sc.nextInt();
		double hour = sc.nextInt();
		double minit = sc.nextInt();
		sc.close();

		double rad1 = (hour % 12 * 60 + minit * 1) / (6 * 60) * Math.PI;
		double rad2 = ((minit * 12) / (6 * 60)) * Math.PI;



		// 余弦定理
		double tmp = Math.pow(int1*Math.sin(rad1)-int2*Math.sin(rad2),2) + Math.pow(int1*Math.cos(rad1)-int2*Math.cos(rad2),2);
		System.out.println(Math.sqrt(tmp));

	}

}
