#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7f7f7f7f;
int main() {
  double a, b, ans = INF;
  scanf("%lf%lf", &a, &b);
  bool flag1 = 1, flag2 = 1;
  if (a >= b) {
    int n = (a - b) / 2.0 / b;
    if (a != b)
      ans = (a - b) / 2.0 / n;
    else
      ans = b;
  } else
    flag1 = 0;
  int n = (a + b) / 2.0 / b;
  if (n < 1)
    flag2 = 0;
  else
    ans = min(ans, (a + b) / 2.0 / n);
  if (flag1 || flag2)
    printf("%.12f\n", ans);
  else
    printf("-1\n");
  return 0;
}
