#include <bits/stdc++.h>
using namespace std;
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
int main() {
  int a = in(), b = in();
  if (b > a) {
    cout << -1 << endl;
    return 0;
  }
  double p = a + b, m = a - b;
  double pa = floor(p / 2 / b);
  double ma = floor(m / 2 / b);
  p = p / 2 / pa;
  m = m / 2 / ma;
  printf("%.12lf\n", p > m ? m : p);
}
