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

Menu = [A,B,C,D,E]
ans = 0
mint = 9

for i in Menu :
    ans += (i+9)//10
    if i%10 != 0 :
        mint = min(i%10, mint)

ans = ans * 10 - 10 + mint
print(ans)
