a,b=list(map(int,input().split()));print((([i for i in range(10**6)if(i//12.5==a)*i//10==b]+[-1])[0]))
a,b=list(map(int,input().split()));l=max(0--a*25//2,b*10);print((l*(-~a*25//2>l<-~b*10)or-1))
a, b = list(map(int, input().split()))
print((([i for i in range(10**6) if (i // 12.5 == a) * i // 10 == b] + [-1])[0]))

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

-print((([i for i in range(10**6) if (i // 12.5 == a) * i // 10 == b] + [-1])[0])) +l = max(0 - -a * 25 // 2, b * 10) +print((l * (-~a * 25 // 2 > l < -~b * 10) or -1))