a,b = input().split()

a = int(a)

b = int(b)

c = 0

for i in range(10000):

    d = c*0.08

    e = c*0.1

    d = int(d)

    e = int(e)

    if d == a and e == b:

        print(c)

        break

    elif c == 9999:

        print('-1')

        break

    else:

        c += 1
a,b = input().split()

a = int(a)

b = int(b)

c = 0

for i in range(1001):

    d = c*0.08

    e = c*0.1

    d = int(d)

    e = int(e)

    if d == a and e == b:

        print(c)

        break

    elif c == 1000:

        print('-1')

        break

    else:

        c += 1
a, b = input().split()
a = int(a)
b = int(b)
c = 0
for i in range(10000):
    d = c * 0.08
    e = c * 0.1
    d = int(d)
    e = int(e)
    if d == a and e == b:
        print(c)
        break
    elif c == 9999:
        print("-1")
        break
    else:
        c += 1

a, b = input().split()
a = int(a)
b = int(b)
c = 0
for i in range(1001):
    d = c * 0.08
    e = c * 0.1
    d = int(d)
    e = int(e)
    if d == a and e == b:
        print(c)
        break
    elif c == 1000:
        print("-1")
        break
    else:
        c += 1

-for i in range(10000): +for i in range(1001): -    elif c == 9999: +    elif c == 1000: