#include <bits/stdc++.h>
using namespace std;
void faster(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = (char)getchar();
    if (ch == '-') {
      ng = true;
      ch = (char)getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = (char)getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline T Gcd(T a, T b) {
  if (a < 0) return Gcd(-a, b);
  if (b < 0) return Gcd(a, -b);
  return (b == 0) ? a : Gcd(b, a % b);
}
template <typename T>
inline T Lcm(T a, T b) {
  if (a < 0) return Lcm(-a, b);
  if (b < 0) return Lcm(a, -b);
  return a * (b / Gcd(a, b));
}
long long Bigmod(long long base, long long power, long long MOD) {
  long long ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
bool isVowel(char ch) {
  ch = (char)toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
template <typename T>
long long isLeft(T a, T b, T c) {
  return (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y);
}
long long ModInverse(long long number, long long MOD) {
  return Bigmod(number, MOD - 2, MOD);
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
long long toInt(string s) {
  long long sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
bool isPrime(long long val) {
  if (val == 2) return true;
  if (val % 2 == 0 || val == 1) return false;
  long long sqrt_N = (long long)((double)sqrt(val));
  for (long long i = 3; i <= sqrt_N; i += 2) {
    if (val % i == 0) return false;
  }
  return true;
}
template <class T>
string convert(T _input) {
  stringstream blah;
  blah << _input;
  return blah.str();
}
int32_t main() {
  long long x, y;
  x = in<long long>();
  y = in<long long>();
  long long lk, rk;
  lk = (x - y) / (2 * y);
  rk = (x + y) / (2 * y);
  if (lk == 0 && rk == 0) printf("-1\n"), exit(0);
  if (rk == 0 && lk) printf("%.15lf\n", (x - y) / (double)(2.0 * lk)), exit(0);
  if (rk && lk == 0) printf("%.15lf\n", (x + y) / (double)(2.0 * rk)), exit(0);
  printf("%.15lf\n",
         min((x - y) / (double)(2.0 * lk), (x + y) / (double)(2.0 * rk)));
  return 0;
}
