#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007, maxn = 1010;
double a, b;
double funcao(double p);
int main() {
  scanf("%lf %lf", &a, &b);
  if (a < b) {
    printf("-1\n");
    return 0;
  } else if (a == b) {
    printf("%lf\n", b);
    return 0;
  }
  printf("%.12lf\n", min(funcao(a - b), funcao(a + b)));
}
double funcao(double p) {
  int ans = 0;
  int ini = 1, mid, fim = ceil(p) + 1;
  while (ini < fim) {
    mid = (ini + fim) / 2;
    double aux = p / (mid * 2.0);
    if (aux >= b) {
      ini = mid + 1;
      ans = max(ans, mid);
    } else {
      fim = mid;
    }
  }
  return p / (ans * 2.0);
}
