t=[int(input()) for _ in range(5)]
ans=0
b=[x%10 for x in t]
c=[x%10 for x in t if x%10>0]
for i in range(5):
    if b[i]>0:
        ans+=(t[i]//10+1)*10
    else:
        ans+=t[i]
print(ans-10+min(c))