#include <bits/stdc++.h>
using namespace std;
int main() {
  double x;
  double a, b;
  while (cin >> a >> b) {
    if (b > a) {
      x = -1;
    } else if (b == a) {
      x = a;
    } else {
      double r = (a + b) / 2;
      double d = (a - b) / 2;
      int rr = r / b, dd = d / b;
      while (r / rr < b) {
        rr--;
      }
      while (d / dd < b) {
        dd--;
      }
      if ((double)r / rr >= (double)d / dd) {
        x = (double)d / dd;
      } else {
        x = (double)r / rr;
      }
    }
    printf("%.12f\n", x);
  }
  return 0;
}
