#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b, i, j, k, c, m = -1;
  cin >> a >> b;
  c = floor((b - a) / 2.0 * b);
  if (a == b) m = a;
  if (c != 0) {
    m = ((b - a) / (2 * c));
    if (m < b) m = -1;
  }
  c = floor((b + a) / (2.0 * b));
  if (c != 0) {
    if (m != -1) {
      if (m > ((b + a) / (2 * c))) m = ((b + a) / (2 * c));
    } else
      m = ((b + a) / (2 * c));
    if (m < b) m - 1;
  }
  cout.precision(15);
  if (m != -1)
    cout << fixed << m << endl;
  else
    cout << -1 << endl;
  return 0;
}
