#include <bits/stdc++.h>
using namespace std;
int a, b, k1, k2;
double x1, x2;
int main() {
  scanf("%d%d", &a, &b);
  if (a < b) {
    printf("-1\n");
    return 0;
  }
  k1 = (a - b) / (2 * b);
  x1 = k1 ? (1. * (a - b) / 2. / k1) : (a == b ? a : a * 2);
  k2 = (a + b) / (2 * b) - 1;
  x2 = 1. * (a + b) / (2 * k2 + 2);
  printf("%.10lf\n", min(x1, x2));
  return 0;
}
