import java.util.Scanner;

public class Main {
	static Scanner src = new Scanner(System.in);
	public static void main(String[] args) {
		int a = src.nextInt();
		int b = src.nextInt();
		int h = src.nextInt();
		int m = src.nextInt();
		double radmH = (360.0/12.0)/60.0; // rad / min
		double radmM = (360/60);

		double c = (30.0 / 60.0)*m;
		double hx = a * Math.cos(Math.toRadians(radmH*h*60 + c));// hにおける1分あたりの角速度
		double hy = a * Math.sin(Math.toRadians(radmH*h*60 + c));
		double mx = b * Math.cos(Math.toRadians(radmM*m));		// mにおける1分あたりの角速度
		double my = b * Math.sin(Math.toRadians(radmM*m));
		double dist = Math.sqrt(Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0));
		System.out.println(dist);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	static Scanner src = new Scanner(System.in);
	public static void main(String[] args) {
		int a = src.nextInt();
		int b = src.nextInt();
		int h = src.nextInt();
		int m = src.nextInt();
		double radmH = (360.0/12.0)/60.0; // rad / min
		double radmM = (360/60);

		double c = (30.0 / 60.0)*m;
		double hx = a * Math.cos(Math.toRadians(radmH*h*60 + c));// hにおける1分あたりの角速度
		double hy = a * Math.sin(Math.toRadians(radmH*h*60 + c));
		double mx = b * Math.cos(Math.toRadians(radmM*m));		// mにおける1分あたりの角速度
		double my = b * Math.sin(Math.toRadians(radmM*m));
		double dist = Math.sqrt(Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0));
		System.out.println(dist);
	}
} Main static Scanner src = new Scanner(System.in); src new Scanner(System.in) public static void main(String[] args) {
		int a = src.nextInt();
		int b = src.nextInt();
		int h = src.nextInt();
		int m = src.nextInt();
		double radmH = (360.0/12.0)/60.0; // rad / min
		double radmM = (360/60);

		double c = (30.0 / 60.0)*m;
		double hx = a * Math.cos(Math.toRadians(radmH*h*60 + c));// hにおける1分あたりの角速度
		double hy = a * Math.sin(Math.toRadians(radmH*h*60 + c));
		double mx = b * Math.cos(Math.toRadians(radmM*m));		// mにおける1分あたりの角速度
		double my = b * Math.sin(Math.toRadians(radmM*m));
		double dist = Math.sqrt(Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0));
		System.out.println(dist);
	} main {
		int a = src.nextInt();
		int b = src.nextInt();
		int h = src.nextInt();
		int m = src.nextInt();
		double radmH = (360.0/12.0)/60.0; // rad / min
		double radmM = (360/60);

		double c = (30.0 / 60.0)*m;
		double hx = a * Math.cos(Math.toRadians(radmH*h*60 + c));// hにおける1分あたりの角速度
		double hy = a * Math.sin(Math.toRadians(radmH*h*60 + c));
		double mx = b * Math.cos(Math.toRadians(radmM*m));		// mにおける1分あたりの角速度
		double my = b * Math.sin(Math.toRadians(radmM*m));
		double dist = Math.sqrt(Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0));
		System.out.println(dist);
	} int a = src.nextInt(); a src.nextInt() src.nextInt src int b = src.nextInt(); b src.nextInt() src.nextInt src int h = src.nextInt(); h src.nextInt() src.nextInt src int m = src.nextInt(); m src.nextInt() src.nextInt src double radmH = (360.0/12.0)/60.0; radmH (360.0/12.0)/60.0 (360.0/12.0) 360.0 12.0 60.0 double radmM = (360/60); radmM (360/60) 360 60 double c = (30.0 / 60.0)*m; c (30.0 / 60.0)*m (30.0 / 60.0) 30.0 60.0 m double hx = a * Math.cos(Math.toRadians(radmH*h*60 + c)); hx a * Math.cos(Math.toRadians(radmH*h*60 + c)) a Math.cos(Math.toRadians(radmH*h*60 + c)) Math.cos Math Math.toRadians(radmH*h*60 + c) Math.toRadians Math radmH*h*60 + c radmH*h*60 radmH*h*60 radmH h 60 c double hy = a * Math.sin(Math.toRadians(radmH*h*60 + c)); hy a * Math.sin(Math.toRadians(radmH*h*60 + c)) a Math.sin(Math.toRadians(radmH*h*60 + c)) Math.sin Math Math.toRadians(radmH*h*60 + c) Math.toRadians Math radmH*h*60 + c radmH*h*60 radmH*h*60 radmH h 60 c double mx = b * Math.cos(Math.toRadians(radmM*m)); mx b * Math.cos(Math.toRadians(radmM*m)) b Math.cos(Math.toRadians(radmM*m)) Math.cos Math Math.toRadians(radmM*m) Math.toRadians Math radmM*m radmM m double my = b * Math.sin(Math.toRadians(radmM*m)); my b * Math.sin(Math.toRadians(radmM*m)) b Math.sin(Math.toRadians(radmM*m)) Math.sin Math Math.toRadians(radmM*m) Math.toRadians Math radmM*m radmM m double dist = Math.sqrt(Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0)); dist Math.sqrt(Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0)) Math.sqrt Math Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0) Math.pow((hx - mx), 2.0) Math.pow Math (hx - mx) hx mx 2.0 Math.pow(hy - my, 2.0) Math.pow Math hy - my hy my 2.0 System.out.println(dist) System.out.println System.out System System.out dist String[] args args public class Main {
	static Scanner src = new Scanner(System.in);
	public static void main(String[] args) {
		int a = src.nextInt();
		int b = src.nextInt();
		int h = src.nextInt();
		int m = src.nextInt();
		double radmH = (360.0/12.0)/60.0; // rad / min
		double radmM = (360/60);

		double c = (30.0 / 60.0)*m;
		double hx = a * Math.cos(Math.toRadians(radmH*h*60 + c));// hにおける1分あたりの角速度
		double hy = a * Math.sin(Math.toRadians(radmH*h*60 + c));
		double mx = b * Math.cos(Math.toRadians(radmM*m));		// mにおける1分あたりの角速度
		double my = b * Math.sin(Math.toRadians(radmM*m));
		double dist = Math.sqrt(Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0));
		System.out.println(dist);
	}
} public class Main {
	static Scanner src = new Scanner(System.in);
	public static void main(String[] args) {
		int a = src.nextInt();
		int b = src.nextInt();
		int h = src.nextInt();
		int m = src.nextInt();
		double radmH = (360.0/12.0)/60.0; // rad / min
		double radmM = (360/60);

		double c = (30.0 / 60.0)*m;
		double hx = a * Math.cos(Math.toRadians(radmH*h*60 + c));// hにおける1分あたりの角速度
		double hy = a * Math.sin(Math.toRadians(radmH*h*60 + c));
		double mx = b * Math.cos(Math.toRadians(radmM*m));		// mにおける1分あたりの角速度
		double my = b * Math.sin(Math.toRadians(radmM*m));
		double dist = Math.sqrt(Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0));
		System.out.println(dist);
	}
} Main
import java.util.Scanner;

public class Main {
	static Scanner src = new Scanner(System.in);
	public static void main(String[] args) {
		int a = src.nextInt();
		int b = src.nextInt();
		int h = src.nextInt();
		int m = src.nextInt();
		double radmH = (360.0/12.0)/60.0; // rad / min
		double radmM = (360/60);

		double c = (30.0 / 60.0)*m;
		double hx = a * Math.cos(Math.toRadians(radmH*h*60 + c));// hにおける1分あたりの角速度
		double hy = a * Math.sin(Math.toRadians(radmH*h*60 + c));
		double mx = b * Math.cos(Math.toRadians(radmM*m));		// mにおける1分あたりの角速度
		double my = b * Math.sin(Math.toRadians(radmM*m));
		double dist = Math.sqrt(Math.pow((hx - mx), 2.0) + Math.pow(hy - my, 2.0));
		System.out.println(dist);
	}
}