a=[0]*5
index=0
index_0=0
count=9
sum=0
for i in range(5):
    a[i]=int(input())
    if a[i]%10==0:
        index_0+=1
    else:
        count=min(a[i]%10,count)
    sum+=a[i]//10
print(sum*10+count+(4-index_0)*10)