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


dishes = [A, B, C, D, E]
tens = 0
ones = 9
muda = 0
for d in dishes:
    if d % 10 == 0:
        tens += d // 10
    else:
        tens += d // 10 + 1
        if d % 10 < ones:
            muda = d
            ones = d % 10

#%%
ans = tens * 10 -  (10 -muda % 10)

print(ans)