#include <bits/stdc++.h>
using namespace std;
using ld = long double;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cout << fixed << setprecision(10);
  int a, b;
  cin >> a >> b;
  if (a == b) {
    cout << a << endl;
    return 0;
  }
  if (a < b) {
    cout << -1 << endl;
    return 0;
  }
  ld res = a + b;
  if (a - b >= b * 2) {
    int c = a - b;
    int lb = 1, ub = 1e9 + 1000;
    while (ub - lb > 1) {
      int m = (lb + ub) / 2;
      if (c < 1LL * m * 2 * b) {
        ub = m;
      } else {
        lb = m;
      }
    }
    res = min(res, (ld)c / (lb * 2));
  }
  {
    int c = a + b;
    int lb = 1, ub = 1e9 + 1000;
    while (ub - lb > 1) {
      int m = (lb + ub) / 2;
      if (c < 1LL * m * 2 * b) {
        ub = m;
      } else {
        lb = m;
      }
    }
    res = min(res, (ld)c / (lb * 2));
  }
  cout << res << endl;
  return 0;
}
