#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b;
  while (~scanf("%lld%lld", &a, &b)) {
    if (a < b)
      printf("-1\n");
    else {
      int m, n;
      double x, y;
      m = (a + b) / (2 * b) * 2;
      n = (a - b) / (2 * b) * 2;
      x = (a + b) * 1.0 / m;
      y = (a - b) * 1.0 / n;
      printf("%0.12lf\n", min(x, y));
    }
  }
  return 0;
}
