x = [int(input()) for i in range(5)]
y = []
for i in range(5):
    tmp = x[i]%10
    if(tmp!=0):
        y.append(tmp)
md = min(y) if y !=[] else 0
print(sum(x[i]//10 for i in range(5))*10 + (len(y)-1)*10+md)