#include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  if (ifstream("test.inp")) cin.rdbuf((new ifstream("test.inp"))->rdbuf());
  cout.precision(9);
  cout << fixed;
  cin >> a >> b;
  if (a == b)
    cout << a;
  else {
    double v = (b - a) / 2.0;
    int k = floor(v / b);
    if (k > 0) {
      cout << v / k;
      return 0;
    }
    v = (a + b) / 2.0;
    k = floor(v / b);
    if (k > 0) {
      cout << v / k;
      return 0;
    }
    cout << "-1";
  }
}
