#include <bits/stdc++.h>
using namespace std;
int main() {
  long long c, d;
  cin >> c >> d;
  if (c == d)
    cout << d;
  else if (c > d) {
    long double a = c, b = d;
    long double y = floor((a + b) / (2 * b));
    long double z = floor((a - b) / (2 * b));
    cout << fixed << setprecision(10)
         << min((a + b) / (2 * y), (a - b) / (2 * z));
  } else {
    cout << -1;
  }
  return 0;
}
