time = []
total = 0
for _ in range(5):
    t = int(input())
    if t % 10 == 0:
        total += t
    else:
        total += (t//10+1)*10
        time.append(t)

last = min(time, key=lambda x: int(str(x)[-1]))

print(total - 10+last%10)