#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  double answ = numeric_limits<double>::max();
  double answer = numeric_limits<double>::max();
  if (a < b) {
    answer = -1;
  } else if (a == b) {
    answer = a;
  } else {
    int k = max(1, a / b - 3);
    do {
      answer = answ;
      if (k % 2 == 1) {
        answ = double(a + b) / double((k + 1));
      } else {
        answ = double(a - b) / double(k);
      }
      ++k;
    } while (answ >= b);
  }
  cout << std::setprecision(10) << std::fixed << answer << "\n";
  return 0;
}
