#include <bits/stdc++.h>
using namespace std;
void solutionA();
int main() {
  solutionA();
  return EXIT_SUCCESS;
}
void solutionA() {
  int a, b;
  for (; cin >> a >> b;) {
    if (b > a)
      cout << -1;
    else {
      if (a % b == 0 && (a / b) % 2 == 1)
        cout << b;
      else {
        double y = double(a + b) / 2.0;
        double k = int(y / double(b));
        double x = y / double(k);
        cout.precision(9);
        cout << fixed << x;
      }
    }
    cout << endl;
  }
}
