#include <algorithm>
#include <cstdio>
#include <cmath>

using std::min;

typedef long double dbl;
typedef long long ll;

dbl solve( int d, int h1, int h2, int l )
{
  dbl ans = h1;
  dbl h = 0.0;
  if (l < d)
    h = ((ll)d * d - (ll)l * l) / (2 * l);
  dbl y = min((dbl)h1, (dbl)h2 - h);
  ans += min((dbl)h2, sqrtl((ll)d * d + (h2 - y) * (h2 - y)));
  return ans;
}

int main()
{
  freopen("joe.in", "r", stdin);
  freopen("joe.out", "w", stdout);

  int d, h1, h2, l;
  scanf("%d%d%d%d", &d, &h1, &h2, &l);
  d *= 2, h1 *= 2, h2 *= 2, l *= 2;

  printf("%.20lf\n", (double)(min(solve(d, h1, h2, l), solve(d, h2, h1, l)) / 2.0));

  return 0;
}
