import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();
		final double PI = Math.PI;
		double ht = ((h*60+m)/720 )*2*PI;
		double mt = (m/60)*2*PI;
		double hx = a*Math.cos(ht);
		double hy = a*Math.sin(ht);
		double mx = b*Math.cos(mt);
		double my = b*Math.sin(mt);
		
		double dx = hx-mx;
		double dy = hy-my;

		double ans = Math.sqrt(dx*dx+dy*dy);
		System.out.printf("%.10f", ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();
		final double PI = Math.PI;
		double ht = ((h*60+m)/720 )*2*PI;
		double mt = (m/60)*2*PI;
		double hx = a*Math.cos(ht);
		double hy = a*Math.sin(ht);
		double mx = b*Math.cos(mt);
		double my = b*Math.sin(mt);
		
		double dx = hx-mx;
		double dy = hy-my;

		double ans = Math.sqrt(dx*dx+dy*dy);
		System.out.printf("%.10f", ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();
		final double PI = Math.PI;
		double ht = ((h*60+m)/720 )*2*PI;
		double mt = (m/60)*2*PI;
		double hx = a*Math.cos(ht);
		double hy = a*Math.sin(ht);
		double mx = b*Math.cos(mt);
		double my = b*Math.sin(mt);
		
		double dx = hx-mx;
		double dy = hy-my;

		double ans = Math.sqrt(dx*dx+dy*dy);
		System.out.printf("%.10f", ans);
	} main {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();
		final double PI = Math.PI;
		double ht = ((h*60+m)/720 )*2*PI;
		double mt = (m/60)*2*PI;
		double hx = a*Math.cos(ht);
		double hy = a*Math.sin(ht);
		double mx = b*Math.cos(mt);
		double my = b*Math.sin(mt);
		
		double dx = hx-mx;
		double dy = hy-my;

		double ans = Math.sqrt(dx*dx+dy*dy);
		System.out.printf("%.10f", ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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 final double PI = Math.PI; PI Math.PI Math Math.PI double ht = ((h*60+m)/720 )*2*PI; ht ((h*60+m)/720 )*2*PI ((h*60+m)/720 )*2*PI ((h*60+m)/720 ) (h*60+m) h*60 h 60 m 720 2 PI double mt = (m/60)*2*PI; mt (m/60)*2*PI (m/60)*2*PI (m/60) m 60 2 PI double hx = a*Math.cos(ht); hx a*Math.cos(ht) a Math.cos(ht) Math.cos Math ht double hy = a*Math.sin(ht); hy a*Math.sin(ht) a Math.sin(ht) Math.sin Math ht double mx = b*Math.cos(mt); mx b*Math.cos(mt) b Math.cos(mt) Math.cos Math mt double my = b*Math.sin(mt); my b*Math.sin(mt) b Math.sin(mt) Math.sin Math mt double dx = hx-mx; dx hx-mx hx mx double dy = hy-my; dy hy-my hy my double ans = Math.sqrt(dx*dx+dy*dy); ans Math.sqrt(dx*dx+dy*dy) Math.sqrt Math dx*dx+dy*dy dx*dx dx dx dy*dy dy dy System.out.printf("%.10f", ans) System.out.printf System.out System System.out "%.10f" ans String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();
		final double PI = Math.PI;
		double ht = ((h*60+m)/720 )*2*PI;
		double mt = (m/60)*2*PI;
		double hx = a*Math.cos(ht);
		double hy = a*Math.sin(ht);
		double mx = b*Math.cos(mt);
		double my = b*Math.sin(mt);
		
		double dx = hx-mx;
		double dy = hy-my;

		double ans = Math.sqrt(dx*dx+dy*dy);
		System.out.printf("%.10f", ans);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();
		final double PI = Math.PI;
		double ht = ((h*60+m)/720 )*2*PI;
		double mt = (m/60)*2*PI;
		double hx = a*Math.cos(ht);
		double hy = a*Math.sin(ht);
		double mx = b*Math.cos(mt);
		double my = b*Math.sin(mt);
		
		double dx = hx-mx;
		double dy = hy-my;

		double ans = Math.sqrt(dx*dx+dy*dy);
		System.out.printf("%.10f", ans);
	}
} Main
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();
		final double PI = Math.PI;
		double ht = ((h*60+m)/720 )*2*PI;
		double mt = (m/60)*2*PI;
		double hx = a*Math.cos(ht);
		double hy = a*Math.sin(ht);
		double mx = b*Math.cos(mt);
		double my = b*Math.sin(mt);
		
		double dx = hx-mx;
		double dy = hy-my;

		double ans = Math.sqrt(dx*dx+dy*dy);
		System.out.printf("%.10f", ans);
	}
}
