#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
const long double EPS = 1e-8;
const long double PI = acos(-1.0);
void run() {
  int a, b;
  scanf("%d%d", &a, &b);
  if (a - b < 0)
    printf("-1\n");
  else if (a == b)
    printf("%d\n", a);
  else {
    int k = (a - b) / (2 * b);
    double ans = (a - b) / (2.0 * k);
    k = (a + b) / (2 * b) - 1;
    if (k >= 0) ans = min(ans, double(a + b) / (2 * k + 2));
    printf("%.15lf\n", ans);
  }
}
int main() {
  run();
  return 0;
}
