import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();
		int b = in.nextInt();
		int h = in.nextInt();
		int m = in.nextInt();

		double x1 = (double)a * Math.sin(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));
		double y1 = (double)a * Math.cos(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));

		double x2 = (double)b * Math.sin(2.0*Math.PI*(double)m/60.0);
		double y2 = (double)b * Math.cos(2.0*Math.PI*(double)m/60.0);

		System.out.println(Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)));
	}
}
 import java.io.*; io.* java import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();
		int b = in.nextInt();
		int h = in.nextInt();
		int m = in.nextInt();

		double x1 = (double)a * Math.sin(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));
		double y1 = (double)a * Math.cos(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));

		double x2 = (double)b * Math.sin(2.0*Math.PI*(double)m/60.0);
		double y2 = (double)b * Math.cos(2.0*Math.PI*(double)m/60.0);

		System.out.println(Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)));
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();
		int b = in.nextInt();
		int h = in.nextInt();
		int m = in.nextInt();

		double x1 = (double)a * Math.sin(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));
		double y1 = (double)a * Math.cos(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));

		double x2 = (double)b * Math.sin(2.0*Math.PI*(double)m/60.0);
		double y2 = (double)b * Math.cos(2.0*Math.PI*(double)m/60.0);

		System.out.println(Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)));
	} main {
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();
		int b = in.nextInt();
		int h = in.nextInt();
		int m = in.nextInt();

		double x1 = (double)a * Math.sin(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));
		double y1 = (double)a * Math.cos(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));

		double x2 = (double)b * Math.sin(2.0*Math.PI*(double)m/60.0);
		double y2 = (double)b * Math.cos(2.0*Math.PI*(double)m/60.0);

		System.out.println(Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)));
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int a = in.nextInt(); a in.nextInt() in.nextInt in int b = in.nextInt(); b in.nextInt() in.nextInt in int h = in.nextInt(); h in.nextInt() in.nextInt in int m = in.nextInt(); m in.nextInt() in.nextInt in double x1 = (double)a * Math.sin(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0)); x1 (double)a * Math.sin(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0)) (double)a Math.sin(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0)) Math.sin Math 2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0) 2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0) 2.0 Math.PI Math Math.PI ((double)h/12.0 + (double)m/60.0/12.0) (double)h/12.0 (double)h 12.0 (double)m/60.0/12.0 (double)m/60.0/12.0 (double)m 60.0 12.0 double y1 = (double)a * Math.cos(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0)); y1 (double)a * Math.cos(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0)) (double)a Math.cos(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0)) Math.cos Math 2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0) 2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0) 2.0 Math.PI Math Math.PI ((double)h/12.0 + (double)m/60.0/12.0) (double)h/12.0 (double)h 12.0 (double)m/60.0/12.0 (double)m/60.0/12.0 (double)m 60.0 12.0 double x2 = (double)b * Math.sin(2.0*Math.PI*(double)m/60.0); x2 (double)b * Math.sin(2.0*Math.PI*(double)m/60.0) (double)b Math.sin(2.0*Math.PI*(double)m/60.0) Math.sin Math 2.0*Math.PI*(double)m/60.0 2.0*Math.PI*(double)m 2.0*Math.PI*(double)m 2.0 Math.PI Math Math.PI (double)m 60.0 double y2 = (double)b * Math.cos(2.0*Math.PI*(double)m/60.0); y2 (double)b * Math.cos(2.0*Math.PI*(double)m/60.0) (double)b Math.cos(2.0*Math.PI*(double)m/60.0) Math.cos Math 2.0*Math.PI*(double)m/60.0 2.0*Math.PI*(double)m 2.0*Math.PI*(double)m 2.0 Math.PI Math Math.PI (double)m 60.0 System.out.println(Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))) System.out.println System.out System System.out Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)) Math.sqrt Math (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) (x2-x1)*(x2-x1) (x2-x1) x2 x1 (x2-x1) x2 x1 (y2-y1)*(y2-y1) (y2-y1) y2 y1 (y2-y1) y2 y1 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();
		int b = in.nextInt();
		int h = in.nextInt();
		int m = in.nextInt();

		double x1 = (double)a * Math.sin(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));
		double y1 = (double)a * Math.cos(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));

		double x2 = (double)b * Math.sin(2.0*Math.PI*(double)m/60.0);
		double y2 = (double)b * Math.cos(2.0*Math.PI*(double)m/60.0);

		System.out.println(Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();
		int b = in.nextInt();
		int h = in.nextInt();
		int m = in.nextInt();

		double x1 = (double)a * Math.sin(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));
		double y1 = (double)a * Math.cos(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));

		double x2 = (double)b * Math.sin(2.0*Math.PI*(double)m/60.0);
		double y2 = (double)b * Math.cos(2.0*Math.PI*(double)m/60.0);

		System.out.println(Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)));
	}
} Main
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();
		int b = in.nextInt();
		int h = in.nextInt();
		int m = in.nextInt();

		double x1 = (double)a * Math.sin(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));
		double y1 = (double)a * Math.cos(2.0*Math.PI*((double)h/12.0 + (double)m/60.0/12.0));

		double x2 = (double)b * Math.sin(2.0*Math.PI*(double)m/60.0);
		double y2 = (double)b * Math.cos(2.0*Math.PI*(double)m/60.0);

		System.out.println(Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)));
	}
}

