#include <bits/stdc++.h>
using namespace std;
int a, b;
int k;
int main() {
  cin >> a >> b;
  if (b > a) {
    cout << "-1\n";
    return 0;
  }
  if (a == b) {
    cout << a << endl;
    return 0;
  }
  k = a / b;
  if (k & 1) k++;
  double ans = (a + b) * 1.0 / k;
  printf("%.10f\n", ans);
  return 0;
}
