#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b;
  scanf("%lf%lf", &a, &b);
  if (b > a) {
    puts("-1");
    return 0;
  }
  if (a == b) {
    printf("%.9f\n", a);
    return 0;
  }
  double an1 = 1e10, an2 = 1e10;
  long long le = 0, ri = 1e9;
  long long mid;
  while (ri >= le) {
    mid = (le + ri) / 2;
    double tmp = (a - b) / 2 / mid;
    if (tmp < b) {
      ri = mid - 1;
    } else {
      le = mid + 1;
      an1 = tmp;
    }
  }
  ri = 1e9;
  le = 0;
  while (ri >= le) {
    mid = (le + ri) / 2;
    double tmp = (a + b) / 2 / mid;
    if (tmp < b) {
      ri = mid - 1;
    } else {
      le = mid + 1;
      an2 = tmp;
    }
  }
  printf("%.9f\n", min(an1, an2));
  return 0;
}
