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