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>).
import sys
input = lambda: sys.stdin.readline().rstrip()
import math
from heapq import heappush , heappop
from collections import defaultdict,deque,Counter
from bisect import *

a,b = map(int, input().split())
if a<b:
    exit(print(-1))

if a==b:
    exit(print(a))
    
def check(n,m,b):
    t = n/(m+m)
    if t>=b:
        return True
    return False
    
def deal(n,b):
    l,r=1,10**9+1
    while l+1<r:
        m = (l+r)//2
        if check(n,m,b):
            l = m
        else:
            r = m
    #print(n,l*2)
    return n/(l+l)
    
a1 = deal(a-b,b)
a2 = deal(a+b,b)
print(min(a1,a2))
        