#include <bits/stdc++.h>
using namespace std;
const int MAX_INT = std::numeric_limits<int>::max();
const int MIN_INT = std::numeric_limits<int>::min();
const int INF = MAX_INT;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
int main() {
  double a, b, mn = INF, n;
  cin >> a >> b;
  n = floor((a - b) / (2 * b));
  if (n > 0) mn = (a - b) / n / 2;
  n = floor((a + b) / (2 * b));
  if (n > 0) mn = (mn < (a + b) / n / 2 ? mn : (a + b) / n / 2);
  if (mn == INF)
    printf("-1\n");
  else
    printf("%.12lf\n", mn);
  return 0;
}
