#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int t1 = (a - b) / (2 * b), t2 = (a + b) / (2 * b);
  double ans = 1e9;
  if (t1 != 0) {
    ans = (double)(a - b) / (2 * t1);
  }
  ans = min(ans, (double)(a + b) / (2 * t2));
  if (a < b) ans = -1;
  printf("%.15f\n", ans);
  return 0;
}
