#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if ((a >= 0 && b < 0) || (a < 0 && b >= 0)) {
    cout << "-1";
    return 0;
  }
  if (a == 0 && b == 0) {
    cout << "-1";
    return 0;
  }
  if (a < 0 && b < 0) {
    cout << "-1";
    return 0;
  }
  if (b == 0 && a > 0) {
    cout << "-1";
    return 0;
  }
  if (a == b) {
    cout << a;
    return 0;
  }
  if (a > 0 && b > 0) {
    if (b > a) {
      cout << "-1";
      return 0;
    } else {
      int k1 = (a - b) / (2 * b);
      double x1 = (double)(a - b) / (2 * k1);
      int k2 = (a + b) / (2 * b);
      double x2 = (double)(a + b) / (2 * k2);
      cout << setprecision(10) << min(x1, x2);
    }
  }
  return 0;
}
