using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split(' ');
			double A = double.Parse(input[0]);
			double B = double.Parse(input[1]);
			double H = double.Parse(input[2]);
			double M = double.Parse(input[3]);
			double pi = Math.PI;

			double argA = ((1 / 2) * pi) - ((2 * pi / 12) * H)-(2*pi/(12*60))*M;
			double argB = ((1 / 2) * pi) - ((2 * pi / 60) * M);
			double Ax = A* (Math.Cos(argA));
			double Ay = A * (Math.Sin(argA));
			double Bx = B * (Math.Cos(argB));
			double By = B * (Math.Sin(argB));
			double dist =Math.Sqrt(Math.Pow((Ax - Bx) , 2)+ Math.Pow((Ay - By), 2));
			Console.WriteLine(dist);

		}		
	}
}
