#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a, b;
  cin >> a >> b;
  int t = (a / b) + 1;
  if (t % 2) t--;
  if (t <= 0)
    cout << "-1"
         << "\n";
  else
    cout << fixed << setprecision(16) << double(a + b) / double(t) << "\n";
  return 0;
}
