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