times = [int(raw_input()) for i in range(5)]
dists = [(i % 10 or 10) for i in times]
last_index = dists.index(min(dists))
print sum([(time / 10 + 1) * 10 for ind, time in enumerate(times) if ind != last_index] + [times[last_index]])