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