#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cout.tie(nullptr);
  int a, b;
  cin >> a >> b;
  if (b > a) {
    cout << "-1" << endl;
    return 0;
  }
  if (b == a) {
    cout << a << endl;
    return 0;
  }
  int r = a / b;
  if (r % 2 == 0) --r;
  cout.precision(10);
  cout << fixed;
  cout << static_cast<double>(b + a) / (r + 1) << endl;
  return 0;
}
