li=[]

for i in range(5):
    li.append(str(input()))

min=9
for i in li:
    temp=int(i[-1])
    #print('-1',temp)
    if min > temp and temp!=0:
        min=temp

sum=0
for i in li:
    #print(i[-1])
    if i[-1]!='0':
        temp=int(i[0:-1]+"0")+10
    else:
        temp=int(i)
    #print("temp", temp)
    sum+=temp

sum-=(10-min)

print(sum)

