
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int A = Integer.parseInt(tokens[0]);
		int B = Integer.parseInt(tokens[1]);
		int H = Integer.parseInt(tokens[2]);
		int M = Integer.parseInt(tokens[3]);

		int totalMin = 60 * H + M;
		double hourRatio = (double) totalMin / (double) (12 * 60);
		double hourX = (double) A * Math.sin(2. * Math.PI * hourRatio);
		double hourY = (double) A * Math.cos(2. * Math.PI * hourRatio);

		double minuteRatio = (double) M / (double) 60;
		double minuteX = (double) B * Math.sin(2. * Math.PI * minuteRatio);
		double minuteY = (double) B * Math.cos(2. * Math.PI * minuteRatio);
		double distance = Math.sqrt(Math.pow(hourX - minuteX, 2.0) + Math.pow(hourY - minuteY, 2.0));
		System.out.println(distance);
	}

	void calc() {
	}

	void showResult() {
	}

} import java.util.*; util.* java import java.io.*; io.* java import java.nio.charset.StandardCharsets; StandardCharsets java.nio.charset public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int A = Integer.parseInt(tokens[0]);
		int B = Integer.parseInt(tokens[1]);
		int H = Integer.parseInt(tokens[2]);
		int M = Integer.parseInt(tokens[3]);

		int totalMin = 60 * H + M;
		double hourRatio = (double) totalMin / (double) (12 * 60);
		double hourX = (double) A * Math.sin(2. * Math.PI * hourRatio);
		double hourY = (double) A * Math.cos(2. * Math.PI * hourRatio);

		double minuteRatio = (double) M / (double) 60;
		double minuteX = (double) B * Math.sin(2. * Math.PI * minuteRatio);
		double minuteY = (double) B * Math.cos(2. * Math.PI * minuteRatio);
		double distance = Math.sqrt(Math.pow(hourX - minuteX, 2.0) + Math.pow(hourY - minuteY, 2.0));
		System.out.println(distance);
	}

	void calc() {
	}

	void showResult() {
	}

} Main public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	} main {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	} InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); reader new InputStreamReader(System.in, StandardCharsets.UTF_8) BufferedReader in = new BufferedReader(reader); in new BufferedReader(reader) Main ins = new Main(in); ins new Main(in) ins.calc() ins.calc ins ins.showResult() ins.showResult ins String[] args args Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int A = Integer.parseInt(tokens[0]);
		int B = Integer.parseInt(tokens[1]);
		int H = Integer.parseInt(tokens[2]);
		int M = Integer.parseInt(tokens[3]);

		int totalMin = 60 * H + M;
		double hourRatio = (double) totalMin / (double) (12 * 60);
		double hourX = (double) A * Math.sin(2. * Math.PI * hourRatio);
		double hourY = (double) A * Math.cos(2. * Math.PI * hourRatio);

		double minuteRatio = (double) M / (double) 60;
		double minuteX = (double) B * Math.sin(2. * Math.PI * minuteRatio);
		double minuteY = (double) B * Math.cos(2. * Math.PI * minuteRatio);
		double distance = Math.sqrt(Math.pow(hourX - minuteX, 2.0) + Math.pow(hourY - minuteY, 2.0));
		System.out.println(distance);
	} Main {
		String[] tokens = in.readLine().split(" ");
		int A = Integer.parseInt(tokens[0]);
		int B = Integer.parseInt(tokens[1]);
		int H = Integer.parseInt(tokens[2]);
		int M = Integer.parseInt(tokens[3]);

		int totalMin = 60 * H + M;
		double hourRatio = (double) totalMin / (double) (12 * 60);
		double hourX = (double) A * Math.sin(2. * Math.PI * hourRatio);
		double hourY = (double) A * Math.cos(2. * Math.PI * hourRatio);

		double minuteRatio = (double) M / (double) 60;
		double minuteX = (double) B * Math.sin(2. * Math.PI * minuteRatio);
		double minuteY = (double) B * Math.cos(2. * Math.PI * minuteRatio);
		double distance = Math.sqrt(Math.pow(hourX - minuteX, 2.0) + Math.pow(hourY - minuteY, 2.0));
		System.out.println(distance);
	} String[] tokens = in.readLine().split(" "); tokens in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int A = Integer.parseInt(tokens[0]); A Integer.parseInt(tokens[0]) Integer.parseInt Integer tokens[0] tokens 0 int B = Integer.parseInt(tokens[1]); B Integer.parseInt(tokens[1]) Integer.parseInt Integer tokens[1] tokens 1 int H = Integer.parseInt(tokens[2]); H Integer.parseInt(tokens[2]) Integer.parseInt Integer tokens[2] tokens 2 int M = Integer.parseInt(tokens[3]); M Integer.parseInt(tokens[3]) Integer.parseInt Integer tokens[3] tokens 3 int totalMin = 60 * H + M; totalMin 60 * H + M 60 * H 60 H M double hourRatio = (double) totalMin / (double) (12 * 60); hourRatio (double) totalMin / (double) (12 * 60) (double) totalMin (double) (12 * 60) 12 60 double hourX = (double) A * Math.sin(2. * Math.PI * hourRatio); hourX (double) A * Math.sin(2. * Math.PI * hourRatio) (double) A Math.sin(2. * Math.PI * hourRatio) Math.sin Math 2. * Math.PI * hourRatio 2. * Math.PI * hourRatio 2. Math.PI Math Math.PI hourRatio double hourY = (double) A * Math.cos(2. * Math.PI * hourRatio); hourY (double) A * Math.cos(2. * Math.PI * hourRatio) (double) A Math.cos(2. * Math.PI * hourRatio) Math.cos Math 2. * Math.PI * hourRatio 2. * Math.PI * hourRatio 2. Math.PI Math Math.PI hourRatio double minuteRatio = (double) M / (double) 60; minuteRatio (double) M / (double) 60 (double) M (double) 60 double minuteX = (double) B * Math.sin(2. * Math.PI * minuteRatio); minuteX (double) B * Math.sin(2. * Math.PI * minuteRatio) (double) B Math.sin(2. * Math.PI * minuteRatio) Math.sin Math 2. * Math.PI * minuteRatio 2. * Math.PI * minuteRatio 2. Math.PI Math Math.PI minuteRatio double minuteY = (double) B * Math.cos(2. * Math.PI * minuteRatio); minuteY (double) B * Math.cos(2. * Math.PI * minuteRatio) (double) B Math.cos(2. * Math.PI * minuteRatio) Math.cos Math 2. * Math.PI * minuteRatio 2. * Math.PI * minuteRatio 2. Math.PI Math Math.PI minuteRatio double distance = Math.sqrt(Math.pow(hourX - minuteX, 2.0) + Math.pow(hourY - minuteY, 2.0)); distance Math.sqrt(Math.pow(hourX - minuteX, 2.0) + Math.pow(hourY - minuteY, 2.0)) Math.sqrt Math Math.pow(hourX - minuteX, 2.0) + Math.pow(hourY - minuteY, 2.0) Math.pow(hourX - minuteX, 2.0) Math.pow Math hourX - minuteX hourX minuteX 2.0 Math.pow(hourY - minuteY, 2.0) Math.pow Math hourY - minuteY hourY minuteY 2.0 System.out.println(distance) System.out.println System.out System System.out distance BufferedReader in in void calc() {
	} calc {
	} void showResult() {
	} showResult {
	} public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int A = Integer.parseInt(tokens[0]);
		int B = Integer.parseInt(tokens[1]);
		int H = Integer.parseInt(tokens[2]);
		int M = Integer.parseInt(tokens[3]);

		int totalMin = 60 * H + M;
		double hourRatio = (double) totalMin / (double) (12 * 60);
		double hourX = (double) A * Math.sin(2. * Math.PI * hourRatio);
		double hourY = (double) A * Math.cos(2. * Math.PI * hourRatio);

		double minuteRatio = (double) M / (double) 60;
		double minuteX = (double) B * Math.sin(2. * Math.PI * minuteRatio);
		double minuteY = (double) B * Math.cos(2. * Math.PI * minuteRatio);
		double distance = Math.sqrt(Math.pow(hourX - minuteX, 2.0) + Math.pow(hourY - minuteY, 2.0));
		System.out.println(distance);
	}

	void calc() {
	}

	void showResult() {
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int A = Integer.parseInt(tokens[0]);
		int B = Integer.parseInt(tokens[1]);
		int H = Integer.parseInt(tokens[2]);
		int M = Integer.parseInt(tokens[3]);

		int totalMin = 60 * H + M;
		double hourRatio = (double) totalMin / (double) (12 * 60);
		double hourX = (double) A * Math.sin(2. * Math.PI * hourRatio);
		double hourY = (double) A * Math.cos(2. * Math.PI * hourRatio);

		double minuteRatio = (double) M / (double) 60;
		double minuteX = (double) B * Math.sin(2. * Math.PI * minuteRatio);
		double minuteY = (double) B * Math.cos(2. * Math.PI * minuteRatio);
		double distance = Math.sqrt(Math.pow(hourX - minuteX, 2.0) + Math.pow(hourY - minuteY, 2.0));
		System.out.println(distance);
	}

	void calc() {
	}

	void showResult() {
	}

} Main

import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int A = Integer.parseInt(tokens[0]);
		int B = Integer.parseInt(tokens[1]);
		int H = Integer.parseInt(tokens[2]);
		int M = Integer.parseInt(tokens[3]);

		int totalMin = 60 * H + M;
		double hourRatio = (double) totalMin / (double) (12 * 60);
		double hourX = (double) A * Math.sin(2. * Math.PI * hourRatio);
		double hourY = (double) A * Math.cos(2. * Math.PI * hourRatio);

		double minuteRatio = (double) M / (double) 60;
		double minuteX = (double) B * Math.sin(2. * Math.PI * minuteRatio);
		double minuteY = (double) B * Math.cos(2. * Math.PI * minuteRatio);
		double distance = Math.sqrt(Math.pow(hourX - minuteX, 2.0) + Math.pow(hourY - minuteY, 2.0));
		System.out.println(distance);
	}

	void calc() {
	}

	void showResult() {
	}

}
