inputs = [int(input()) for i in range(5)]
summ = 0
k = 10
for i in inputs:
    if i % 10 == 0:
        summ = summ + i
    else:
        s, m = divmod(i, 10)
        summ = summ + (s + 1) * 10
        if m < k:
            k = m

summ = summ +((10-k)%10)
print(summ)