#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int x, y;
  cin >> x >> y;
  int tx = x - y;
  int ty = x + y;
  x = tx;
  y = ty;
  if (x < 0)
    cout << "-1\n";
  else {
    int l = 1, r = 1e9 + 5;
    while (r - l > 1) {
      int mid = (l + r) / 2;
      if ((1LL * y * (mid - 1) + mid - 1) / mid <= x)
        l = mid;
      else
        r = mid;
    }
    long double ans = y;
    ans /= l;
    ans /= 2.0;
    cout << setprecision(19) << fixed << ans << "\n";
  }
  return 0;
}
