#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "-1";
  } else if (a == b) {
    cout << a;
  } else {
    const long double c = 2;
    long long te = (a - b) / (2 * b);
    long double ans =
        max((long double)b, (long double)(a - b) / (c * (long double)te));
    te = (a + b) / (2 * b);
    ans = min(
        ans, max((long double)b, (long double)(a + b) / (c * (long double)te)));
    cout << fixed << setprecision(20);
    cout << ans;
  }
  return 0;
}
