AtCoder Beginner Contest 158 - Tax Increase

Find the price of a product before tax such that, when the consumption tax rate is 8 percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)
Here, the price before tax must be a positive integer, and the amount of consumption tax is rounded down to the nearest integer.
If multiple prices satisfy the condition, print the lowest such price; if no price satisfies the condition, print -1.

-----Constraints-----
 - 1 \leq A \leq B \leq 100
 - A and B are integers.

-----Input-----
Input is given from Standard Input in the following format:
A B

-----Output-----
If there is a price that satisfies the condition, print an integer representing the lowest such price; otherwise, print -1.

-----Sample Input-----
2 2

-----Sample Output-----
25

If the price of a product before tax is 25 yen, the amount of consumption tax levied on it is:
 - When the consumption tax rate is 8 percent: \lfloor 25 \times 0.08 \rfloor = \lfloor 2 \rfloor = 2 yen.
 - When the consumption tax rate is 10 percent: \lfloor 25 \times 0.1 \rfloor = \lfloor 2.5 \rfloor = 2 yen.
Thus, the price of 25 yen satisfies the condition. There are other possible prices, such as 26 yen, but print the minimum such price, 25.

Difficulty: EASY

Starter code:

Solutions:
(a, b) = list(map(int, input().split()))
b *= 10
l = [i for i in range(b, b + 10) if int(i * 0.08) == a]
print(-1 if len(l) == 0 else min(l))


