a = [int(input()) for _ in range(5)]
delta = []
time = 0

for i in range(5):
    a10 = 0
    if str(a[i])[-1] != '0':
        a10 = (10 - int(str(a[i])[-1]))
        delta.append(a10)
    time += a[i] + a10


print(time-max(delta))
