#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  if (a < b) {
    cout << -1;
    return 0;
  }
  if (a == b) {
    cout << a;
    return 0;
  }
  int t = (a - b) / (2 * b);
  double min_x = (double)(a - b) / 2 / t;
  t = (a + b) / (2 * b);
  min_x = min(min_x, (double)(a + b) / 2 / t);
  cout.precision(12);
  cout << min_x;
}
