import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		//入力表示

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

		double rad = Math.PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0);

		double rsq = Math.sqrt((a * a + b * b) - (2 * a *
				b) * Math.cos(rad));

		System.out.printf("%.20f", rsq);

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		//入力表示

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

		double rad = Math.PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0);

		double rsq = Math.sqrt((a * a + b * b) - (2 * a *
				b) * Math.cos(rad));

		System.out.printf("%.20f", rsq);

	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		//入力表示

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

		double rad = Math.PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0);

		double rsq = Math.sqrt((a * a + b * b) - (2 * a *
				b) * Math.cos(rad));

		System.out.printf("%.20f", rsq);

	} main {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		//入力表示

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

		double rad = Math.PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0);

		double rsq = Math.sqrt((a * a + b * b) - (2 * a *
				b) * Math.cos(rad));

		System.out.printf("%.20f", rsq);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double a = sc.nextInt(); a sc.nextInt() sc.nextInt sc double b = sc.nextInt(); b sc.nextInt() sc.nextInt sc double h = sc.nextInt(); h sc.nextInt() sc.nextInt sc double m = sc.nextInt(); m sc.nextInt() sc.nextInt sc double rad = Math.PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0); rad Math.PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0) Math.PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0) Math.PI Math Math.PI 2 (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0) h / 12.0 + (m / 60.0) / 12.0 h / 12.0 h 12.0 (m / 60.0) / 12.0 (m / 60.0) m 60.0 12.0 m / 60.0 m 60.0 double rsq = Math.sqrt((a * a + b * b) - (2 * a *
				b) * Math.cos(rad)); rsq Math.sqrt((a * a + b * b) - (2 * a *
				b) * Math.cos(rad)) Math.sqrt Math (a * a + b * b) - (2 * a *
				b) * Math.cos(rad) (a * a + b * b) a * a a a b * b b b (2 * a *
				b) * Math.cos(rad) (2 * a *
				b) 2 * a *
				b 2 a b Math.cos(rad) Math.cos Math rad System.out.printf("%.20f", rsq) System.out.printf System.out System System.out "%.20f" rsq String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		//入力表示

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

		double rad = Math.PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0);

		double rsq = Math.sqrt((a * a + b * b) - (2 * a *
				b) * Math.cos(rad));

		System.out.printf("%.20f", rsq);

	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		//入力表示

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

		double rad = Math.PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0);

		double rsq = Math.sqrt((a * a + b * b) - (2 * a *
				b) * Math.cos(rad));

		System.out.printf("%.20f", rsq);

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		//入力表示

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

		double rad = Math.PI * 2 * (h / 12.0 + (m / 60.0) / 12.0 - m / 60.0);

		double rsq = Math.sqrt((a * a + b * b) - (2 * a *
				b) * Math.cos(rad));

		System.out.printf("%.20f", rsq);

	}
}