t = [int(input()) for _  in range(5)]
total = 0
amari = []

for ti in t:
    d, m = divmod(ti, 10)
    total += ti - m
    if m > 0:
        amari.append(m)
total += min(amari) + 10 * (len(amari) - 1)
print(total)