#include <bits/stdc++.h>
double a, b;
int main() {
  double tmp;
  scanf("%lf%lf", &a, &b);
  if (b / a - 1 > 0.0000000000001) {
    printf("-1\n");
  } else {
    double tmp1;
    tmp = (a + b) / 2;
    tmp1 = tmp;
    long long l = 2, r = 1000000000;
    long long m;
    double m1;
    while (l <= r) {
      m = (l + r) / 2;
      m1 = (double)m;
      if (tmp / m1 - b >= 0) {
        tmp1 = tmp / m1;
        l = m + 1;
      } else {
        r = m - 1;
      }
    }
    printf("%.12f", tmp1);
  }
  return 0;
}
