a = [ int(input()) for _ in range(5)]
n = float("inf")
for i in range(5):
    if 0 < a[i] % 2 < 10:
        n = min(n,a[i] % 10)
        print(n)
else:
    if n == float("inf"):
        n = 0
print(sum([(-a[i]//10)*-10 for i in range(5)]) -(10-n))