import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int b = sc.nextInt();
    int c = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
	double xr = (x*60 + y)/2.0;
    double yr = 6.0*y;
    double e = Math.max(xr-yr, yr-xr);
    double r = Math.sqrt(b*b + c*c - 2*b*c*Math.cos(Math.toRadians(e)));
 	
    System.out.println(r);
  }
 
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int b = sc.nextInt();
    int c = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
	double xr = (x*60 + y)/2.0;
    double yr = 6.0*y;
    double e = Math.max(xr-yr, yr-xr);
    double r = Math.sqrt(b*b + c*c - 2*b*c*Math.cos(Math.toRadians(e)));
 	
    System.out.println(r);
  }
 
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int b = sc.nextInt();
    int c = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
	double xr = (x*60 + y)/2.0;
    double yr = 6.0*y;
    double e = Math.max(xr-yr, yr-xr);
    double r = Math.sqrt(b*b + c*c - 2*b*c*Math.cos(Math.toRadians(e)));
 	
    System.out.println(r);
  } main {
    Scanner sc = new Scanner(System.in);
    int b = sc.nextInt();
    int c = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
	double xr = (x*60 + y)/2.0;
    double yr = 6.0*y;
    double e = Math.max(xr-yr, yr-xr);
    double r = Math.sqrt(b*b + c*c - 2*b*c*Math.cos(Math.toRadians(e)));
 	
    System.out.println(r);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc double xr = (x*60 + y)/2.0; xr (x*60 + y)/2.0 (x*60 + y) x*60 x 60 y 2.0 double yr = 6.0*y; yr 6.0*y 6.0 y double e = Math.max(xr-yr, yr-xr); e Math.max(xr-yr, yr-xr) Math.max Math xr-yr xr yr yr-xr yr xr double r = Math.sqrt(b*b + c*c - 2*b*c*Math.cos(Math.toRadians(e))); r Math.sqrt(b*b + c*c - 2*b*c*Math.cos(Math.toRadians(e))) Math.sqrt Math b*b + c*c - 2*b*c*Math.cos(Math.toRadians(e)) b*b + c*c b*b b b c*c c c 2*b*c*Math.cos(Math.toRadians(e)) c 2*b*c*Math.cos(Math.toRadians(e)) 2 b c Math.cos(Math.toRadians(e)) Math.cos Math Math.toRadians(e) Math.toRadians Math e System.out.println(r) System.out.println System.out System System.out r String[] args args
import java.util.*;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int b = sc.nextInt();
    int c = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
	double xr = (x*60 + y)/2.0;
    double yr = 6.0*y;
    double e = Math.max(xr-yr, yr-xr);
    double r = Math.sqrt(b*b + c*c - 2*b*c*Math.cos(Math.toRadians(e)));
 	
    System.out.println(r);
  }
 
}