import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int len = (int)1e6 + 1;

	void doIt() {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int H = sc.nextInt();
		int M = sc.nextInt();
		double argA = Math.PI * (double)H / 6.0 + Math.PI * (double)M / 6.0 / 60.0;
		double argB = Math.PI * (double)M / 30.0;
		double Ax = A * Math.cos(argA);
		double Ay = A * Math.sin(argA);
		double Bx = B * Math.cos(argB);
		double By = B * Math.sin(argB);
		double ans = Math.sqrt((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By));
		System.out.println(ans);
	}

	
	
	public static void main(String[] args) {
		new Main().doIt();
	}

} import java.util.*; util.* java public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int len = (int)1e6 + 1;

	void doIt() {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int H = sc.nextInt();
		int M = sc.nextInt();
		double argA = Math.PI * (double)H / 6.0 + Math.PI * (double)M / 6.0 / 60.0;
		double argB = Math.PI * (double)M / 30.0;
		double Ax = A * Math.cos(argA);
		double Ay = A * Math.sin(argA);
		double Bx = B * Math.cos(argB);
		double By = B * Math.sin(argB);
		double ans = Math.sqrt((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By));
		System.out.println(ans);
	}

	
	
	public static void main(String[] args) {
		new Main().doIt();
	}

} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int MOD = 1000000007; MOD 1000000007 final int MAX = Integer.MAX_VALUE; MAX Integer.MAX_VALUE Integer Integer.MAX_VALUE final long LMAX = Long.MAX_VALUE; LMAX Long.MAX_VALUE Long Long.MAX_VALUE int len = (int)1e6 + 1; len (int)1e6 + 1 (int)1e6 1 void doIt() {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int H = sc.nextInt();
		int M = sc.nextInt();
		double argA = Math.PI * (double)H / 6.0 + Math.PI * (double)M / 6.0 / 60.0;
		double argB = Math.PI * (double)M / 30.0;
		double Ax = A * Math.cos(argA);
		double Ay = A * Math.sin(argA);
		double Bx = B * Math.cos(argB);
		double By = B * Math.sin(argB);
		double ans = Math.sqrt((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By));
		System.out.println(ans);
	} doIt {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int H = sc.nextInt();
		int M = sc.nextInt();
		double argA = Math.PI * (double)H / 6.0 + Math.PI * (double)M / 6.0 / 60.0;
		double argB = Math.PI * (double)M / 30.0;
		double Ax = A * Math.cos(argA);
		double Ay = A * Math.sin(argA);
		double Bx = B * Math.cos(argB);
		double By = B * Math.sin(argB);
		double ans = Math.sqrt((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By));
		System.out.println(ans);
	} int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int H = sc.nextInt(); H sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc double argA = Math.PI * (double)H / 6.0 + Math.PI * (double)M / 6.0 / 60.0; argA Math.PI * (double)H / 6.0 + Math.PI * (double)M / 6.0 / 60.0 Math.PI * (double)H / 6.0 Math.PI * (double)H Math.PI Math Math.PI (double)H 6.0 Math.PI * (double)M / 6.0 / 60.0 Math.PI * (double)M / 6.0 / 60.0 Math.PI * (double)M Math.PI Math Math.PI (double)M 6.0 60.0 double argB = Math.PI * (double)M / 30.0; argB Math.PI * (double)M / 30.0 Math.PI * (double)M Math.PI Math Math.PI (double)M 30.0 double Ax = A * Math.cos(argA); Ax A * Math.cos(argA) A Math.cos(argA) Math.cos Math argA double Ay = A * Math.sin(argA); Ay A * Math.sin(argA) A Math.sin(argA) Math.sin Math argA double Bx = B * Math.cos(argB); Bx B * Math.cos(argB) B Math.cos(argB) Math.cos Math argB double By = B * Math.sin(argB); By B * Math.sin(argB) B Math.sin(argB) Math.sin Math argB double ans = Math.sqrt((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By)); ans Math.sqrt((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By)) Math.sqrt Math (Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By) (Ax - Bx) * (Ax - Bx) (Ax - Bx) Ax Bx (Ax - Bx) Ax Bx (Ay - By) * (Ay - By) (Ay - By) Ay By (Ay - By) Ay By System.out.println(ans) System.out.println System.out System System.out ans public static void main(String[] args) {
		new Main().doIt();
	} main {
		new Main().doIt();
	} new Main().doIt() new Main().doIt new Main() String[] args args public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int len = (int)1e6 + 1;

	void doIt() {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int H = sc.nextInt();
		int M = sc.nextInt();
		double argA = Math.PI * (double)H / 6.0 + Math.PI * (double)M / 6.0 / 60.0;
		double argB = Math.PI * (double)M / 30.0;
		double Ax = A * Math.cos(argA);
		double Ay = A * Math.sin(argA);
		double Bx = B * Math.cos(argB);
		double By = B * Math.sin(argB);
		double ans = Math.sqrt((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By));
		System.out.println(ans);
	}

	
	
	public static void main(String[] args) {
		new Main().doIt();
	}

} public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int len = (int)1e6 + 1;

	void doIt() {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int H = sc.nextInt();
		int M = sc.nextInt();
		double argA = Math.PI * (double)H / 6.0 + Math.PI * (double)M / 6.0 / 60.0;
		double argB = Math.PI * (double)M / 30.0;
		double Ax = A * Math.cos(argA);
		double Ay = A * Math.sin(argA);
		double Bx = B * Math.cos(argB);
		double By = B * Math.sin(argB);
		double ans = Math.sqrt((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By));
		System.out.println(ans);
	}

	
	
	public static void main(String[] args) {
		new Main().doIt();
	}

} Main
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int len = (int)1e6 + 1;

	void doIt() {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int H = sc.nextInt();
		int M = sc.nextInt();
		double argA = Math.PI * (double)H / 6.0 + Math.PI * (double)M / 6.0 / 60.0;
		double argB = Math.PI * (double)M / 30.0;
		double Ax = A * Math.cos(argA);
		double Ay = A * Math.sin(argA);
		double Bx = B * Math.cos(argB);
		double By = B * Math.sin(argB);
		double ans = Math.sqrt((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By));
		System.out.println(ans);
	}

	
	
	public static void main(String[] args) {
		new Main().doIt();
	}

}
