There is a polyline going through points (0, 0) – (*x*, *x*) – (2*x*, 0) – (3*x*, *x*) – (4*x*, 0) – ... - (2*kx*, 0) – (2*kx* + *x*, *x*) – .... 

We know that the polyline passes through the point (*a*, *b*). Find minimum positive value *x* such that it is true or determine that there is no such *x*.
Only one line containing two positive integers *a* and *b* (1 ≤ *a*, *b* ≤ 10<sup class="upper-index">9</sup>).
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))

import math
def solve(a, b):
    result = float("inf")
    # b is the peak
    if a % b == 0:
        if (a // b) % 2 == 1:
            result = min(result, b)
    
    # (a, b) is part of the upward slope
    x_intercept = a - b
    if x_intercept == 0:
        assert result != float("inf")
    else:
        i = math.floor(x_intercept / (2*b))
        if i > 0:
            size = x_intercept / (2*i)
            result = min(result, size)

    # (a, b) is part of the downward slope
    x_intercept = a + b
    i = math.floor(x_intercept / (2*b))
    if i > 0:
        size = x_intercept / (2*i)
        result = min(result, size)

    return -1 if result == float("inf") else result


if __name__ == "__main__":
    a, b = arr_in()
    out(solve(a, b))