/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public final class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int h = s.nextInt();
		int m = s.nextInt();
		double angle = Math.abs((double)(60*h - 11*m)/(double)2);
		angle = Math.toRadians(angle);
		// System.out.println((2*a*b*Math.cos(angle)));
		double ans = Math.sqrt(a*a + b*b - (2*a*b*Math.cos(angle)));
		System.out.println(ans);
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public final class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int h = s.nextInt();
		int m = s.nextInt();
		double angle = Math.abs((double)(60*h - 11*m)/(double)2);
		angle = Math.toRadians(angle);
		// System.out.println((2*a*b*Math.cos(angle)));
		double ans = Math.sqrt(a*a + b*b - (2*a*b*Math.cos(angle)));
		System.out.println(ans);
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int h = s.nextInt();
		int m = s.nextInt();
		double angle = Math.abs((double)(60*h - 11*m)/(double)2);
		angle = Math.toRadians(angle);
		// System.out.println((2*a*b*Math.cos(angle)));
		double ans = Math.sqrt(a*a + b*b - (2*a*b*Math.cos(angle)));
		System.out.println(ans);
	} main {
		// your code goes here
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int h = s.nextInt();
		int m = s.nextInt();
		double angle = Math.abs((double)(60*h - 11*m)/(double)2);
		angle = Math.toRadians(angle);
		// System.out.println((2*a*b*Math.cos(angle)));
		double ans = Math.sqrt(a*a + b*b - (2*a*b*Math.cos(angle)));
		System.out.println(ans);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int a = s.nextInt(); a s.nextInt() s.nextInt s int b = s.nextInt(); b s.nextInt() s.nextInt s int h = s.nextInt(); h s.nextInt() s.nextInt s int m = s.nextInt(); m s.nextInt() s.nextInt s double angle = Math.abs((double)(60*h - 11*m)/(double)2); angle Math.abs((double)(60*h - 11*m)/(double)2) Math.abs Math (double)(60*h - 11*m)/(double)2 (double)(60*h - 11*m) 60*h 60 h 11*m 11 m (double)2 angle = Math.toRadians(angle) angle Math.toRadians(angle) Math.toRadians Math angle double ans = Math.sqrt(a*a + b*b - (2*a*b*Math.cos(angle))); ans Math.sqrt(a*a + b*b - (2*a*b*Math.cos(angle))) Math.sqrt Math a*a + b*b - (2*a*b*Math.cos(angle)) a*a + b*b a*a a a b*b b b (2*a*b*Math.cos(angle)) b 2*a*b*Math.cos(angle) 2 a b Math.cos(angle) Math.cos Math angle System.out.println(ans) System.out.println System.out System System.out ans String[] args args public final class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int h = s.nextInt();
		int m = s.nextInt();
		double angle = Math.abs((double)(60*h - 11*m)/(double)2);
		angle = Math.toRadians(angle);
		// System.out.println((2*a*b*Math.cos(angle)));
		double ans = Math.sqrt(a*a + b*b - (2*a*b*Math.cos(angle)));
		System.out.println(ans);
	}
} public final class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int h = s.nextInt();
		int m = s.nextInt();
		double angle = Math.abs((double)(60*h - 11*m)/(double)2);
		angle = Math.toRadians(angle);
		// System.out.println((2*a*b*Math.cos(angle)));
		double ans = Math.sqrt(a*a + b*b - (2*a*b*Math.cos(angle)));
		System.out.println(ans);
	}
} Main
/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public final class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int h = s.nextInt();
		int m = s.nextInt();
		double angle = Math.abs((double)(60*h - 11*m)/(double)2);
		angle = Math.toRadians(angle);
		// System.out.println((2*a*b*Math.cos(angle)));
		double ans = Math.sqrt(a*a + b*b - (2*a*b*Math.cos(angle)));
		System.out.println(ans);
	}
}