#include <bits/stdc++.h>
using namespace std;
double a, b, ans1, ans2;
int main() {
  scanf("%lf%lf\n", &a, &b);
  if (b > a) {
    printf("%d", -1);
    return 0;
  }
  if (b == a) {
    printf("%.10lf\n", b);
    return 0;
  }
  double tmp = a + b;
  int k = tmp / b;
  if (k & 1) k--;
  ans2 = tmp / k;
  printf("%.10lf\n", ans2);
  return 0;
}
