import math

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

for i in range(20000):

    if (math.floor(i * 8 / 100), math.floor(i / 10))\

        == (a, b):

        print(i)

        exit()

    

print(-1)

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

for i in range(20000):

    hachi = i * 8 // 100

    ju = i // 10

    if (hachi, ju) == (a, b):

        print(i)

        exit()

    

print((-1))

import math

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

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

-import math - -a, b = map(int, input().split()) +a, b = list(map(int, input().split())) -    if (math.floor(i * 8 / 100), math.floor(i / 10)) == (a, b): +    hachi = i * 8 // 100 +    ju = i // 10 +    if (hachi, ju) == (a, b): -print(-1) +print((-1))