from math import ceil
t = 0
a = [int(input()) for _ in range(5)]
m = min(map(lambda x: (x - 1) % 10 + 1, a))
for c in a:
    print((c + 1) % 10 + 1)
    if (c - 1) % 10 + 1 == m:
        m = c
a.remove(m)
t += sum(map(lambda x: ceil(x / 10), a))
t *= 10
print(t + m)