#include <bits/stdc++.h>
using namespace std;
double a, b, res, k, t;
int main() {
  scanf("%lf %lf", &a, &b);
  if (a < b) {
    cout << -1;
    return 0;
  }
  res = a + b;
  k = (a + b) / 2;
  t = (int)(k / b);
  res = min(res, k / t);
  k = (a - b) / 2;
  t = (int)(k / b);
  res = min(res, k / t);
  printf("%.9lf", res);
  return 0;
}
