#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  double a, b;
  cin >> a >> b;
  const double eps = 1e-9;
  if (a < -eps or b - a > eps or b < -eps) {
    cout << -1 << '\n';
    return 0;
  }
  double f = a / 2 + b / 2;
  long long d = floor(f / b);
  if (d == 0) {
    cout << -1 << '\n';
    return 0;
  }
  cout << fixed << setprecision(10) << f / d << endl;
  return 0;
}
