times = [int(input()) for i in range(5)]
rest = [times[i] % 10 for i in range(len(times))]
total = 0
for n in times:
    if n % 10 != 0:
        total += n + 10 - (n % 10)
    else:
        total += n

distance = min(rest)
print(total - 10 + distance)