l=[]
for i in range(5):
    l.append(int(input()))
indexn=10
indx=0
for v in range(5):
    if l[v]%10==0:
        pass
    else:
        if l[v]%10<indexn:
            indexn=l[v]%10
            indx=v
for k in range(5):
    if k!=indx:
        l[v]=((l[v]-1)//10+1)*10
    else:
        
print(sum(l))