A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A, B, C, D, E]
min = 129
count = 0

for ll in l:
    if ll % 10 <= min % 10 and ll % 10 != 0:
        if min != 129:
            count += (int(min / 10) + 1) * 10
        
        min = ll
    
    else:
        if ll % 10 == 0:
            count += ll
        else:
            count += (int(ll / 10) + 1) * 10
    

print(count + min)