#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int A, B, H, M;
  cin >> A >> B >> H >> M;
  long double t;
  long double ans;
  t = 2 * 3.14159265358979323846264338327950L *
      (((long double)H / 12.0 + (long double)M / 60.0) / 12.0 -
       (long double)M / 60.0);
  ans =
      (long double)(pow(A, 2) * pow(B, 2)) - (long double)(2 * A * B * cos(t));
  printf("%20.20Lf\n", sqrt(ans));
  return 0;
}
