#include <bits/stdc++.h>
using namespace std;
int a, b;
void parse() {
  cin >> a;
  cin >> b;
}
void solve() {
  if (a < b) {
    cout << -1 << endl;
    return;
  }
  if (a == b) {
    cout << b << endl;
    return;
  }
  float c1, c2;
  c1 = (float)(a - b);
  c2 = (float)(b + a);
  float p1, p2;
  p1 = (int)c1 / (2 * b);
  p2 = (int)c2 / (2 * b);
  cout << min(c1 / (2 * p1), c2 / (2 * p2)) << endl;
}
int main() {
  ios::sync_with_stdio(false);
  std::cout.precision(10);
  parse();
  solve();
  cout << endl;
  return 0;
}
