import math
l = [int(input()) for _ in range(5)]
l_1st = [int(str(0 - int(str(i)[-1]))[-1]) for i in l]
l_rm_i = l_1st.index(max(l_1st))
l_rm = l[l_rm_i]
del l[l_rm_i]

l = [math.ceil(i/10)*10 for i in l]
ans = int((sum(l) + l_rm))
print(ans)