import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		
		double a=sc.nextInt();
		double b=sc.nextInt();
		double h=sc.nextInt();
		double m=sc.nextInt();
		
		double t=h*60+m;
		
		
		//double hx = Math.sin(Math.toRadians(t*0.5))*3;
		//double hy = Math.cos(Math.toRadians(t*0.5))*3;
		double hx = Math.cos(Math.toRadians(t*0.5-90))*a;
		double hy = Math.sin(Math.toRadians(t*0.5-90))*a;
		//System.out.println(hx);
		//System.out.println(hy);
		
		//double mx = Math.sin(Math.toRadians(t/6))*4;
		//double my = Math.cos(Math.toRadians(t/6))*4;
		double mx = Math.cos(Math.toRadians(t*6-90))*b;
		double my = Math.sin(Math.toRadians(t*6-90))*b;
		//System.out.println(mx);
		//System.out.println(my);
		
		double d = Math.sqrt((hy-my)*(hy-my)+(hx-mx)*(hx-mx));
		System.out.println(d);
		
	}

} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		
		double a=sc.nextInt();
		double b=sc.nextInt();
		double h=sc.nextInt();
		double m=sc.nextInt();
		
		double t=h*60+m;
		
		
		//double hx = Math.sin(Math.toRadians(t*0.5))*3;
		//double hy = Math.cos(Math.toRadians(t*0.5))*3;
		double hx = Math.cos(Math.toRadians(t*0.5-90))*a;
		double hy = Math.sin(Math.toRadians(t*0.5-90))*a;
		//System.out.println(hx);
		//System.out.println(hy);
		
		//double mx = Math.sin(Math.toRadians(t/6))*4;
		//double my = Math.cos(Math.toRadians(t/6))*4;
		double mx = Math.cos(Math.toRadians(t*6-90))*b;
		double my = Math.sin(Math.toRadians(t*6-90))*b;
		//System.out.println(mx);
		//System.out.println(my);
		
		double d = Math.sqrt((hy-my)*(hy-my)+(hx-mx)*(hx-mx));
		System.out.println(d);
		
	}

} Main public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		
		double a=sc.nextInt();
		double b=sc.nextInt();
		double h=sc.nextInt();
		double m=sc.nextInt();
		
		double t=h*60+m;
		
		
		//double hx = Math.sin(Math.toRadians(t*0.5))*3;
		//double hy = Math.cos(Math.toRadians(t*0.5))*3;
		double hx = Math.cos(Math.toRadians(t*0.5-90))*a;
		double hy = Math.sin(Math.toRadians(t*0.5-90))*a;
		//System.out.println(hx);
		//System.out.println(hy);
		
		//double mx = Math.sin(Math.toRadians(t/6))*4;
		//double my = Math.cos(Math.toRadians(t/6))*4;
		double mx = Math.cos(Math.toRadians(t*6-90))*b;
		double my = Math.sin(Math.toRadians(t*6-90))*b;
		//System.out.println(mx);
		//System.out.println(my);
		
		double d = Math.sqrt((hy-my)*(hy-my)+(hx-mx)*(hx-mx));
		System.out.println(d);
		
	} main {
		Scanner sc=new Scanner(System.in);
		
		double a=sc.nextInt();
		double b=sc.nextInt();
		double h=sc.nextInt();
		double m=sc.nextInt();
		
		double t=h*60+m;
		
		
		//double hx = Math.sin(Math.toRadians(t*0.5))*3;
		//double hy = Math.cos(Math.toRadians(t*0.5))*3;
		double hx = Math.cos(Math.toRadians(t*0.5-90))*a;
		double hy = Math.sin(Math.toRadians(t*0.5-90))*a;
		//System.out.println(hx);
		//System.out.println(hy);
		
		//double mx = Math.sin(Math.toRadians(t/6))*4;
		//double my = Math.cos(Math.toRadians(t/6))*4;
		double mx = Math.cos(Math.toRadians(t*6-90))*b;
		double my = Math.sin(Math.toRadians(t*6-90))*b;
		//System.out.println(mx);
		//System.out.println(my);
		
		double d = Math.sqrt((hy-my)*(hy-my)+(hx-mx)*(hx-mx));
		System.out.println(d);
		
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) double a=sc.nextInt(); a sc.nextInt() sc.nextInt sc double b=sc.nextInt(); b sc.nextInt() sc.nextInt sc double h=sc.nextInt(); h sc.nextInt() sc.nextInt sc double m=sc.nextInt(); m sc.nextInt() sc.nextInt sc double t=h*60+m; t h*60+m h*60 h 60 m double hx = Math.cos(Math.toRadians(t*0.5-90))*a; hx Math.cos(Math.toRadians(t*0.5-90))*a Math.cos(Math.toRadians(t*0.5-90)) Math.cos Math Math.toRadians(t*0.5-90) Math.toRadians Math t*0.5-90 t*0.5 t 0.5 90 a double hy = Math.sin(Math.toRadians(t*0.5-90))*a; hy Math.sin(Math.toRadians(t*0.5-90))*a Math.sin(Math.toRadians(t*0.5-90)) Math.sin Math Math.toRadians(t*0.5-90) Math.toRadians Math t*0.5-90 t*0.5 t 0.5 90 a double mx = Math.cos(Math.toRadians(t*6-90))*b; mx Math.cos(Math.toRadians(t*6-90))*b Math.cos(Math.toRadians(t*6-90)) Math.cos Math Math.toRadians(t*6-90) Math.toRadians Math t*6-90 t*6 t 6 90 b double my = Math.sin(Math.toRadians(t*6-90))*b; my Math.sin(Math.toRadians(t*6-90))*b Math.sin(Math.toRadians(t*6-90)) Math.sin Math Math.toRadians(t*6-90) Math.toRadians Math t*6-90 t*6 t 6 90 b double d = Math.sqrt((hy-my)*(hy-my)+(hx-mx)*(hx-mx)); d Math.sqrt((hy-my)*(hy-my)+(hx-mx)*(hx-mx)) Math.sqrt Math (hy-my)*(hy-my)+(hx-mx)*(hx-mx) (hy-my)*(hy-my) (hy-my) hy my (hy-my) hy my (hx-mx)*(hx-mx) (hx-mx) hx mx (hx-mx) hx mx System.out.println(d) System.out.println System.out System System.out d String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		
		double a=sc.nextInt();
		double b=sc.nextInt();
		double h=sc.nextInt();
		double m=sc.nextInt();
		
		double t=h*60+m;
		
		
		//double hx = Math.sin(Math.toRadians(t*0.5))*3;
		//double hy = Math.cos(Math.toRadians(t*0.5))*3;
		double hx = Math.cos(Math.toRadians(t*0.5-90))*a;
		double hy = Math.sin(Math.toRadians(t*0.5-90))*a;
		//System.out.println(hx);
		//System.out.println(hy);
		
		//double mx = Math.sin(Math.toRadians(t/6))*4;
		//double my = Math.cos(Math.toRadians(t/6))*4;
		double mx = Math.cos(Math.toRadians(t*6-90))*b;
		double my = Math.sin(Math.toRadians(t*6-90))*b;
		//System.out.println(mx);
		//System.out.println(my);
		
		double d = Math.sqrt((hy-my)*(hy-my)+(hx-mx)*(hx-mx));
		System.out.println(d);
		
	}

} public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		
		double a=sc.nextInt();
		double b=sc.nextInt();
		double h=sc.nextInt();
		double m=sc.nextInt();
		
		double t=h*60+m;
		
		
		//double hx = Math.sin(Math.toRadians(t*0.5))*3;
		//double hy = Math.cos(Math.toRadians(t*0.5))*3;
		double hx = Math.cos(Math.toRadians(t*0.5-90))*a;
		double hy = Math.sin(Math.toRadians(t*0.5-90))*a;
		//System.out.println(hx);
		//System.out.println(hy);
		
		//double mx = Math.sin(Math.toRadians(t/6))*4;
		//double my = Math.cos(Math.toRadians(t/6))*4;
		double mx = Math.cos(Math.toRadians(t*6-90))*b;
		double my = Math.sin(Math.toRadians(t*6-90))*b;
		//System.out.println(mx);
		//System.out.println(my);
		
		double d = Math.sqrt((hy-my)*(hy-my)+(hx-mx)*(hx-mx));
		System.out.println(d);
		
	}

} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		
		double a=sc.nextInt();
		double b=sc.nextInt();
		double h=sc.nextInt();
		double m=sc.nextInt();
		
		double t=h*60+m;
		
		
		//double hx = Math.sin(Math.toRadians(t*0.5))*3;
		//double hy = Math.cos(Math.toRadians(t*0.5))*3;
		double hx = Math.cos(Math.toRadians(t*0.5-90))*a;
		double hy = Math.sin(Math.toRadians(t*0.5-90))*a;
		//System.out.println(hx);
		//System.out.println(hy);
		
		//double mx = Math.sin(Math.toRadians(t/6))*4;
		//double my = Math.cos(Math.toRadians(t/6))*4;
		double mx = Math.cos(Math.toRadians(t*6-90))*b;
		double my = Math.sin(Math.toRadians(t*6-90))*b;
		//System.out.println(mx);
		//System.out.println(my);
		
		double d = Math.sqrt((hy-my)*(hy-my)+(hx-mx)*(hx-mx));
		System.out.println(d);
		
	}

}