(A, B) = map(int, input().split())
print([max((a := (0 - -A * 25 // 2)), (c := (B * 10))), -1][~(a - 10 < c < (A + 1) * 25 // 2)])


(A, B) = map(int, input().split())
for i in range(1010):
	if int(i * 0.08) == A and i // 10 == B:
		print(i)
		exit()
print(-1)


(a, b) = map(int, input().split())
l = max(0 - -a * 25 // 2, b * 10)
print([-1, l][l < min(-~a * 25 // 2, -~b * 10)])


(A, B) = map(int, input().split())
for i in range(10000):
	if i * 8 / 100 // 1 == A and i / 10 // 1 == B:
		print(i)
		break
else:
	print(-1)


(a, b) = map(int, input().split())
for i in range(1300):
	if int(i * 0.08) == a and int(i * 0.1) == b:
		print(i)
		exit()
print(-1)


def main():
	(a, b) = map(int, input().split())
	ans = -1
	import math
	i = 1
	f = False
	while True:
		if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
			ans = i
			f = True
			break
		elif math.floor(i * 0.08) > a or math.floor(i * 0.1) > b:
			f = False
			break
		i += 1
	return ans

def __starting_point():
	print(main())
__starting_point()


(a, b) = map(int, input().split())
ans = -1
for i in range(11000):
	if int(i * 1.08) == i + a and int(i * 1.1) == i + b:
		ans = i
		break
print(ans)


import math
import sys
(A, B) = list(map(int, input().split()))
list1 = list(range(1, 1001, 1))
s = 0
for i in list1:
	x = i // 12.5
	y = i // 10
	if x == A and y == B:
		print(str(i))
		s = s + 1
		return
print('-1')


import math
(A, B) = map(int, input().split())
c = max(math.ceil(A / 0.08), B * 10)
d = min(int((A + 1) / 0.08), B * 10 + 10)
print([-1, c][c < d])


(a, b) = map(int, input().split())
(al, ar, bl, br) = (0 - -a * 25 // 2, a * 25 // 2 + 12, b * 10, b * 10 + 9)
print([max(al, bl), -1][ar < bl or br < al])


(a, b) = map(int, input().split())
for i in range(20000):
	if int(i * 8 / 100) == a and int(i * 10 / 100) == b:
		print(i)
		break
else:
	print(-1)


def main():
	(A, B) = list(map(int, input().split()))
	ans = -1
	for i in range(10001):
		if i * 8 // 100 == A and i // 10 == B:
			ans = i
			break
	print(ans)

def __starting_point():
	main()
__starting_point()


(A, B) = map(int, input().split())
ret = -1
for i in range(2000):
	if A == int(i * 0.08) and B == int(i * 0.1):
		ret = i
		break
print(ret)


import math
(a, b) = list(map(int, input().split()))
ans = -1
for i in range(1010):
	if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
		ans = i
		break
print(ans)


(A, B) = map(int, input().split())
s = -1
for i in range(10, 1250):
	if A == int(0.08 * i) and B == int(0.1 * i):
		s = i
		break
print(s)


(A, B) = map(int, input().split())
left2 = B * 10
right2 = (B + 1) * 10
if A * 100 / 8 != int(A * 100 / 8):
	left1 = int(A * 100 / 8) + 1
else:
	left1 = A * 100 // 8
if (A + 1) * 100 / 8 != int((A + 1) * 100 / 8):
	right1 = (A + 1) * 100 / 8
else:
	right1 = (A + 1) * 100 // 8 - 1
if left1 >= left2 and right2 > left1:
	print(left1)
	return
if left1 <= left2 and right1 > left2:
	print(left2)
	return
print(-1)


(A, B) = map(int, input().split())
p = max((25 * A + 1) // 2, (20 * B + 1) // 2)
if p * 2 >= min(25 * (A + 1), 20 * (B + 1)):
	p = -1
print(p)


(a, b) = map(int, input().split())
if 25 * (a + 1) <= 20 * b or 20 * (b + 1) <= 25 * a:
	print(-1)
else:
	print(max(10 * b, int((25 * a + 1) / 2)))


(a, b) = map(int, input().split())
for i in range(15000):
	if int(i * 0.08) == a and int(i * 0.1) == b:
		print(i)
		break
else:
	print(-1)


(A, B) = map(int, input().split())
for k in range(1, 1010):
	if (int(k * 0.08) == A) & (int(k * 0.1) == B):
		print(k)
		exit()
print(-1)


(x, y) = map(int, input().split())
for i in range(10 ** 6):
	if int(i * 0.08) == x and int(i * 0.1) == y:
		print(i)
		exit()
print(-1)


(n, m) = map(int, input().split())
for i in range(1, 1263):
	if int(i * 0.08) == n and int(i * 0.1) == m:
		print(i)
		break
else:
	print(-1)


from math import floor
(a, b) = map(int, input().split(' '))
d = False
for p in range(1009):
	if floor(p * 0.08) == a and floor(p * 0.1) == b:
		print(p)
		d = True
		break
if not d:
	print(-1)


(A, B) = map(int, input().split())
ans = -1
for i in range(2000):
	if i * 8 // 100 == A and i // 10 == B:
		ans = i
		break
print(ans)


import os, sys, re, math
(A, B) = [int(n) for n in input().split()]
answer = -1
for i in range(10001):
	a = i * 8 // 100
	b = i * 10 // 100
	if a == A and b == B:
		answer = i
		break
print(answer)


import math
(A, B) = list(map(int, input().split()))
for i in range(int(100 / 0.08)):
	if math.floor(i * 0.08) == A and math.floor(i * 0.1) == B:
		print(i)
		return
print(-1)


(A, B) = map(int, input().split())
c = max(-(-A * 100 // 8), B * 10)
d = min((A + 1) * 100 // 8, B * 10 + 10)
print([-1, c][c < d])


(a, b) = map(int, input().split())
a_min = int(a / 0.08)
b_min = int(b / 0.1)
a_list = [i for i in range(a_min, a_min + 100, 1) if int(i * 0.08) == a]
b_list = [j for j in range(b_min, b_min + 100, 1) if int(j * 0.1) == b]
ans = -1
for k in a_list:
	if k in b_list:
		ans = k
		break
print(ans)


(a, b) = list(map(int, input().split()))
for i in range(10 * b, 10 * (b + 1)):
	if int(0.08 * i) == a:
		break
else:
	i = -1
print(i)


(a, b) = map(int, input().split())
ans = -1
for i in range(2000):
	if i * 8 // 100 == a and i * 10 // 100 == b:
		ans = i
		break
print(ans)


(a, b) = map(int, input().split())
print(([i for i in range(10 ** 6) if (i // 12.5 == a) * i // 10 == b] + [-1])[0])


import sys
(A, B) = map(int, input().split())
x = 0
for b in range(B * 10, B * 10 + 10):
	if int(b * 0.08) == A:
		print(b)
		sys.exit()
print(-1)


(a, b) = map(int, input().split())
x = min([n if (n * 0.08 // 1 - a, n * 0.1 // 1 - b) == (0, 0) else 100000.0 for n in range(1500)])
print(x if x < 100000.0 else -1)


(A, B) = map(int, input().split())
ans = -1
for i in range(1, 1001):
	if i * 0.08 // 1 == A and i * 0.1 // 1 == B:
		ans = i
		break
print(ans)


(A, B) = map(int, input().split())
p = 0.08
q = 0.1
a = 0 - -A // p
b = (A + 1) // p
c = 0 - -B // q
d = (B + 1) // q
print([int(max(a, c)), -1][d <= a or b <= c])


(A, B) = map(int, input().split())
for n in range(1, 1001):
	if int(n * 0.08) == A and int(n * 0.1) == B:
		print(n)
		exit()
print(-1)


(a, b) = map(int, input().split())
for i in range(1, 1001):
	if i * 0.08 // 1 == a and i * 0.1 // 1 == b:
		print(i)
		quit()
print(-1)


(A, B) = [int(s) for s in input().split(' ')]
for p in range(10000):
	if int(p * 0.08) == A and int(p * 0.1) == B:
		print(p)
		return
print(-1)


(a, b) = list(map(int, input().split()))
ans = -1
for price in range(10000):
	tax_a = int(price * 0.08)
	tax_b = int(price * 0.1)
	if tax_a == a and tax_b == b:
		ans = price
		break
print(ans)


import math
(A, B) = map(int, input().split())
b1 = B * 10
b2 = b1 + 10
for i in range(b1, b2):
	if math.floor(i * 0.08) == A:
		print(i)
		break
	if i == b2 - 1:
		print(-1)


(a, b) = map(int, input().split())
x = -1
for i in range(1, 10001):
	if a == int(i * 0.08) and b == int(i * 0.1):
		x = i
		break
print(x)


(A, B) = map(int, input().split())
for i in range(10001):
	if i * 8 // 100 == A and i * 10 // 100 == B:
		print(i)
		exit()
print(-1)


from decimal import Decimal
(a, b) = map(int, input().split())
x = []
s = a / Decimal('0.08')
t = (a + 1) / Decimal('0.08')
u = b / Decimal('0.1')
v = (b + 1) / Decimal('0.1')
x.append(s)
x.append(t)
x.append(u)
x.append(v)
ans = []
for i in range(int(min(x)), int(max(x)) + 1):
	if a / Decimal('0.08') <= i < (a + 1) / Decimal('0.08') and b / Decimal('0.1') <= i < (b + 1) / Decimal('0.1'):
		ans.append(i)
if not ans:
	print('-1')
else:
	print(min(ans))


(a, b) = map(int, input().split())
s = -1
for c in range(10 * b, 10 * (b + 1)):
	if int(c * 0.08) == a:
		s = c
		break
print(s)


(A, B) = list(map(int, input().split()))
if A % 2 == 0:
	A_min = int(A * 12.5)
	A_max = A_min + 12
else:
	A_min = int(A * 12.5 + 0.5)
	A_max = A_min + 11
B_min = B * 10
B_max = B_min + 9
A_range = [n for n in range(A_min, A_max + 1)]
B_range = [n for n in range(B_min, B_max + 1)]
ans = -1
for n in A_range[::-1]:
	if n in B_range:
		ans = n
print(ans)


(A, B) = list(map(int, input().split()))
for x in range(1001):
	if x * 8 // 100 == A and x // 10 == B:
		print(x)
		break
else:
	print(-1)


(A, B) = map(int, input().split())
c = -1
for i in range(1, 10 ** 5):
	if int(i * 0.08) == A and int(i * 0.1) == B:
		c = i
		break
print(c)


(A, B) = map(int, input().split())
print([-1, (c := (-min(-A * 25 // 2, -B * 10)))][(A + 1) * 25 > c * 2 < B * 20 + 20])


(a, b) = list(map(int, input().split()))
ans = -1
for n in range(10 * b, 10 * (b + 1)):
	if int(n * 1.1) - b == int(n * 1.08) - a:
		ans = n
		break
print(ans)


(A, B) = map(int, input().split())
v = max(A * 25 + 1 >> 1, B * 10)
print(v if v < min(A * 25 + 26 >> 1, B * 10 + 10) else -1)


(A, B) = map(int, input().split())
for i in range(1500000):
	if i * 0.08 // 1 == A:
		if i * 0.1 // 1 == B:
			print(i)
			exit()
print(-1)


(a, b) = list(map(int, input().split()))
for x in range(max(a, b), 2000):
	if x * 8 // 100 == a and x // 10 == b:
		print(x)
		return
print(-1)


(A, B) = map(float, input().split())
from math import ceil
c = ceil(A / 0.08)
d = ceil(B / 0.1)
if c == d:
	print(c)
elif c < d and d < ceil((A + 1) / 0.08):
	print(d)
elif d < c and c < ceil((B + 1) / 0.1):
	print(c)
else:
	print(-1)


import math
(A, B) = map(int, input().split())
mini = max(math.ceil(A / 0.08), B * 10)
maxi = min(int((A + 1) / 0.08), (B + 1) * 10)
if mini >= maxi:
	print(-1)
else:
	print(mini)


import math
(A, B) = map(int, input().split())
p1 = 0.08
p2 = 0.1
a_l = math.ceil(A / p1)
a_r = math.floor((A + 1) / p1)
b_l = math.ceil(B / p2)
b_r = math.floor((B + 1) / p2)
if b_r <= a_l or a_r <= b_l:
	print(-1)
else:
	print(max(a_l, b_l))


(A, B) = map(int, input().split())
for i in range(B * 10, (B + 1) * 10):
	if int(i * 0.08) == A:
		print(i)
		break
else:
	print(-1)


(a, b) = map(int, input().split())
for i in range(1010):
	if i * 8 // 100 == a and i // 10 == b:
		print(i)
		exit()
print(-1)


(a, b) = map(int, input().split())
f = -1
for i in range(1, 10000):
	if int(i * 0.08) == a and int(i * 0.1) == b:
		f = i
		break
print(f)


(a, b) = map(int, input().split())
for x in range(10 * b, 10 * (b + 1)):
	if 2 * x // 25 == a:
		print(x)
		break
else:
	print(-1)


(a, b) = map(int, input().split())
l = max(a * 25 + 1 >> 1, b * 10)
print(l * (~a * 25 / 2 < -l > ~b * 10) or -1)


(a, b) = map(int, input().split())
for x in range(1, 100000):
	if x // 10 == b and 8 * x // 100 == a:
		print(x)
		exit()
print(-1)


(a, b) = map(int, input().split())
for n in range(1, 10001):
	if n * 8 // 100 == a and n * 10 // 100 == b:
		print(n)
		exit()
print(-1)


(A, B) = map(int, input().split())
money = B * 10
ans = -1
while money // 10 == B:
	if int(money * 0.08) == A:
		ans = money
		break
	money += 1
print(ans)


(A, B) = map(int, input().split())
p = 0.08
a = 0 - -A // p
b = (A + 1) // p
c = B * 10
d = c + 10
print([int(max(a, c)), -1][(d <= a) | (b <= c)])


(a, b) = map(int, input().split())
i = 0
x = int(a / 0.08)
while True:
	if int((x + i) * 0.1) == b and int((x + i) * 0.08) == a:
		ans = int(x + i)
		break
	elif int((x + i) * 0.1) > b:
		ans = '-1'
		break
	else:
		i += 1
print(ans)


(a, b) = map(int, input().split())
for x in range(1, 2000):
	if int(x * 0.08) == a and int(x * 0.1) == b:
		print(x)
		exit(0)
print(-1)


(A, B) = map(int, input().split())
for i in range(4 ** 6):
	if int(i * 0.08) == A and int(i * 0.1) == B:
		print(i)
		break
else:
	print(-1)


(a, b) = map(int, input().split())
res = -1
for i in range(1010):
	if int(i * 0.08) == a and int(i * 0.1) == b:
		res = i
		break
print(res)


(a, b) = map(int, input().split())
for i in range(2000):
	if int(i * 2 / 25) == a and int(i / 10) == b:
		print(i)
		exit()
print('-1')


def main():
	(A, B) = tuple([int(_x) for _x in input().split()])
	for m in range(2000):
		if m * 108 // 100 - m == A and m * 110 // 100 - m == B:
			print(m)
			return
	print(-1)
main()


(a, b) = map(int, input().split())
for i in range(1, 1262):
	if int(i * 0.08) == a and int(i * 0.1) == b:
		print(i)
		return
print('-1')


import math
(a, b) = map(int, input().split())
ans = float('inf')
for x in range(1001):
	if int(math.floor(x * 1.08)) - x == a and int(math.floor(x * 1.1)) - x == b:
		ans = min(ans, x)
if ans == float('inf'):
	print(-1)
else:
	print(ans)


(A, B) = map(int, input().split())
C = -1
for i in range(20000):
	if int(i * 0.08) == A and int(i * 0.1) == B:
		C = i
		break
print(C)


A = [0] * 1010
B = [0] * 1010
for i in range(1, 1010):
	A[i] = int(i * 0.08)
	B[i] = int(i * 0.1)
(x, y) = map(int, input().split())
X = [s for (s, t) in enumerate(A) if t == x]
Y = [s for (s, t) in enumerate(B) if t == y]
for i in X:
	if i in Y:
		print(i)
		return
print(-1)


(A, B) = map(int, input().split())
r = -1
for i in range(1001):
	if i * 8 // 100 == A and i * 10 // 100 == B:
		r = i
		break
print(r)


(a, b) = map(int, input().split())
x = []
for i in range(1250):
	if i * 0.08 // 1 == a and i * 0.1 // 1 == b:
		print(i)
		exit()
else:
	print(-1)


import math
import sys
(a, b) = map(int, input().split())
for i in range(10001):
	if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
		print(i)
		return
print('-1')


(A, B) = map(int, input().split())
k = -1
for i in range(10000):
	if int(i * 0.08) == A and int(i * 0.1) == B:
		k = i
		break
print(k)


(A, B) = map(int, input().split())
for N in range(10000):
	if int(N * 0.08) == A and int(N * 0.1) == B:
		print(N)
		break
else:
	print(-1)


(A, B) = map(int, input().split())
print([-1, (c := (-min(-A * 50 // 4, -B * 10)))][(A + 1) * 50 // 4 > c < B * 10 + 10])


(a, b) = map(int, input().split())
from math import ceil as c
(l, r) = (max(c(a / 0.08), b * 10), min(c(-~a / 0.08), -~b * 10))
print([-1, l][l < r])


(A, B) = map(int, input().split())
for i in range(1500):
	if (i * 2 // 25 == A) * (i // 10 == B):
		print(i)
		return
print(-1)


(A, B) = map(int, input().split())
T = max(25 * A, 20 * B)
if 25 * A >= 20 * (B + 1) or 25 * (A + 1) <= 20 * B:
	print(-1)
else:
	print(T // 2 + T % 2)


(A, B) = map(int, input().split())
b = 10 * B
if b * 2 // 25 == A:
	print(b)
elif (b + 9) * 2 // 25 == A:
	if A % 2 == 0:
		print(A * 25 // 2)
	else:
		print((A * 25 + 1) // 2)
else:
	print(-1)


import math
(a, b) = map(int, input().split())
for i in range(1, 10000):
	if int(i * 0.08) == a and int(i * 0.1) == b:
		print(i)
		exit()
print(-1)


import math
(a, b) = map(int, input().split())
for i in range(1500):
	if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
		print(i)
		break
else:
	print(-1)


(a, b) = list(map(int, input().split()))
ans = -1
for v in range(100 * 10 + 100):
	t8 = int(v * 0.08)
	t10 = int(v * 0.1)
	if t8 > a or t10 > b:
		break
	if t8 == a and t10 == b:
		ans = v
		break
print(ans)


import math
(a, b) = map(int, input().split())
ast = math.ceil(a * 12.5)
aend = math.ceil((a + 1) * 12.5) - 1
bst = b * 10
bend = (b + 1) * 10 - 1
flag = 0
for i in range(bst, bend + 1):
	if ast <= i <= aend:
		print(i)
		flag = 1
		break
if flag == 0:
	print(-1)


(a, b) = map(int, input().split())
for i in range(1, 1024):
	if i // 12.5 == a and i // 10 == b:
		print(i)
		exit()
print(-1)


(a, b) = map(int, input().split())
l = max(a * 25 + 1 >> 1, b * 10)
print(l * (~a / 0.08 < -l > ~b * 10) or -1)


(A, B) = map(int, input().split())
for x in range(10 * B, 10 * B + 10):
	if A * 100 / 8 <= x < A * 100 / 8 + 100 / 8:
		print(x)
		exit()
print('-1')


(a, b) = map(int, input().split())
c = 0
if 100 * a % 8 == 0:
	w = 100 * a // 8
else:
	w = 100 * a // 8 + 1
if 100 * (a + 1) % 8 == 0:
	s = 100 * (a + 1) // 8 - 1
else:
	s = 100 * (a + 1) // 8
for i in range(w, s + 1):
	if i // 10 == b:
		print(i)
		c += 1
		break
	else:
		pass
if c == 0:
	print(-1)
else:
	pass


def N():
	return int(input())

def L():
	return list(map(int, input().split()))

def NL(n):
	return [list(map(int, input().split())) for i in range(n)]
mod = pow(10, 9) + 7
import sys
import math
import collections
(a, b) = L()
for i in range(10, 1250):
	if int(i * 0.08) == a and int(i * 0.1) == b:
		print(i)
		return
print(-1)


(a, b) = map(int, input().split())
ans = -1
for i in range(1300):
	if int(i * 2 / 25) == a and int(i / 10) == b:
		ans = i
		break
print(ans)


(A, B) = map(int, input().split())
l = []
for i in range(1, 10000):
	a = i * 0.08
	b = i * 0.1
	if a > A + 1 and b > B + 1:
		break
	elif A <= a < A + 1 and B <= b < B + 1:
		l.append(i)
if len(l) == 0:
	print(-1)
else:
	print(min(l))


(a, b) = map(int, input().split())
a *= 25
b *= 10
r = max((a + 1) // 2, b)
print((-1, r)[r < min((a + 26) // 2, b + 10)])


def resolve():
	(a, b) = map(int, input().split())
	for i in range(20100):
		ans = '-1'
		if i * 0.08 // 1 == a and i * 0.1 // 1 == b:
			ans = i
			break
	print(ans)
resolve()


def i_input():
	return int(input())

def i_map():
	return map(int, input().split())

def i_list():
	return list(map(int, input().split()))

def i_row(N):
	return [int(input()) for _ in range(N)]

def i_row_list(N):
	return [list(map(int, input().split())) for _ in range(N)]
(a, b) = i_map()
ans = -1
for i in range(1, 2000):
	if i * 8 // 100 == a and i // 10 == b:
		ans = i
		break
print(ans)


import sys
(A, B) = map(int, input().split())
for i in range(1, 10000):
	if int(i * 0.1) == B and int(i * 0.08) == A:
		print(int(i))
		return
print(-1)


(a, b) = [int(i) for i in input().split()]
A = a / 0.08
B = b * 10
if B - 10 <= A < B + 10:
	print(int(max(A, B) + 0.5))
else:
	print(-1)


(a, b) = map(int, input().split())
c = b * 10
for i in range(c, c + 10):
	if int(i * 0.08) == a:
		print(i)
		exit()
print(-1)


(A, B) = map(int, input().split())
for x in range(1, 10001):
	if 0.1 * x // 1 == B and 0.08 * x // 1 == A:
		print(x)
		exit(0)
print(-1)


(a, b) = map(int, input().split())
r = -1
for i in range(1001):
	if i * 8 // 100 == a and i * 10 // 100 == b:
		r = i
		break
print(r)


(A, B) = map(int, input().split())
x = -1
for n in range(2000):
	if int(0.08 * n) == A and int(0.1 * n) == B:
		x = n
		break
print(x)


(a, b) = map(int, input().split())
ans = -1
for x in range(b * 10, (b + 1) * 10):
	if a <= x * 0.08 < a + 1:
		ans = x
		break
print(ans)


import math, sys
(A, B) = map(int, input().split())
for price in range(1, 100000):
	if math.floor(price * 0.08) == A and math.floor(price * 0.1) == B:
		print(price)
		return
print(-1)


import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
input = sys.stdin.readline

def RD():
	return input().rstrip()

def F():
	return float(input().rstrip())

def I():
	return int(input().rstrip())

def MI():
	return map(int, input().split())

def MF():
	return map(float, input().split())

def LI():
	return list(map(int, input().split()))

def TI():
	return tuple(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def Init(H, W, num):
	return [[num for i in range(W)] for j in range(H)]

def main():
	(A, B) = MI()
	B1 = B * 10
	while True:
		if B1 * 0.1 >= B + 1:
			break
		elif B1 * 0.08 >= A + 1:
			break
		elif math.floor(B1 * 0.08) == A:
			print(B1)
			return
		B1 += 1
	print(-1)

def __starting_point():
	main()
__starting_point()


(a, b) = [int(i) for i in input().split()]
idx = 0
rangein = False
while True:
	aa = int(idx * 0.08)
	bb = int(idx * 0.1)
	if aa == a and bb == b:
		print(idx)
		return
	elif aa == a or bb == b:
		rangein = True
	elif rangein and aa != a and (bb != b):
		print(-1)
		return
	idx += 1


(A, B) = map(int, input().split())
flag = True
for i in range(1, 1010):
	if int(i * 0.08) == A and int(i * 0.1) == B:
		print(i)
		flag = False
		break
if flag:
	print(-1)


(A, B) = map(int, input().split())
for i in range(1, 10101):
	if int(i * 0.08) == A and int(i * 0.1) == B:
		print(i)
		exit(0)
else:
	print(-1)


(a, b) = map(int, input().split())
for i in range(10001):
	if i * 8 // 100 == a and i * 10 // 100 == b:
		print(i)
		return
print(-1)


import math
(a, b) = map(int, input().split())
ans = -1
for i in range(1, 1011):
	if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
		print(i)
		return
print(ans)


(A, B) = map(int, input().split())
print((sorted(list({((int(i * 0.08) == A) & (int(i * 0.1) == B)) * i for i in range(0, 10 * B + 10)})) + [-1])[1])


(A, B) = map(int, input().split())
ans = max((A * 100 - 1) // 8 + 1, B * 10)
if ans >= min(((A + 1) * 100 - 1) // 8 + 1, (B + 1) * 10):
	print(-1)
else:
	print(ans)


(a, b) = list(map(int, input().split()))
for i in range(13, 1250):
	if i // 12.5 == a and i // 10 == b:
		print(i)
		return
print(-1)


(a, b) = map(int, input().split())
if max(25 * a, 20 * b) >= min(25 * (a + 1), 20 * (b + 1)):
	ans = -1
else:
	ans = (max(25 * a, 20 * b) + 1) // 2
print(ans)


import math
(A, B) = list(map(int, input().split()))
A_1 = math.ceil(A * 12.5)
A_2 = math.ceil((A + 1) * 12.5)
for i in range(A_1, A_2 + 1):
	if i == A_2:
		print(-1)
	elif math.floor(i * 0.1) != B:
		continue
	elif math.floor(i * 0.1) == B:
		print(i)
		break


import math
(a, b) = map(int, input().split())
(ma_min, ma_max) = (math.ceil(a / 0.08), math.ceil((a + 1) / 0.08 - 1))
(mb_min, mb_max) = (math.ceil(b / 0.1), math.ceil((b + 1) / 0.1 - 1))
tmp_ans = max(ma_min, mb_min)
if ma_min <= tmp_ans <= ma_max and mb_min <= tmp_ans <= mb_max:
	ans = tmp_ans
else:
	ans = -1
print(ans)


(a, b) = map(int, input().split())
i = 1
f = 0
while True:
	if int(i * 0.08) == a and int(i * 0.1) == b:
		print(i)
		f = 1
		break
	if int(i * 0.08) > a:
		break
	i += 1
if not f:
	print(-1)


def __starting_point():
	(A, B) = list(map(int, input().split()))
	ans = -1
	while ans * 0.08 < A or ans * 0.1 < B:
		ans += 1
	if int(ans * 0.08) == A and int(ans * 0.1) == B:
		print(ans)
	else:
		print('-1')
__starting_point()


(a, b) = map(int, input().split())
r = [i for i in range(1, 1010) if i * 0.08 // 1 == a and i * 0.1 // 1 == b]
print(r[0] if r else -1)


(N, M) = map(int, input().split())
x = max(N // 0.08 + 1, M // 0.1 + 1)
y = min((N + 1) // 0.08, (M + 1) // 0.1)
print(-1 if y < x else int(x))


from math import ceil
(A, B) = map(int, input().split())
min8 = ceil(A * 12.5)
max8 = int((A + 1) * 12.5 - 0.001)
min10 = ceil(B * 10)
max10 = int((B + 1) * 10 - 0.001)
if max8 < min10 or max10 < min8:
	print(-1)
else:
	print(max(min8, min10))


(A, B) = map(int, input().split())
for p in range(13, 1250):
	if int(p * 0.08) == A and int(p * 0.1) == B:
		print(p)
		exit()
print(-1)


(a, b) = map(int, input().split())
for i in range(10 ** 5):
	if i * 2 // 25 == a and i // 10 == b:
		print(i)
		break
else:
	print(-1)


import sys
input = sys.stdin.readline

def main():
	numbers = []
	(a, b) = map(int, input().split())
	tmp1 = int(a / 0.08)
	tmp2 = int(b / 0.1)
	ans = []
	for i in range(min(tmp1, tmp2), max(tmp1, tmp2) + 2):
		if int(i * 0.08) == a and int(i * 0.1) == b:
			ans.append(i)
	if len(ans) > 0:
		print(min(ans))
	else:
		print('-1')

def __starting_point():
	main()
__starting_point()