import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		double tmp1 = sc.nextDouble();
		double tmp2 = sc.nextDouble();
		double h = tmp1 / 6. * Math.PI + tmp2 / 30. * Math.PI / 12.;
		double m = tmp2 / 30. * Math.PI + tmp1 / 6. * Math.PI * 12.;
		double rad = h - m;
		// System.out.println(rad / Math.PI / 2. * 360.);
		double res = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2. * a * b * Math.cos(rad)));
		System.out.println(res);
	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		double tmp1 = sc.nextDouble();
		double tmp2 = sc.nextDouble();
		double h = tmp1 / 6. * Math.PI + tmp2 / 30. * Math.PI / 12.;
		double m = tmp2 / 30. * Math.PI + tmp1 / 6. * Math.PI * 12.;
		double rad = h - m;
		// System.out.println(rad / Math.PI / 2. * 360.);
		double res = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2. * a * b * Math.cos(rad)));
		System.out.println(res);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		double tmp1 = sc.nextDouble();
		double tmp2 = sc.nextDouble();
		double h = tmp1 / 6. * Math.PI + tmp2 / 30. * Math.PI / 12.;
		double m = tmp2 / 30. * Math.PI + tmp1 / 6. * Math.PI * 12.;
		double rad = h - m;
		// System.out.println(rad / Math.PI / 2. * 360.);
		double res = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2. * a * b * Math.cos(rad)));
		System.out.println(res);
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		double tmp1 = sc.nextDouble();
		double tmp2 = sc.nextDouble();
		double h = tmp1 / 6. * Math.PI + tmp2 / 30. * Math.PI / 12.;
		double m = tmp2 / 30. * Math.PI + tmp1 / 6. * Math.PI * 12.;
		double rad = h - m;
		// System.out.println(rad / Math.PI / 2. * 360.);
		double res = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2. * a * b * Math.cos(rad)));
		System.out.println(res);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc double tmp1 = sc.nextDouble(); tmp1 sc.nextDouble() sc.nextDouble sc double tmp2 = sc.nextDouble(); tmp2 sc.nextDouble() sc.nextDouble sc double h = tmp1 / 6. * Math.PI + tmp2 / 30. * Math.PI / 12.; h tmp1 / 6. * Math.PI + tmp2 / 30. * Math.PI / 12. tmp1 / 6. * Math.PI tmp1 / 6. tmp1 6. Math.PI Math Math.PI tmp2 / 30. * Math.PI / 12. tmp2 / 30. * Math.PI tmp2 / 30. tmp2 30. Math.PI Math Math.PI 12. double m = tmp2 / 30. * Math.PI + tmp1 / 6. * Math.PI * 12.; m tmp2 / 30. * Math.PI + tmp1 / 6. * Math.PI * 12. tmp2 / 30. * Math.PI tmp2 / 30. tmp2 30. Math.PI Math Math.PI tmp1 / 6. * Math.PI * 12. tmp1 / 6. * Math.PI * 12. tmp1 / 6. tmp1 6. Math.PI Math Math.PI 12. double rad = h - m; rad h - m h m double res = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2. * a * b * Math.cos(rad))); res Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2. * a * b * Math.cos(rad))) Math.sqrt Math Math.pow(a, 2) + Math.pow(b, 2) - (2. * a * b * Math.cos(rad)) 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(rad)) b 2. * a * b * Math.cos(rad) 2. a b Math.cos(rad) Math.cos Math rad System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		double tmp1 = sc.nextDouble();
		double tmp2 = sc.nextDouble();
		double h = tmp1 / 6. * Math.PI + tmp2 / 30. * Math.PI / 12.;
		double m = tmp2 / 30. * Math.PI + tmp1 / 6. * Math.PI * 12.;
		double rad = h - m;
		// System.out.println(rad / Math.PI / 2. * 360.);
		double res = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2. * a * b * Math.cos(rad)));
		System.out.println(res);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		double tmp1 = sc.nextDouble();
		double tmp2 = sc.nextDouble();
		double h = tmp1 / 6. * Math.PI + tmp2 / 30. * Math.PI / 12.;
		double m = tmp2 / 30. * Math.PI + tmp1 / 6. * Math.PI * 12.;
		double rad = h - m;
		// System.out.println(rad / Math.PI / 2. * 360.);
		double res = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2. * a * b * Math.cos(rad)));
		System.out.println(res);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		double tmp1 = sc.nextDouble();
		double tmp2 = sc.nextDouble();
		double h = tmp1 / 6. * Math.PI + tmp2 / 30. * Math.PI / 12.;
		double m = tmp2 / 30. * Math.PI + tmp1 / 6. * Math.PI * 12.;
		double rad = h - m;
		// System.out.println(rad / Math.PI / 2. * 360.);
		double res = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - (2. * a * b * Math.cos(rad)));
		System.out.println(res);
	}

}