import math

one = [10]
total = 0
for i in range(5):
    time = input()
    if time[-1] != "0":
        one.append(int(time[-1]))
    time = int(time)
    time = math.ceil(time / 10) * 10
    print(time)
    total += time
total += min(one) - 10
print(int(total))
