import math
l=[int(input()) for _ in range(5)]
l_min=[]
ans=0
for i in l:
    l_min.append(i%10)
for _ in range(4):
    ind=l_min.index(max(l_min))
    l_min.pop(ind)
    res=math.ceil(l.pop(ind)/10)*10
    ans+=res
print(ans+l[0])