#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, f, l, mid;
  double x, k;
  x = -1;
  cin >> a >> b;
  if (a == b)
    cout << b << endl;
  else {
    if (a > b) {
      f = 1;
      l = 1000000000;
      while (f <= l) {
        mid = (f + l) / 2;
        k = (double)(a - b) / (2.0 * mid);
        if (k < b) {
          l = mid - 1;
        }
        if (k >= b) {
          x = k;
          f = mid + 1;
        }
      }
    }
    f = 1;
    l = 1000000000;
    while (f <= l) {
      mid = (f + l) / 2;
      k = (double)(a + b) / (2.0 * mid);
      if (k < b) {
        l = mid - 1;
      } else if (k >= b) {
        if (x == -1)
          x = k;
        else if (x > k)
          x = k;
        f = mid + 1;
      }
    }
    if (x != -1)
      printf("%0.12lf", x);
    else
      printf("-1");
  }
  return 0;
}
