import math
a = [input().rstrip() for _ in range(5)]
a = sorted(a, key=lambda x: x[-1], reverse=True)

while True:
    m = a.pop()
    if m[-1] == '0':
        a.insert(0, m)
    else:
        break

s = sum([math.ceil(int(n) / 10) * 10 for n in a])
s += int(m)

print(s)

