M = [int(input()) for _ in range(5)]
m = []
T = 0
for i in range(5):
    if M[i] % 10 > 0:
        T += M[i]
        T += 10 - M[i] % 10
        m.append(M[i] % 10)
        T -= min(m)
    else:
        T += M[i]
print(T)