#include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
  cin >> a >> b;
  if (a < b) {
    cout << -1;
    return 0;
  }
  if (a == b) {
    cout << a;
    return 0;
  }
  int u = a - b;
  int v = a + b;
  int k = u / 2 / b;
  double x = u;
  x = x / 2 / k;
  k = v / 2 / b;
  double y = v;
  y = y / 2 / k;
  cout << fixed << setprecision(9) << min(x, y);
  return 0;
}
