times = [int(input()) for _ in range(5)]
fraction = max([10 - t % 10 for t in times])
if fraction == 10:
    fraction = 0
print(sum([(t - t % 10) + ((t % 10 + 9) // 10) * 10 for t in times]) - fraction)

