#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a, b, c, temp1, temp2;
  double d, x1 = -1, x2 = -1;
  cin >> a >> b;
  temp1 = (a - b) / (2 * b);
  temp2 = (a + b) / (2 * b);
  if (temp1 > 0) x1 = (a - b) / (2.0 * temp1);
  if (temp2 > 0) x2 = (a + b) / (2.0 * temp2);
  if (x1 <= 0 and x2 <= 0)
    cout << "-1\n";
  else if (x1 <= 0)
    printf("%0.9lf\n", x2);
  else if (x2 <= 0)
    printf("%0.9lf\n", x1);
  else
    printf("%0.9lf\n", min(x1, x2));
  return 0;
}
