#include <stdio.h>
#include <math.h>

#define PI 3.14159L

int main() {
  int a, b, h, m;
  scanf("%d%d%d%d", &a, &b, &h, &m);
  
  long double rad = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long double)m /60.0);
  
  long double rsq = (long double)(a * a + b * b) - (long double)(2 * a * b) * cosl(rsq);
  
  printf("%20.20Lf¥n", sqrtl(rsq));
  
  return 0;
}