import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int h = Integer.parseInt(str[2]);
		int m = Integer.parseInt(str[3]);

		double mk = (double) (m * 360) / 60;
		double hk = (double) (h * 60 + m) * 360 / (12 * 60);

		double sita = Math.abs(mk - hk);
		double cos = Math.cos((double) sita / 180 * Math.PI);

		double naiseki = a * b * cos;
		double ans = a * a + b * b - 2 * naiseki;

		System.out.println(Math.sqrt(ans));
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int h = Integer.parseInt(str[2]);
		int m = Integer.parseInt(str[3]);

		double mk = (double) (m * 360) / 60;
		double hk = (double) (h * 60 + m) * 360 / (12 * 60);

		double sita = Math.abs(mk - hk);
		double cos = Math.cos((double) sita / 180 * Math.PI);

		double naiseki = a * b * cos;
		double ans = a * a + b * b - 2 * naiseki;

		System.out.println(Math.sqrt(ans));
	}
} Main public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int h = Integer.parseInt(str[2]);
		int m = Integer.parseInt(str[3]);

		double mk = (double) (m * 360) / 60;
		double hk = (double) (h * 60 + m) * 360 / (12 * 60);

		double sita = Math.abs(mk - hk);
		double cos = Math.cos((double) sita / 180 * Math.PI);

		double naiseki = a * b * cos;
		double ans = a * a + b * b - 2 * naiseki;

		System.out.println(Math.sqrt(ans));
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int h = Integer.parseInt(str[2]);
		int m = Integer.parseInt(str[3]);

		double mk = (double) (m * 360) / 60;
		double hk = (double) (h * 60 + m) * 360 / (12 * 60);

		double sita = Math.abs(mk - hk);
		double cos = Math.cos((double) sita / 180 * Math.PI);

		double naiseki = a * b * cos;
		double ans = a * a + b * b - 2 * naiseki;

		System.out.println(Math.sqrt(ans));
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str[] = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int a = Integer.parseInt(str[0]); a Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int b = Integer.parseInt(str[1]); b Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 int h = Integer.parseInt(str[2]); h Integer.parseInt(str[2]) Integer.parseInt Integer str[2] str 2 int m = Integer.parseInt(str[3]); m Integer.parseInt(str[3]) Integer.parseInt Integer str[3] str 3 double mk = (double) (m * 360) / 60; mk (double) (m * 360) / 60 (double) (m * 360) m 360 60 double hk = (double) (h * 60 + m) * 360 / (12 * 60); hk (double) (h * 60 + m) * 360 / (12 * 60) (double) (h * 60 + m) * 360 (double) (h * 60 + m) h * 60 h 60 m 360 (12 * 60) 12 60 double sita = Math.abs(mk - hk); sita Math.abs(mk - hk) Math.abs Math mk - hk mk hk double cos = Math.cos((double) sita / 180 * Math.PI); cos Math.cos((double) sita / 180 * Math.PI) Math.cos Math (double) sita / 180 * Math.PI (double) sita / 180 (double) sita 180 Math.PI Math Math.PI double naiseki = a * b * cos; naiseki a * b * cos a * b * cos a b cos double ans = a * a + b * b - 2 * naiseki; ans a * a + b * b - 2 * naiseki a * a + b * b a * a a a b * b b b 2 * naiseki 2 naiseki System.out.println(Math.sqrt(ans)) System.out.println System.out System System.out Math.sqrt(ans) Math.sqrt Math ans String args[] args public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int h = Integer.parseInt(str[2]);
		int m = Integer.parseInt(str[3]);

		double mk = (double) (m * 360) / 60;
		double hk = (double) (h * 60 + m) * 360 / (12 * 60);

		double sita = Math.abs(mk - hk);
		double cos = Math.cos((double) sita / 180 * Math.PI);

		double naiseki = a * b * cos;
		double ans = a * a + b * b - 2 * naiseki;

		System.out.println(Math.sqrt(ans));
	}
} public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int h = Integer.parseInt(str[2]);
		int m = Integer.parseInt(str[3]);

		double mk = (double) (m * 360) / 60;
		double hk = (double) (h * 60 + m) * 360 / (12 * 60);

		double sita = Math.abs(mk - hk);
		double cos = Math.cos((double) sita / 180 * Math.PI);

		double naiseki = a * b * cos;
		double ans = a * a + b * b - 2 * naiseki;

		System.out.println(Math.sqrt(ans));
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int h = Integer.parseInt(str[2]);
		int m = Integer.parseInt(str[3]);

		double mk = (double) (m * 360) / 60;
		double hk = (double) (h * 60 + m) * 360 / (12 * 60);

		double sita = Math.abs(mk - hk);
		double cos = Math.cos((double) sita / 180 * Math.PI);

		double naiseki = a * b * cos;
		double ans = a * a + b * b - 2 * naiseki;

		System.out.println(Math.sqrt(ans));
	}
}
