#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long double x, y, z;
  long double a, b;
  cin >> a >> b;
  y = ((a * 1.0) + (b * 1.0)) / 2.0;
  z = ((a * 1.0) - (b * 1.0)) / 2.0;
  int n, m;
  n = y / b;
  m = z / b;
  if (n <= 0 || m < 0) {
    cout << "-1";
    return 0;
  }
  n;
  long double ans = (y / (long double)(n * 1.0));
  if (m == 0) {
    if (a == b) ans = min(ans, b);
    printf("%.12Lf", ans);
    return 0;
  }
  ans = min(ans, (z / (long double)(m * 1.0)));
  printf("%.12Lf", ans);
  return 0;
}
