#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, H, M;
  cin >> A >> B >> H >> M;
  double x, y, ra, rb, r;
  ra = 2 * 3.14159265358 * (H * 60 + M) / 12 * 60;
  rb = 2 * 3.14159265358 * M / 12;
  r = abs(rb - ra);
  y = B * sin(r);
  x = A - B * cos(r);
  double ans = sqrt(x * x + y * y);
  printf("%.10f/n", ans);
  return 0;
}
