#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream &operator>>(istream &in, vector<T> &v) {
  for (size_t i = 0; i < v.size(); ++i) in >> v[i];
  return in;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> const &v) {
  for (size_t i = 0; i < v.size(); ++i) out << v[i] << " ";
  return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> const &p) {
  out << p.first << " " << p.second;
  return out;
}
ostream &operator<<(ostream &out, double *const &n) {
  long long v = (long long)((*n) * 1e7);
  char s[32];
  memset(s, '0', 32);
  int c = 0;
  if (v == 0) {
    out.put('0');
    return out;
  }
  if (v < 0) {
    out.put('-');
    v = -v;
  }
  while (v > 0 && c < 32) {
    s[c++] = v % 10 + '0';
    v /= 10;
  }
  c = max(c, 8);
  for (int i = c - 1; i >= 0; --i) {
    if (i == 6) out.put('.');
    out.put(s[i]);
  }
  return out;
}
template <typename T>
T ternary_search(T left, T right, T func(T x)) {
  for (int i = 0; i < 100; ++i) {
    T delta = (right - left) / 3;
    T mid1 = left + delta, mid2 = left + delta * 2;
    if (func(mid1) >= func(mid2))
      right = mid2;
    else
      left = mid1;
  }
  return func(right);
}
int MONTHS[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
void solution();
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solution();
  return EXIT_SUCCESS;
}
double s(double x1, double y1, double x2, double y2) {
  return x1 * y2 - x2 * y1;
}
void solution() {
  int a, b;
  cin >> a >> b;
  if (b > a) {
    cout << -1;
  } else if (a == b) {
    cout << b;
  } else {
    int k = a / b;
    if (k % 2 == 0) --k;
    double l = b, r = 12.0 * max(a, b);
    for (int i = 0; i < 300 && r - l > 1e-14; ++i) {
      double mid = l + (r - l) / 2.0;
      if (s(mid * k - a, mid - b, mid * k + mid - a, 0 - b) <= 0)
        r = mid;
      else
        l = mid;
    }
    cout.precision(12);
    cout << fixed << r << endl;
  }
}
