import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int hour = scan.nextInt();
		int minute = scan.nextInt();

		double rad = Math.PI*2*((double)hour/12.0 + ((double)minute/60.0)/12.0 - (double)minute/60.0);
		double len = (double)(b*b + a*a) - (double)(2*b*a)*Math.cos(rad);

		System.out.printf("%.20f",Math.sqrt(len));
		scan.close();

	}

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int hour = scan.nextInt();
		int minute = scan.nextInt();

		double rad = Math.PI*2*((double)hour/12.0 + ((double)minute/60.0)/12.0 - (double)minute/60.0);
		double len = (double)(b*b + a*a) - (double)(2*b*a)*Math.cos(rad);

		System.out.printf("%.20f",Math.sqrt(len));
		scan.close();

	}

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

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int hour = scan.nextInt();
		int minute = scan.nextInt();

		double rad = Math.PI*2*((double)hour/12.0 + ((double)minute/60.0)/12.0 - (double)minute/60.0);
		double len = (double)(b*b + a*a) - (double)(2*b*a)*Math.cos(rad);

		System.out.printf("%.20f",Math.sqrt(len));
		scan.close();

	} main {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int hour = scan.nextInt();
		int minute = scan.nextInt();

		double rad = Math.PI*2*((double)hour/12.0 + ((double)minute/60.0)/12.0 - (double)minute/60.0);
		double len = (double)(b*b + a*a) - (double)(2*b*a)*Math.cos(rad);

		System.out.printf("%.20f",Math.sqrt(len));
		scan.close();

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int hour = scan.nextInt();
		int minute = scan.nextInt();

		double rad = Math.PI*2*((double)hour/12.0 + ((double)minute/60.0)/12.0 - (double)minute/60.0);
		double len = (double)(b*b + a*a) - (double)(2*b*a)*Math.cos(rad);

		System.out.printf("%.20f",Math.sqrt(len));
		scan.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int hour = scan.nextInt();
		int minute = scan.nextInt();

		double rad = Math.PI*2*((double)hour/12.0 + ((double)minute/60.0)/12.0 - (double)minute/60.0);
		double len = (double)(b*b + a*a) - (double)(2*b*a)*Math.cos(rad);

		System.out.printf("%.20f",Math.sqrt(len));
		scan.close();

	}

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int hour = scan.nextInt();
		int minute = scan.nextInt();

		double rad = Math.PI*2*((double)hour/12.0 + ((double)minute/60.0)/12.0 - (double)minute/60.0);
		double len = (double)(b*b + a*a) - (double)(2*b*a)*Math.cos(rad);

		System.out.printf("%.20f",Math.sqrt(len));
		scan.close();

	}

}
