#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  if (b > a) {
    cout << -1 << endl;
    return 0;
  }
  if ((a % b == 0) && ((a / b) % 2)) {
    cout << b << endl;
    return 0;
  }
  int i = a / b;
  if (i % 2 != 0) i++;
  printf("%.12f\n", (float)(b + a) / (float)(i));
  return 0;
}
