li = []

a = 10

for i in range(5):
    x = input()
    if int(x[-1]) == 0:
        li.append(int(x))
    else:
        if int(x[-1]) < a:
            a = int(x[-1])
        x = x[:-1] + "0"
        x = int(x) + 10
        li.append(x)

if a == 10:
    a = 0
    
print(sum(li) - 10 + a)