L = [int(input()) for i in range(5)]
l = [n % 10 if not (n % 10 == 0) else 100 for n in L]
i = l.index(min(l))
I = 10 - (L[i] % 10) + L[i]
SUM = sum([n + 10 - (n % 10) if not (n % 10 == 0) else n for n in L])
# print(i, I, SUM)
ans = SUM - I + L[i]
print(ans)
