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