A, B = list(map(int, input().split()))



for x in range(1, 10**5):

    if x*8//100 == A and x*10//100 == B:

        print(x)

        break

else:

    print((-1))

A, B = list(map(int, input().split()))



L1, R1 = -(-(100*A) // 8), -(-(100*(A+1)) // 8) - 1

L2, R2 = -(-(100*B) // 10), -(-(100*(B+1)) // 10) - 1

L = max(L1, L2)

R = min(R1, R2)



if L <= R:

    print(L)

else:

    print((-1))

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

A, B = list(map(int, input().split()))
L1, R1 = -(-(100 * A) // 8), -(-(100 * (A + 1)) // 8) - 1
L2, R2 = -(-(100 * B) // 10), -(-(100 * (B + 1)) // 10) - 1
L = max(L1, L2)
R = min(R1, R2)
if L <= R:
    print(L)
else:
    print((-1))

-for x in range(1, 10**5): -    if x * 8 // 100 == A and x * 10 // 100 == B: -        print(x) -        break +L1, R1 = -(-(100 * A) // 8), -(-(100 * (A + 1)) // 8) - 1 +L2, R2 = -(-(100 * B) // 10), -(-(100 * (B + 1)) // 10) - 1 +L = max(L1, L2) +R = min(R1, R2) +if L <= R: +    print(L)