
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		String[] cmd=s.split(" ");
		double a=Double.valueOf(cmd[0]);
		double b=Double.valueOf(cmd[1]);
		double c=Double.valueOf(cmd[2]);
		double d=Double.valueOf(cmd[3]);
		double x=((c*60+d)*6)%360;
		double y=c*30+(d*1.0)/2;
		double an=Math.abs(x-y);
		if(an>180)
			an=360-an;
		double a1=a*a+b*b;
		double a2=2*a*b;
		double a3=a1-a2*Math.cos((an*Math.PI)/180);
		System.out.println(Math.sqrt(a3));
	}

} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		String[] cmd=s.split(" ");
		double a=Double.valueOf(cmd[0]);
		double b=Double.valueOf(cmd[1]);
		double c=Double.valueOf(cmd[2]);
		double d=Double.valueOf(cmd[3]);
		double x=((c*60+d)*6)%360;
		double y=c*30+(d*1.0)/2;
		double an=Math.abs(x-y);
		if(an>180)
			an=360-an;
		double a1=a*a+b*b;
		double a2=2*a*b;
		double a3=a1-a2*Math.cos((an*Math.PI)/180);
		System.out.println(Math.sqrt(a3));
	}

} Main public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		String[] cmd=s.split(" ");
		double a=Double.valueOf(cmd[0]);
		double b=Double.valueOf(cmd[1]);
		double c=Double.valueOf(cmd[2]);
		double d=Double.valueOf(cmd[3]);
		double x=((c*60+d)*6)%360;
		double y=c*30+(d*1.0)/2;
		double an=Math.abs(x-y);
		if(an>180)
			an=360-an;
		double a1=a*a+b*b;
		double a2=2*a*b;
		double a3=a1-a2*Math.cos((an*Math.PI)/180);
		System.out.println(Math.sqrt(a3));
	} main {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		String[] cmd=s.split(" ");
		double a=Double.valueOf(cmd[0]);
		double b=Double.valueOf(cmd[1]);
		double c=Double.valueOf(cmd[2]);
		double d=Double.valueOf(cmd[3]);
		double x=((c*60+d)*6)%360;
		double y=c*30+(d*1.0)/2;
		double an=Math.abs(x-y);
		if(an>180)
			an=360-an;
		double a1=a*a+b*b;
		double a2=2*a*b;
		double a3=a1-a2*Math.cos((an*Math.PI)/180);
		System.out.println(Math.sqrt(a3));
	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s=br.readLine(); s br.readLine() br.readLine br String[] cmd=s.split(" "); cmd s.split(" ") s.split s " " double a=Double.valueOf(cmd[0]); a Double.valueOf(cmd[0]) Double.valueOf Double cmd[0] cmd 0 double b=Double.valueOf(cmd[1]); b Double.valueOf(cmd[1]) Double.valueOf Double cmd[1] cmd 1 double c=Double.valueOf(cmd[2]); c Double.valueOf(cmd[2]) Double.valueOf Double cmd[2] cmd 2 double d=Double.valueOf(cmd[3]); d Double.valueOf(cmd[3]) Double.valueOf Double cmd[3] cmd 3 double x=((c*60+d)*6)%360; x ((c*60+d)*6)%360 ((c*60+d)*6) (c*60+d) c*60 c 60 d 6 360 double y=c*30+(d*1.0)/2; y c*30+(d*1.0)/2 c*30 c 30 (d*1.0)/2 (d*1.0) d 1.0 2 double an=Math.abs(x-y); an Math.abs(x-y) Math.abs Math x-y x y if(an>180)
			an=360-an; an>180 an 180 an=360-an an 360-an 360 an double a1=a*a+b*b; a1 a*a+b*b a*a a a b*b b b double a2=2*a*b; a2 2*a*b 2*a*b 2 a b double a3=a1-a2*Math.cos((an*Math.PI)/180); a3 a1-a2*Math.cos((an*Math.PI)/180) a1 a2*Math.cos((an*Math.PI)/180) a2 Math.cos((an*Math.PI)/180) Math.cos Math (an*Math.PI)/180 (an*Math.PI) an Math.PI Math Math.PI 180 System.out.println(Math.sqrt(a3)) System.out.println System.out System System.out Math.sqrt(a3) Math.sqrt Math a3 String[] args args public class Main {
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		String[] cmd=s.split(" ");
		double a=Double.valueOf(cmd[0]);
		double b=Double.valueOf(cmd[1]);
		double c=Double.valueOf(cmd[2]);
		double d=Double.valueOf(cmd[3]);
		double x=((c*60+d)*6)%360;
		double y=c*30+(d*1.0)/2;
		double an=Math.abs(x-y);
		if(an>180)
			an=360-an;
		double a1=a*a+b*b;
		double a2=2*a*b;
		double a3=a1-a2*Math.cos((an*Math.PI)/180);
		System.out.println(Math.sqrt(a3));
	}

} public class Main {
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		String[] cmd=s.split(" ");
		double a=Double.valueOf(cmd[0]);
		double b=Double.valueOf(cmd[1]);
		double c=Double.valueOf(cmd[2]);
		double d=Double.valueOf(cmd[3]);
		double x=((c*60+d)*6)%360;
		double y=c*30+(d*1.0)/2;
		double an=Math.abs(x-y);
		if(an>180)
			an=360-an;
		double a1=a*a+b*b;
		double a2=2*a*b;
		double a3=a1-a2*Math.cos((an*Math.PI)/180);
		System.out.println(Math.sqrt(a3));
	}

} Main

import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		String[] cmd=s.split(" ");
		double a=Double.valueOf(cmd[0]);
		double b=Double.valueOf(cmd[1]);
		double c=Double.valueOf(cmd[2]);
		double d=Double.valueOf(cmd[3]);
		double x=((c*60+d)*6)%360;
		double y=c*30+(d*1.0)/2;
		double an=Math.abs(x-y);
		if(an>180)
			an=360-an;
		double a1=a*a+b*b;
		double a2=2*a*b;
		double a3=a1-a2*Math.cos((an*Math.PI)/180);
		System.out.println(Math.sqrt(a3));
	}

}
