import java.util.*;
import java.math.*;

class Main{
public static void main(String[] args) {
  Scanner reader =new Scanner (System.in);
  int a =reader.nextInt();
  int b= reader.nextInt();
  int h=reader.nextInt();
  int m=reader.nextInt();

  int min =h*60+m;

  double aRad=(double)(0.5*min%360)*Math.PI/180;

  double bRad=(double)(6*min%360)*Math.PI/180;

  double ax=a*Math.sin(aRad);

  double ay=a*Math.cos(aRad);
  double bx=b*Math.sin(bRad);
  double by=b*Math.cos(bRad);

  double len=Math.pow(ax-bx,2)+Math.pow(ay-by,2);
  double lenans=Math.sqrt(len);
  System.out.println(lenans);




}
} import java.util.*; util.* java import java.math.*; math.* java class Main{
public static void main(String[] args) {
  Scanner reader =new Scanner (System.in);
  int a =reader.nextInt();
  int b= reader.nextInt();
  int h=reader.nextInt();
  int m=reader.nextInt();

  int min =h*60+m;

  double aRad=(double)(0.5*min%360)*Math.PI/180;

  double bRad=(double)(6*min%360)*Math.PI/180;

  double ax=a*Math.sin(aRad);

  double ay=a*Math.cos(aRad);
  double bx=b*Math.sin(bRad);
  double by=b*Math.cos(bRad);

  double len=Math.pow(ax-bx,2)+Math.pow(ay-by,2);
  double lenans=Math.sqrt(len);
  System.out.println(lenans);




}
} Main public static void main(String[] args) {
  Scanner reader =new Scanner (System.in);
  int a =reader.nextInt();
  int b= reader.nextInt();
  int h=reader.nextInt();
  int m=reader.nextInt();

  int min =h*60+m;

  double aRad=(double)(0.5*min%360)*Math.PI/180;

  double bRad=(double)(6*min%360)*Math.PI/180;

  double ax=a*Math.sin(aRad);

  double ay=a*Math.cos(aRad);
  double bx=b*Math.sin(bRad);
  double by=b*Math.cos(bRad);

  double len=Math.pow(ax-bx,2)+Math.pow(ay-by,2);
  double lenans=Math.sqrt(len);
  System.out.println(lenans);




} main {
  Scanner reader =new Scanner (System.in);
  int a =reader.nextInt();
  int b= reader.nextInt();
  int h=reader.nextInt();
  int m=reader.nextInt();

  int min =h*60+m;

  double aRad=(double)(0.5*min%360)*Math.PI/180;

  double bRad=(double)(6*min%360)*Math.PI/180;

  double ax=a*Math.sin(aRad);

  double ay=a*Math.cos(aRad);
  double bx=b*Math.sin(bRad);
  double by=b*Math.cos(bRad);

  double len=Math.pow(ax-bx,2)+Math.pow(ay-by,2);
  double lenans=Math.sqrt(len);
  System.out.println(lenans);




} Scanner reader =new Scanner (System.in); reader new Scanner (System.in) int a =reader.nextInt(); a reader.nextInt() reader.nextInt reader int b= reader.nextInt(); b reader.nextInt() reader.nextInt reader int h=reader.nextInt(); h reader.nextInt() reader.nextInt reader int m=reader.nextInt(); m reader.nextInt() reader.nextInt reader int min =h*60+m; min h*60+m h*60 h 60 m double aRad=(double)(0.5*min%360)*Math.PI/180; aRad (double)(0.5*min%360)*Math.PI/180 (double)(0.5*min%360)*Math.PI (double)(0.5*min%360) 0.5*min 0.5 min 360 Math.PI Math Math.PI 180 double bRad=(double)(6*min%360)*Math.PI/180; bRad (double)(6*min%360)*Math.PI/180 (double)(6*min%360)*Math.PI (double)(6*min%360) 6*min 6 min 360 Math.PI Math Math.PI 180 double ax=a*Math.sin(aRad); ax a*Math.sin(aRad) a Math.sin(aRad) Math.sin Math aRad double ay=a*Math.cos(aRad); ay a*Math.cos(aRad) a Math.cos(aRad) Math.cos Math aRad double bx=b*Math.sin(bRad); bx b*Math.sin(bRad) b Math.sin(bRad) Math.sin Math bRad double by=b*Math.cos(bRad); by b*Math.cos(bRad) b Math.cos(bRad) Math.cos Math bRad double len=Math.pow(ax-bx,2)+Math.pow(ay-by,2); len Math.pow(ax-bx,2)+Math.pow(ay-by,2) Math.pow(ax-bx,2) Math.pow Math ax-bx ax bx 2 Math.pow(ay-by,2) Math.pow Math ay-by ay by 2 double lenans=Math.sqrt(len); lenans Math.sqrt(len) Math.sqrt Math len System.out.println(lenans) System.out.println System.out System System.out lenans String[] args args
import java.util.*;
import java.math.*;

class Main{
public static void main(String[] args) {
  Scanner reader =new Scanner (System.in);
  int a =reader.nextInt();
  int b= reader.nextInt();
  int h=reader.nextInt();
  int m=reader.nextInt();

  int min =h*60+m;

  double aRad=(double)(0.5*min%360)*Math.PI/180;

  double bRad=(double)(6*min%360)*Math.PI/180;

  double ax=a*Math.sin(aRad);

  double ay=a*Math.cos(aRad);
  double bx=b*Math.sin(bRad);
  double by=b*Math.cos(bRad);

  double len=Math.pow(ax-bx,2)+Math.pow(ay-by,2);
  double lenans=Math.sqrt(len);
  System.out.println(lenans);




}
}
