#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  cout << setprecision(12) << fixed;
  if (a < b) {
    cout << -1 << endl;
    return 0;
  }
  if (a == b) {
    cout << b << endl;
    return 0;
  }
  double ans = -1.0;
  int k = (a - b) / (2 * b);
  if (k > 0) {
    ans = (a - b) / (2.0 * k);
  }
  int kp1 = (a + b) / (2 * b);
  if (kp1 > 0) {
    double res = (a + b) / (2.0 * kp1);
    if (ans < 0) {
      ans = res;
    } else if (ans > res) {
      ans = res;
    }
  }
  cout << ans << endl;
  return 0;
}
