l=[]
for i in range(5):
    l.append(int(input()))
tl=[]
for i in range(5):
    tl.append(l[i]%10)
nl=[]
for i in range(5):
    if l[i]%10==0:
        nl.append(l[i])
    else:
        nl.append((l[i]//10+1)*10)
ctr=0
a=tl[:]
a.sort()
for i in range(5):
    if a[i]>0:
        ctr=a[i]
        break
print(sum(nl)-10+ctr)
