#include <stdio.h>
#include <math.h>
#include <stdlib.h>
 
int main(int argc, char** argv)
{
  double a = 0.0;
  double b = 0.0;
  double h = 0.0;
  double m = 0.0;
  double radh = M_PI / 6.0;
  double radm = M_PI / 30.0;
  double radhm = radh / 60.0;
  
  scanf("%lg %lg %lg %lg", &a, &b, &h, &m);
  
  double rada = h * radh + m * radhm;
  double radb = m * radm;
  double angle = rada - radb;
 
  double posA[2] = { a * cos(rada), a * sin(rada) };
  double posB[2] = { b * cos(radb), b * sin(radb) };
  
  double dx = posA[0] - posB[0];
  double dy = posA[1] - posB[1];
  double dist = sqrt(dx * dx + dy * dy);
  
  printf("f20\n", dist);
  return 0;
}