import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		sc.close();
		double deg = (double)(h+(double)m/60) * 30 - (double)m * 6 ;

		deg = Math.toRadians(deg);

		double acos =  a * Math.cos(deg);
		double asin =  a * Math.sin(deg) ;
		double ans = Math.pow(b - acos, 2) + Math.pow(asin, 2);
		ans = Math.sqrt(ans);

		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		sc.close();
		double deg = (double)(h+(double)m/60) * 30 - (double)m * 6 ;

		deg = Math.toRadians(deg);

		double acos =  a * Math.cos(deg);
		double asin =  a * Math.sin(deg) ;
		double ans = Math.pow(b - acos, 2) + Math.pow(asin, 2);
		ans = Math.sqrt(ans);

		System.out.println(ans);
	}
} Main public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		sc.close();
		double deg = (double)(h+(double)m/60) * 30 - (double)m * 6 ;

		deg = Math.toRadians(deg);

		double acos =  a * Math.cos(deg);
		double asin =  a * Math.sin(deg) ;
		double ans = Math.pow(b - acos, 2) + Math.pow(asin, 2);
		ans = Math.sqrt(ans);

		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		sc.close();
		double deg = (double)(h+(double)m/60) * 30 - (double)m * 6 ;

		deg = Math.toRadians(deg);

		double acos =  a * Math.cos(deg);
		double asin =  a * Math.sin(deg) ;
		double ans = Math.pow(b - acos, 2) + Math.pow(asin, 2);
		ans = Math.sqrt(ans);

		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int h = sc.nextInt(); h sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc sc.close() sc.close sc double deg = (double)(h+(double)m/60) * 30 - (double)m * 6 ; deg (double)(h+(double)m/60) * 30 - (double)m * 6 (double)(h+(double)m/60) * 30 (double)(h+(double)m/60) h (double)m/60 (double)m 60 30 (double)m * 6 (double)m 6 deg = Math.toRadians(deg) deg Math.toRadians(deg) Math.toRadians Math deg double acos =  a * Math.cos(deg); acos a * Math.cos(deg) a Math.cos(deg) Math.cos Math deg double asin =  a * Math.sin(deg) ; asin a * Math.sin(deg) a Math.sin(deg) Math.sin Math deg double ans = Math.pow(b - acos, 2) + Math.pow(asin, 2); ans Math.pow(b - acos, 2) + Math.pow(asin, 2) Math.pow(b - acos, 2) Math.pow Math b - acos b acos 2 Math.pow(asin, 2) Math.pow Math asin 2 ans = Math.sqrt(ans) ans Math.sqrt(ans) Math.sqrt Math ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		sc.close();
		double deg = (double)(h+(double)m/60) * 30 - (double)m * 6 ;

		deg = Math.toRadians(deg);

		double acos =  a * Math.cos(deg);
		double asin =  a * Math.sin(deg) ;
		double ans = Math.pow(b - acos, 2) + Math.pow(asin, 2);
		ans = Math.sqrt(ans);

		System.out.println(ans);
	}
} public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		sc.close();
		double deg = (double)(h+(double)m/60) * 30 - (double)m * 6 ;

		deg = Math.toRadians(deg);

		double acos =  a * Math.cos(deg);
		double asin =  a * Math.sin(deg) ;
		double ans = Math.pow(b - acos, 2) + Math.pow(asin, 2);
		ans = Math.sqrt(ans);

		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		sc.close();
		double deg = (double)(h+(double)m/60) * 30 - (double)m * 6 ;

		deg = Math.toRadians(deg);

		double acos =  a * Math.cos(deg);
		double asin =  a * Math.sin(deg) ;
		double ans = Math.pow(b - acos, 2) + Math.pow(asin, 2);
		ans = Math.sqrt(ans);

		System.out.println(ans);
	}
}
