#include <bits/stdc++.h>
using namespace std;
const static int MAXN = 1100000;
long long a, b;
double s(int c) {
  if ((2.0 * (c / (2 * b))) == 0 || c / (2.0 * (c / (2 * b))) < 0) return 1e200;
  return c / (2.0 * (c / (2 * b)));
}
int main() {
  cin >> a >> b;
  if (a < b) {
    cout << "-1\n";
    return 0;
  }
  if (a == b) {
    cout << a << endl;
    return 0;
  }
  double x = s(a + b);
  if (x > 1e195)
    cout << -1 << endl;
  else
    printf("%.12lf\n", x);
}
