import java.util.Scanner;


public class Main {


//	final int MOD = 1000000007;

//	public static int min = 3000000;

	public static void main(String[] args) {

		double ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();

//		String s = sc.next();

//		long k = sc.nextLong();

//		int[] a = new int[n];
//		for (int i = 0; i < n; i++) {
//			a[i] = sc.nextInt();
//		}

//		String s = sc.next();

//		int[] ans = new int[n];

//		ArrayList<Integer> list = new ArrayList<>();

		//-------------------------------------------------------------------------------------

//		if(h == m && h == 0) {
//			ans = 0;
//		} else {
			double ak = (30 *  h) + (0.5 * m);
			double bk = 6 * m;
			double kakudo = Math.abs(ak - bk);
			System.err.println(kakudo);
			ak = a * a;
			bk = b * b;
			double tmp = 2 * a * b * Math.cos(Math.toRadians(kakudo));
			ans = ak + bk - tmp;
			System.err.println(tmp);
			ans = Math.sqrt(ans);
//		}

		//-------------------------------------------------------------------------------------

//		if(!f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	}



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


//	final int MOD = 1000000007;

//	public static int min = 3000000;

	public static void main(String[] args) {

		double ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();

//		String s = sc.next();

//		long k = sc.nextLong();

//		int[] a = new int[n];
//		for (int i = 0; i < n; i++) {
//			a[i] = sc.nextInt();
//		}

//		String s = sc.next();

//		int[] ans = new int[n];

//		ArrayList<Integer> list = new ArrayList<>();

		//-------------------------------------------------------------------------------------

//		if(h == m && h == 0) {
//			ans = 0;
//		} else {
			double ak = (30 *  h) + (0.5 * m);
			double bk = 6 * m;
			double kakudo = Math.abs(ak - bk);
			System.err.println(kakudo);
			ak = a * a;
			bk = b * b;
			double tmp = 2 * a * b * Math.cos(Math.toRadians(kakudo));
			ans = ak + bk - tmp;
			System.err.println(tmp);
			ans = Math.sqrt(ans);
//		}

		//-------------------------------------------------------------------------------------

//		if(!f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	}



} Main public static void main(String[] args) {

		double ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();

//		String s = sc.next();

//		long k = sc.nextLong();

//		int[] a = new int[n];
//		for (int i = 0; i < n; i++) {
//			a[i] = sc.nextInt();
//		}

//		String s = sc.next();

//		int[] ans = new int[n];

//		ArrayList<Integer> list = new ArrayList<>();

		//-------------------------------------------------------------------------------------

//		if(h == m && h == 0) {
//			ans = 0;
//		} else {
			double ak = (30 *  h) + (0.5 * m);
			double bk = 6 * m;
			double kakudo = Math.abs(ak - bk);
			System.err.println(kakudo);
			ak = a * a;
			bk = b * b;
			double tmp = 2 * a * b * Math.cos(Math.toRadians(kakudo));
			ans = ak + bk - tmp;
			System.err.println(tmp);
			ans = Math.sqrt(ans);
//		}

		//-------------------------------------------------------------------------------------

//		if(!f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	} main {

		double ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();

//		String s = sc.next();

//		long k = sc.nextLong();

//		int[] a = new int[n];
//		for (int i = 0; i < n; i++) {
//			a[i] = sc.nextInt();
//		}

//		String s = sc.next();

//		int[] ans = new int[n];

//		ArrayList<Integer> list = new ArrayList<>();

		//-------------------------------------------------------------------------------------

//		if(h == m && h == 0) {
//			ans = 0;
//		} else {
			double ak = (30 *  h) + (0.5 * m);
			double bk = 6 * m;
			double kakudo = Math.abs(ak - bk);
			System.err.println(kakudo);
			ak = a * a;
			bk = b * b;
			double tmp = 2 * a * b * Math.cos(Math.toRadians(kakudo));
			ans = ak + bk - tmp;
			System.err.println(tmp);
			ans = Math.sqrt(ans);
//		}

		//-------------------------------------------------------------------------------------

//		if(!f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	} double ans = 0; ans 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) boolean f = false; f false double a = sc.nextDouble(); a sc.nextDouble() sc.nextDouble sc double b = sc.nextDouble(); b sc.nextDouble() sc.nextDouble sc double h = sc.nextDouble(); h sc.nextDouble() sc.nextDouble sc double m = sc.nextDouble(); m sc.nextDouble() sc.nextDouble sc double ak = (30 *  h) + (0.5 * m); ak (30 *  h) + (0.5 * m) (30 *  h) 30 h (0.5 * m) 0.5 m double bk = 6 * m; bk 6 * m 6 m double kakudo = Math.abs(ak - bk); kakudo Math.abs(ak - bk) Math.abs Math ak - bk ak bk System.err.println(kakudo) System.err.println System.err System System.err kakudo ak = a * a ak a * a a a bk = b * b bk b * b b b double tmp = 2 * a * b * Math.cos(Math.toRadians(kakudo)); tmp 2 * a * b * Math.cos(Math.toRadians(kakudo)) b 2 * a * b * Math.cos(Math.toRadians(kakudo)) 2 a b Math.cos(Math.toRadians(kakudo)) Math.cos Math Math.toRadians(kakudo) Math.toRadians Math kakudo ans = ak + bk - tmp ans ak + bk - tmp ak + bk ak bk tmp System.err.println(tmp) System.err.println System.err System System.err tmp ans = Math.sqrt(ans) ans Math.sqrt(ans) Math.sqrt Math ans System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {


//	final int MOD = 1000000007;

//	public static int min = 3000000;

	public static void main(String[] args) {

		double ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();

//		String s = sc.next();

//		long k = sc.nextLong();

//		int[] a = new int[n];
//		for (int i = 0; i < n; i++) {
//			a[i] = sc.nextInt();
//		}

//		String s = sc.next();

//		int[] ans = new int[n];

//		ArrayList<Integer> list = new ArrayList<>();

		//-------------------------------------------------------------------------------------

//		if(h == m && h == 0) {
//			ans = 0;
//		} else {
			double ak = (30 *  h) + (0.5 * m);
			double bk = 6 * m;
			double kakudo = Math.abs(ak - bk);
			System.err.println(kakudo);
			ak = a * a;
			bk = b * b;
			double tmp = 2 * a * b * Math.cos(Math.toRadians(kakudo));
			ans = ak + bk - tmp;
			System.err.println(tmp);
			ans = Math.sqrt(ans);
//		}

		//-------------------------------------------------------------------------------------

//		if(!f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	}



} public class Main {


//	final int MOD = 1000000007;

//	public static int min = 3000000;

	public static void main(String[] args) {

		double ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();

//		String s = sc.next();

//		long k = sc.nextLong();

//		int[] a = new int[n];
//		for (int i = 0; i < n; i++) {
//			a[i] = sc.nextInt();
//		}

//		String s = sc.next();

//		int[] ans = new int[n];

//		ArrayList<Integer> list = new ArrayList<>();

		//-------------------------------------------------------------------------------------

//		if(h == m && h == 0) {
//			ans = 0;
//		} else {
			double ak = (30 *  h) + (0.5 * m);
			double bk = 6 * m;
			double kakudo = Math.abs(ak - bk);
			System.err.println(kakudo);
			ak = a * a;
			bk = b * b;
			double tmp = 2 * a * b * Math.cos(Math.toRadians(kakudo));
			ans = ak + bk - tmp;
			System.err.println(tmp);
			ans = Math.sqrt(ans);
//		}

		//-------------------------------------------------------------------------------------

//		if(!f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	}



} Main
import java.util.Scanner;


public class Main {


//	final int MOD = 1000000007;

//	public static int min = 3000000;

	public static void main(String[] args) {

		double ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();

//		String s = sc.next();

//		long k = sc.nextLong();

//		int[] a = new int[n];
//		for (int i = 0; i < n; i++) {
//			a[i] = sc.nextInt();
//		}

//		String s = sc.next();

//		int[] ans = new int[n];

//		ArrayList<Integer> list = new ArrayList<>();

		//-------------------------------------------------------------------------------------

//		if(h == m && h == 0) {
//			ans = 0;
//		} else {
			double ak = (30 *  h) + (0.5 * m);
			double bk = 6 * m;
			double kakudo = Math.abs(ak - bk);
			System.err.println(kakudo);
			ak = a * a;
			bk = b * b;
			double tmp = 2 * a * b * Math.cos(Math.toRadians(kakudo));
			ans = ak + bk - tmp;
			System.err.println(tmp);
			ans = Math.sqrt(ans);
//		}

		//-------------------------------------------------------------------------------------

//		if(!f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

		System.out.println(ans);

		sc.close();
	}



}