l=[]
max=0
total=0
for i in range(5):
    t=int(input())
    if t%10 !=0:
        total +=((t//10)+1)*10
        l.append(t)
    else:
        total +=t
a=min(l,key=lambda x:x%10)

print(total-(10-a%10))