from functools import reduce

l = [int(eval(input())) for _ in range(5)]

r = [10 if i % 10 == 0 else i %  10 for i in l]

m = [i  if i % 10 == 0 else i // 10 * 10 + 10 for i in l]

print((sum(m) + min(r) - 10))
l = [int(eval(input())) for _ in range(5)]

r = [10 if i % 10 == 0 else i %  10 for i in l]

m = [i  if i % 10 == 0 else i // 10 * 10 + 10 for i in l]

print((sum(m) + min(r) - 10))
from functools import reduce

l = [int(eval(input())) for _ in range(5)]
r = [10 if i % 10 == 0 else i % 10 for i in l]
m = [i if i % 10 == 0 else i // 10 * 10 + 10 for i in l]
print((sum(m) + min(r) - 10))

l = [int(eval(input())) for _ in range(5)]
r = [10 if i % 10 == 0 else i % 10 for i in l]
m = [i if i % 10 == 0 else i // 10 * 10 + 10 for i in l]
print((sum(m) + min(r) - 10))

-from functools import reduce -