L = [int(input()) for i in range(5)]
longmenuindex=0
for i in range(len(L)):
    if(L[i]%10<L[longmenuindex]%10 and L[i]%10!=0):
        longmenuindex = i
time=0
for i in range(len(L)):
    if(i != longmenuindex):
        time += round(L[i], -1)
print(time+L[longmenuindex])
