#include <bits/stdc++.h>
long long x, y;
long double fun(long double as) {
  long double cache = as / y;
  long long i = (long long)cache;
  if (i == 1)
    return as;
  else {
    return fun(as / i);
  }
}
int main() {
  long double ans, buf;
  scanf("%I64d %I64d", &x, &y);
  ans = (long double)(x + y) / 2;
  if (y > x) {
    printf("-1");
    return 0;
  }
  ans = fun(ans);
  printf("%.12lf", ans);
  return 0;
}
