menu,fir_digi=[int(input()) for i in range(5)],[]
for i in range (5):
    fir_digi.append(menu[i]%10)
for i in range (5):
    if i!=fir_digi.index(min(fir_digi)) and fir_digi[i]!=0:
            menu[i]=int(menu[i]/10)*10+10
print(sum(menu))