#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, k, l;
  cin >> a >> b;
  double x, y;
  if (b > a) {
    cout << -1 << endl;
  } else {
    k = (a - b) / (2 * b);
    l = (a + b) / (2 * b);
    if (k)
      x = (a - b) / (2.0 * k);
    else
      x = 1000000000000000LL;
    if (l)
      y = (a + b) / (2.0 * l);
    else
      y = 1000000000000000LL;
    cout << fixed << setprecision(11);
    cout << min(x, y) << endl;
  }
  return 0;
}
