#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(const T &a) {
  return a * a;
}
const double eps = 1e-11;
int main() {
  int a, b;
  long double ans = 2e18;
  scanf("%d%d", &a, &b);
  int l = 0, r = 1e9 + 1;
  while (r - l > 1) {
    int m = (l + r) / 2;
    long double x = (a + b) / 2.0 / m;
    if (x + eps >= b)
      l = m;
    else
      r = m;
  }
  if (l) ans = (a + b) / 2.0 / l;
  l = 0, r = 1e9 + 1;
  while (r - l > 1) {
    int m = (l + r) / 2;
    long double x = (a - b) / 2.0 / m;
    if (x + eps >= b)
      l = m;
    else
      r = m;
  }
  if (l && (a - b) / 2.0 / l < ans) ans = (a - b) / 2.0 / l;
  if (ans < 1e18)
    printf("%.20f\n", (double)ans);
  else
    puts("-1");
}
