from functools import reduce
from math      import ceil
l = [int(input()) for _ in range(5)]
r = [i % 10 for i in l if i % 10 != 0]
m = [ceil(i / 10) * 10 + 10 for i in l]
print(reduce(lambda a, b: a + b, m) + (min(r) - 10 if r else 0))
