#include <bits/stdc++.h>
using namespace std;
int A, B;
int main() {
  scanf("%d %d", &A, &B);
  if (B > A)
    puts("-1");
  else if (A == B)
    printf("%.12lf\n", (double)A);
  else {
    int C1 = A - B;
    int C2 = A + B;
    int step1 = C1 / (2 * B);
    int step2 = C2 / (2 * B);
    printf("%.12lf\n",
           min((((double)C1) / (2 * step1)), ((double)C2 / (2 * step2))));
  }
}
