#include <bits/stdc++.h>
using namespace std;
int main() {
  double x, y;
  while (~scanf("%lf%lf", &x, &y)) {
    if (x < y) {
      printf("-1\n");
    } else if (x == y) {
      printf("%.9lf\n", x);
    } else {
      double k1 = floor((x - y) / 2 / y);
      double k2 = floor((x + y) / 2 / y);
      printf("%.9lf\n", min((x - y) / k1 / 2, (x + y) / k2 / 2));
    }
  }
}
