There is a polyline going through points (0, 0) – (x, x) – (2x, 0) – (3x, x) – (4x, 0) – ... - (2kx, 0) – (2kx + 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.


-----Input-----

Only one line containing two positive integers a and b (1 ≤ a, b ≤ 10^9).


-----Output-----

Output the only line containing the answer. Your answer will be considered correct if its relative or absolute error doesn't exceed 10^{ - 9}. If there is no such x then output  - 1 as the answer.


-----Examples-----
Input
3 1

Output
1.000000000000

Input
1 3

Output
-1

Input
4 1

Output
1.250000000000



-----Note-----

You can see following graphs for sample 1 and sample 3.  [Image]  [Image]

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Geometry

Mathematics


Solutions:
(a, b) = map(int, input().split())
if a < b:
	print(-1)
elif a == b:
	print(a)
else:
	ku = (a - b) // (2 * b)
	kd = (a + b) // (2 * b)
	xd = (a + b) / (2 * kd)
	if ku == 0:
		print(xd)
	else:
		xu = (a - b) / (2 * ku)
		print(min(xu, xd))


import math

def fun(a, b):
	y = (a + b) / 2
	m = math.floor(y / b)
	if m == 0:
		return -1
	return y / m
(a, b) = map(int, input().split())
if b > a:
	print('-1')
elif b == a:
	print(b)
elif b == 0:
	print(fun(a - 1, 1))
else:
	(x, y) = (fun(a, b), fun(a - 2 * b, b))
	mini = min(x, y)
	if mini == -1:
		print(max(x, y))
	else:
		print(mini)


from math import floor

def main():
	(a, b) = map(int, input().split())
	if b > a:
		print(-1)
		return
	if b == a:
		print(a)
		return
	y = (a + b) / 2
	k = y // b
	print(y / k)
main()


(a, b) = map(int, input().split())
if b / a > 1:
	print('-1')
else:
	k = (a / b - 1) // 2 + 1
	if a / b == 2 * k - 1:
		print('%.10f' % b)
	else:
		print((a + b) / (2 * k))


(a, b) = list(map(int, input().split()))
if a < b:
	print(-1)
else:
	k = (a - b) // (2 * b)
	first = 0
	if k > 0:
		first = (a - b) / (2 * k)
	else:
		first = 10 ** 10
	k = (a + b) // (2 * b)
	second = (a + b) / (2 * k)
	print(min(first, second))


(a, b) = map(int, input().split())
if a < b:
	print(-1)
	exit()
k1 = (a - b) // (2 * b)
x1 = (a - b) / (2 * k1) if k1 > 0 else 10 ** 10
k2 = (a + b) // (2 * b)
x2 = (a + b) / (2 * k2)
print(min(x1, x2))


(a, b) = map(int, input().split(' ')[:2])
mx = b
n = (a - b) // (2 * b)
if n < 0:
	print(-1)
	exit(0)
dx = a - (2 * n + 1) * b
ddx = dx / (2 * n + 2)
print(b + ddx)


(a, b) = [int(i) for i in input().split()]
if b > a:
	print(-1)
	exit(0)
ans = 0
c = a - b
d = c / b
d = d // 2 * 2
if d != 0:
	ans = c / d
c = a + b
d = c / b
d = d // 2 * 2
if ans != 0:
	if c / d < ans:
		ans = c / d
else:
	ans = c / d
print(ans)


(a, b) = list(map(int, input().split()))
if b > a:
	print(-1)
else:
	try:
		x = 100000000000
		k = int((a + b) / 2 / b)
		if k != 0:
			x = (a + b) / 2 / k
		k = int((a - b) / 2 / b)
		if k != 0:
			x = min(x, (a - b) / 2 / k)
		print('%.9f' % x)
	except:
		print(-1)


(a, b) = (int(i) for i in input().split())
if a < b:
	print(-1)
elif a == b:
	print(a)
else:
	i1 = (a + b) // (2 * b)
	i2 = (a - b) // (2 * b)
	if i2 == 0:
		print((a + b) / (2 * i1))
	else:
		p = (a + b) / 2
		q = (a - b) / 2
		print(min(p / i1, q / i2))


import sys
(a, b) = map(int, input().split())
if a < b:
	print(-1)
	sys.exit(0)
k = int((a / b + 1) / 2)
z = 2 * k * b / (a + b)
print(a / (2 * k - z))


def find(x, b):
	if x / 2 // b > 0:
		return x / 2 / (x / 2 // b)
	else:
		return 10000000000
(a, b) = map(int, input().split())
if a == b:
	print('%.9f' % a)
elif b > a:
	print(-1)
else:
	print('%.9f' % min(find(a - b, b), find(a + b, b)))


(a, b) = map(int, input().split())
if b <= (a + b) // 2:
	k = 1
	for i in range(29, -1, -1):
		nk = k + (1 << i)
		if b <= (a + b) // (2 * nk):
			k = nk
	x = (a + b) / (2 * k)
	print('{:.10f}'.format(x))
else:
	print(-1)


def solve(a, b):
	if b > a:
		return -1
	if a == b:
		return a
	u = 2 * int((a + b) / (2 * b))
	sol1 = (a + b) / u
	return sol1
(a, b) = map(int, input().split())
result = solve(a, b)
print(result)


(a, b) = map(int, input().strip().split())
if a == b:
	print(b)
elif a < b:
	print(-1)
else:
	k = (a - b) // (2 * b)
	x = (a + b) / (2 * (k + 1))
	print(x)


def main():
	(a, b) = [int(i) for i in input().split(' ')]
	eps = 1e-10
	if b > a:
		print(-1)
	elif b == a:
		print(b)
	elif b == 0:
		print(0)
	else:
		(x1, x2) = (float('inf'), float('inf'))
		(z1, z2) = ((a - b) / 2, (a + b) / 2)
		(k, kk) = (1, 1)
		while kk:
			while z1 / k + eps >= b:
				x1 = z1 / k
				k += kk
				kk *= 2
			k -= kk / 2
			kk //= 4
		(k, kk) = (1, 1)
		while kk:
			while z2 / k + eps >= b:
				x2 = z2 / k
				k += kk
				kk *= 2
			k -= kk / 2
			kk //= 4
		if min(x1, x2) != float('inf'):
			print(min(x1, x2))
		else:
			print(-1)
main()


(a, b) = map(int, input().split())
print(-1 if a < b else (a + b) / (a // b + a // b % 2))


(a, b) = map(int, input().split())

def solve(x, y, temp):
	if temp < 2 * b:
		return 10000000000
	if temp // b % 2 == 0:
		return temp / (temp // b)
	else:
		return temp / (temp // b - 1)
if a < b:
	print(-1)
elif a == b:
	print(a)
else:
	print(min(solve(a, b, a - b), solve(a, b, a + b)))


(n, m) = map(int, input().split())
if m > n:
	print(-1)
else:
	q = int((1.0 + n / m) / 2.0)
	v = (m + n) / (2 * q)
	print(v)


def run1(x, y):
	if x < y:
		return -1
	cst = (x - y) * 0.5
	l = 1
	r = 1000000001
	ans = -1.0
	while l <= r:
		m = l + r >> 1
		now = cst / m
		if now >= y:
			ans = now
			l = m + 1
		else:
			r = m - 1
	return ans

def run2(x, y):
	cst = (x + y) * 0.5
	l = 1
	r = 1000000001
	ans = -1.0
	while l <= r:
		m = l + r >> 1
		now = cst / m
		if now >= y:
			ans = now
			l = m + 1
		else:
			r = m - 1
	return ans
(x, y) = map(int, input().split())
p = run1(x, y)
q = run2(x, y)
ans = -1.0
if ans < 0 or (p > 0 and p < ans):
	ans = p
if ans < 0 or (q > 0 and q < ans):
	ans = q
print(ans)


def get(x, y):
	if x < 2 * y:
		return float('inf')
	p = int(x / y)
	p -= p % 2
	return x / p
(x, y) = map(int, input().split())
if y > x:
	print(-1)
else:
	x1 = x + y
	x2 = x - y
	ans1 = get(x1, y)
	ans2 = get(x2, y)
	ans = min(ans1, ans2)
	if ans == float('inf'):
		print(-1)
	else:
		print(ans)


str_0 = input()
list_0 = str_0.split(' ')
a = int(list_0[0])
b = int(list_0[1])
if a < b:
	print(-1)
elif a == b:
	print('%.12f' % a)
else:
	n_1 = (a + b) / 2 // b
	t_1 = (a + b) / (2 * n_1)
	if b <= (a - b) / 2:
		n_2 = (a - b) / 2 // b
		t_2 = (a - b) / (2 * n_2)
		if t_1 <= t_2:
			t = t_1
		else:
			t = t_2
	else:
		t = t_1
	print('%.12f' % t)


import math
(a, b) = map(float, input().split())
print(-1 if b > a else (a + b) / 2 / math.floor((a + b) / 2 / b))


from sys import stdin, stdout
input = stdin.readline
(a, b) = map(int, input().split())
(z_plus, z_minus) = (float('inf'), float('inf'))
steps_plus = int((a + b) / (2 * b))
steps_minus = int((a - b) / (2 * b))
if steps_plus > 0:
	z_plus = (a + b) / (2 * steps_plus)
if steps_minus > 0:
	z_minus = (a - b) / (2 * steps_minus)
ans = min(z_plus, z_minus)
if ans == float('inf'):
	stdout.write('-1')
else:
	stdout.write('{:.10f}'.format(ans))


from decimal import *
import math
getcontext().prec = 50
(a, b) = map(Decimal, input().split())
print(-1 if b > a else Decimal((a + b) / 2) / math.floor(Decimal((a + b) / 2) / b))


(x, y) = [int(x) for x in input().split()]
n1 = x + y
ans1 = -1
ans2 = -1
if n1 // y - n1 // y % 2 != 0:
	ans1 = n1 / (n1 // y - n1 // y % 2)
n2 = x + y
if n2 // y - n2 // y % 2 != 0:
	ans2 = n2 / (n2 // y - n2 // y % 2)
print(min(ans1, ans2))


def bs(R):
	l = 1
	r = R
	ans = R
	while l <= r:
		mid = (l + r) // 2
		if R / mid > y:
			ans = mid
			l = mid + 1
		else:
			r = mid - 1
	if ans & 1:
		ans -= 1
	return R / ans
(x, y) = map(int, input().split())
if x < y:
	print(-1)
elif x == y:
	print(x)
elif x % y == 0 and x // y % 2 == 1:
	print(y)
else:
	print(bs(x + y))


import math as ma
(a, b) = list(map(int, input().split()))
if b > a:
	print(-1)
else:
	e = []
	d = ma.ceil((a - b) / (2 * b))
	if d > 0:
		if (a - b) / (2 * d) >= b:
			e.append((a - b) / (2 * d))
	if d > 1:
		d -= 1
		if (a - b) / (2 * d) >= b:
			e.append((a - b) / (2 * d))
	d = ma.ceil((a + b) / (2 * b))
	if d > 0:
		if (a + b) / (2 * d) >= b:
			e.append((a + b) / (2 * d))
	if d > 1:
		d -= 1
		if (a + b) / (2 * d) >= b:
			e.append((a + b) / (2 * d))
	if len(e) == 0:
		print(-1)
	else:
		print(min(e))


from sys import stdout, stdin, setrecursionlimit
from bisect import insort, bisect_right, bisect_left
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
(graph, mod, szzz) = ({}, 10 ** 9 + 7, lambda : sorted(zzz()))

def getStr():
	return input()

def getInt():
	return int(input())

def listStr():
	return list(input())

def getStrs():
	return input().split()

def isInt(s):
	return '0' <= s[0] <= '9'

def input():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in input().split()]

def output(answer, end='\n'):
	stdout.write(str(answer) + end)

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
daysInMounth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
(a, b) = zzz()
if a < b:
	print(-1)
else:
	print((a + b) / 2 / ((a + b) // (2 * b)))


import unittest
import sys

class Polyline:

	def __init__(self, test_inputs=None):
		it = iter(test_inputs.split('\n')) if test_inputs else None

		def uinput():
			return next(it) if it else sys.stdin.readline().rstrip()
		[self.a, self.b] = list(map(int, uinput().split()))

	def calculate(self):
		result = float(1)
		if self.a < self.b:
			return '-1'
		if self.a == self.b:
			return str('{0:.12f}'.format(self.b))
		r1 = (self.a + self.b) / (2 * int((self.a + self.b) / (2 * self.b)))
		d = 2 * int((self.a - self.b) / (2 * self.b))
		result = r1 if d == 0 else min(r1, (self.a - self.b) / d)
		return str('{0:.12f}'.format(result))

class unitTests(unittest.TestCase):

	def test_single_test(self):
		test = '3 1'
		d = Polyline(test)
		self.assertEqual(d.a, 3)
		self.assertEqual(d.b, 1)
		self.assertEqual(Polyline(test).calculate(), '1.000000000000')
		test = '1 3'
		self.assertEqual(Polyline(test).calculate(), '-1')
		test = '4 1'
		self.assertEqual(Polyline(test).calculate(), '1.250000000000')
		test = '103 100'
		self.assertEqual(float(Polyline(test).calculate()), 101.5)
		test = '299 100'
		self.assertEqual(float(Polyline(test).calculate()), 199.5)
		test = '310 100'
		self.assertEqual(float(Polyline(test).calculate()), 102.5)

	def time_limit_test(self, nmax):
		import random
		import timeit
		test = str(nmax) + ' ' + str(nmax) + '\n'
		numnums = [str(i) + ' ' + str(i + 1) for i in range(nmax)]
		test += '\n'.join(numnums) + '\n'
		nums = [random.randint(1, 10000) for i in range(nmax)]
		test += ' '.join(map(str, nums)) + '\n'
		start = timeit.default_timer()
		d = Polyline(test)
		calc = timeit.default_timer()
		d.calculate()
		stop = timeit.default_timer()
		print('\nTimelimit Test: ' + '{0:.3f}s (init {1:.3f}s calc {2:.3f}s)'.format(stop - start, calc - start, stop - calc))

def __starting_point():
	sys.setrecursionlimit(100000)
	if sys.argv[-1] == '-ut':
		unittest.main(argv=[' '])
	sys.stdout.write(Polyline().calculate())
__starting_point()


(a, b) = map(int, input().split())
if b > a:
	print(-1)
elif a == b:
	print(a)
else:
	d1 = (a + b) / 2
	d2 = (a - b) / 2
	d1 = d1 / (d1 // b)
	if d2 < b:
		print(d1)
	else:
		d2 = d2 / (d2 // b)
		print(min(d1, d2))


from math import floor
[a, b] = list(map(float, input().split()))
if a < b:
	print(-1)
elif a == b:
	print(a)
else:
	a1 = (a + b) / 2
	k1 = floor(a1 / b)
	x1 = a1 / k1
	a2 = (a - b) / 2
	k2 = floor(a2 / b)
	if k2 == 0:
		x2 = a
	else:
		x2 = a2 / k2
	print(min(x1, x2))


(a, b) = map(int, input().split())

def solve(a, b):
	if a < b:
		return -1
	if b == 0:
		return -1
	if a == b:
		return a
	k0 = (a - b) // (2 * b)
	if k0 == 0:
		x0 = float('inf')
	else:
		x0 = (a - b) / (2 * k0)
	k1 = (a + b) // (2 * b)
	x1 = (a + b) / (2 * k1)
	return min(x0, x1)
print(solve(a, b))


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def is_prime(n):
	m = 2
	while m * m <= n:
		if n % m == 0:
			return False
		m += 1
	return True

def find_left_x(x, y):
	if x < y or k == 0:
		return -1
	x0 = (x - y) / (2 * k)
	return x0

def find_right_x(x, y):
	x0 = (x + y) / (2 * k + 2)
	if x0 < y:
		return -1
	return x0

def get_x(x, y):
	global k
	k = (x - y) // (2 * y)
	if x == y:
		return x
	if k < 0:
		return -1
	(left, right) = (find_left_x(x, y), find_right_x(x, y))
	if left == -1 and right == -1:
		return -1
	if left == -1:
		return right
	if right == -1:
		return left
	return min(left, right)
t = 1
while t:
	t = t - 1
	points = []
	(a, b) = map(int, input().split())
	print('{:.10f}'.format(get_x(a, b)))


(a, b) = [int(i) for i in input().split()]
if a < b:
	print(-1)
else:
	opt1 = (a - b) // b
	if opt1 & 1:
		opt1 -= 1
	opt2 = (a + b) // b
	if opt2 & 1:
		opt2 -= 1
	if opt1 == 0:
		print((a + b) / opt2)
	elif opt2 == 0:
		print((a - b) / opt1)
	else:
		print(min((a - b) / opt1, (a + b) / opt2))


ent = input().split()
x = int(ent[0])
y = int(ent[1])
qn = ((x + y) / (2 * y)).__trunc__()
if qn == 0:
	print(-1)
else:
	n = (x + y) / (2 * qn)
	print(n)


(a, b) = map(int, input().split())
if a < b:
	print(-1)
elif a == b:
	print(a)
else:
	i1 = (a + b) // (2 * b)
	i2 = (a - b) // (2 * b)
	if i2 == 0:
		print((a + b) / (2 * i1))
	else:
		p = (a + b) / 2
		q = (a - b) / 2
		print(min(p / i1, q / i2))


import math
(a, b) = list(map(int, input().split()))
x1 = a - b
x2 = a + b
if x1 < 0:
	print(-1)
elif x1 == 0:
	print('%.12f' % (x2 / 2))
else:
	res2 = x2 / (2 * math.floor((a + b) / (2 * b)))
	print('%.12f' % res2)


(a, b) = [int(i) for i in input().split()]
if a < b:
	print(-1)
else:
	print((a + b) / (2 * int((a + b) / (2 * b))))


import math
(x, y) = [int(i) for i in input().split(' ')]
fail = False
if x < y:
	fail = True
if not fail:
	a = (x + y) / 2
	ans = math.floor(a / y)
	ans = a / ans
	print(ans)
else:
	print(-1)


def main():
	(a, b) = list(map(int, input().split()))
	n = a // b
	if n:
		n -= n + 1 & 1
		print('{:.12f}'.format((a + b) / (n + 1)))
	else:
		print('-1')

def __starting_point():
	main()
__starting_point()


coord = input()
(a, b) = list(map(int, coord.split()))
if b > a:
	print(-1)
else:
	sol1 = (a + b) / (2 * int((a + b) / (2 * b)))
	print(sol1)


from math import floor
(a, b) = map(int, input().split())
if a < 0:
	print(-1)
elif b < 0:
	print(-1)
elif a < b:
	print(-1)
elif a == 0 and b != 0:
	print(-1)
elif a == b:
	print(b)
elif b == 0:
	print(0)
else:
	n1 = floor((a - b) / (2 * b))
	n2 = floor((a + b) / (2 * b))
	if n1 == 0:
		print((a + b) / (2 * n2))
	else:
		x1 = (a - b) / (2 * n1)
		x2 = (a + b) / (2 * n2)
		print(min(x1, x2))


(a, b) = map(int, input().split())
if b > a:
	print(-1)
else:
	x1 = a + b
	x = b
	print(x1 / (2 * (x1 // (2 * x))))


import math
from decimal import *
import sys
inp = input().split()
a = int(inp[0])
b = int(inp[1])
getcontext().prec = 12
if b > a:
	print(-1)
else:
	s = a + b
	d = a - b
	c1 = int((a + b) / b)
	if (a + b) % b == 0:
		c1 = round((a + b) / b)
	if c1 % 2 == 1:
		c1 -= 1
	c2 = int((a - b) / b)
	if (a - b) % b == 0:
		c2 = round((a - b) / b)
	if c2 % 2 == 1:
		c2 -= 1
	if c1 == 0:
		c1 = 2
	if c2 == 0:
		if a == b:
			a2 = b
		else:
			a2 = 437289472397
	else:
		a2 = Decimal(d) / Decimal(c2)
	a1 = Decimal(s) / Decimal(c1)
	ans = min(a1, a2)
	print(ans)


import collections, itertools, fractions, functools, heapq, math, queue

def solve():
	(a, b) = map(int, input().split())
	if a < b:
		return -1
	return (a + b) / (2 * ((a + b) // (2 * b)))
print(solve())


vals = list(map(int, input().split()))
x = vals[0]
y = vals[1]
if x - y >= 0:
	k = (x - y) // (2 * y)
	ans = []
	if x - y == 0:
		ans.append(x)
	elif k != 0:
		a = (x - y) / (2 * k)
		if 2 * k * a <= x <= (2 * k + 1) * a and 0 <= y <= a:
			ans.append(a)
	k = (x + y) // (2 * y) - 1
	a = (x + y) / (2 * (k + 1))
	if (2 * k + 1) * a <= x <= 2 * (k + 1) * a and 0 <= y <= a:
		ans.append(a)
	else:
		None
	if len(ans) > 0:
		print(min(ans))
	else:
		print('-1')
elif x + y >= 0:
	ans = []
	k = (x + 3 * y - 1) // (2 * y) - 1
	a = (x + y) / (2 * (k + 1))
	if (2 * k + 1) * a <= x <= 2 * (k + 1) * a and 0 <= y <= a:
		ans.append(a)
	else:
		None
	if len(ans) > 0:
		print(min(ans))
	else:
		print('-1')


(a, b) = tuple(map(int, input().split()))
if a - b < 0:
	print(-1)
elif a == b:
	print(a)
else:
	i1 = (a + b) // (2 * b)
	i2 = (a - b) // (2 * b)
	if i2 == 0:
		print((a + b) / (2 * i1))
	else:
		x = (a + b) / 2
		y = (a - b) / 2
		print(min(x / i1, y / i2))


def main(a, b):
	if b > a:
		return -1
	k1 = (a - b) // (2 * b)
	if k1 > 0:
		x1 = (a - b) / (2 * k1)
	else:
		x1 = 10 ** 9
	k2 = (a + b) // (2 * b)
	x2 = (a + b) / (2 * k2)
	return min(x1, x2)
(a, b) = list(map(int, input().split()))
print(main(a, b))


import decimal
(a, b) = map(int, input().split())
a = decimal.Decimal(a)
b = decimal.Decimal(b)
if a < b:
	print('-1')
else:
	k = a // b
	ans = round((a + b) / k, 12)
	if k % 2 == 1:
		ans = round((a + b) / (k + 1), 12)
	print(ans)


(a, b) = map(float, input().split(' '))
if a == b:
	print(b)
elif a < b:
	print(-1)
else:
	n = (a - b) // b + 1
	if n % 2 == 0:
		n -= 1
	if n > 1:
		x1 = (a - b) / (n - 1)
	else:
		x1 = 999999999999999999
	n = (a + b) // b - 1
	if n % 2 == 0:
		n -= 1
	x2 = (a + b) / (n + 1)
	print(min(x1, x2))


import sys
from math import sqrt
(x, y) = [int(x) for x in sys.stdin.readline().split()]
if y > x:
	print(-1)
else:
	s = (x + y) / 2
	r = (x - y) / 2
	ans = min(s / int(s / y), r / int(r / y)) if r >= y else s / int(s / y)
	print(ans)


import math
(a, b) = map(int, input().split())
if b <= a:
	k = math.floor((a + b) / (2 * b))
	print((a + b) / (2 * k))
else:
	print(-1)


from math import floor
(a, b) = [int(i) for i in input().split()]
if a < b:
	print(-1)
else:
	print((a + b) / (2 * floor((a + b) / (2 * b))))


(a, b) = map(int, input().split())
if b - a == 0:
	print('%.12f' % b)
elif int((a - b) / (2 * b)) == 0 and int((a + b) / (2 * b)) == 0:
	print(-1)
elif int((a - b) / (2 * b)) != 0 and int((a + b) / (2 * b)) != 0:
	print('%.12f' % min((a - b) / (2 * int((a - b) / (2 * b))), (a + b) / (2 * int((a + b) / (2 * b)))))
elif int((a - b) / (2 * b)) == 0 and int((a + b) / (2 * b)) != 0:
	print('%.12f' % ((a + b) / (2 * int((a + b) / (2 * b)))))


(a, b) = map(float, input().split())
if b > a:
	print(-1)
	exit()
v = (a + b) / 2 / ((a + b) // (2 * b))
print(v)


s = input().split()
a = int(s[0])
b = int(s[1])
if b > a:
	print('-1')
elif b == a:
	print(a)
else:
	m = (a + b) / (2 * b)
	m = int(m)
	m = 2 * m
	m = (a + b) / m
	if b > m:
		m = b
	n = (a - b) / (2 * b)
	n = int(n)
	n = 2 * n
	if n == 0:
		n = m + 1
	else:
		n = (a - b) / n
	if b > n:
		n = b
	print(min(m, n))


import sys
(x, y) = (int(x) for x in input().split())
if y > x:
	print(-1)
elif x == y:
	print(x)
else:
	k = int(x / y + 1)
	k -= k % 2
	z_first = (x + y) / k
	k = int(x / y - 1)
	k -= k % 2
	if k != 0:
		z_second = (x - y) / k
	else:
		z_second = z_first
	ans = min(z_first, z_second)
	print(ans)


from fractions import Fraction

def solve(a, b):
	x = Fraction(b)
	n = a // (x * 2)
	a_ = a % (x * 2)
	if b > a:
		return -1
	if a_ == x:
		return float(x)
	if a_ < x:
		return float((a + b) / (2 * n))
	if a_ > x:
		return float((a + b) / (2 * n + 2))
(a, b) = map(Fraction, input().split())
print(solve(a, b))


import sys
(a, b) = list(map(int, sys.stdin.readline().split()))
if b > a:
	print(-1)
elif b == a:
	print(a)
else:
	t = (a + b) / (2 * int((a + b) / b / 2))
	print(t)


from math import floor
(a, b) = map(int, input().split())
if a < b:
	print(-1)
elif floor((a - b) / (2 * b)) == 0:
	print((a + b) / (2 * floor((a + b) / (2 * b))))
else:
	print(min((a - b) / (2 * floor((a - b) / (2 * b))), (a + b) / (2 * floor((a + b) / (2 * b)))))


def solve(a, b):
	if b > a:
		return -1
	if a == b:
		return a
	sol1 = (a + b) / (2 * int((a + b) / (2 * b)))
	u = 2 * int((a - b) / (2 * b))
	sol2 = (a - b) / u if u != 0 else sol1 + 1
	return min(sol1, sol2)
(a, b) = map(int, input().split())
result = solve(a, b)
print(result)