M = [int(input()) for i in range(5)]
T = M[:]
tmp = 10
for i in range(5):
    if tmp > M[i] % 10 > 0:
        tmp = M[i] % 10
        c = i
    M[i] = ((M[i] - 1) // 10 + 1) * 10
M[c] = T[c]
print(sum(M))