l = [int(input()) for i in range(5)]
a = []
b = []
c = []
total = 0
for i in l:
    if i % 10 == 0:
        a.append(i)
    else:
        b.append(i)
c.append(b.pop(-1))
for i in b:
    total += i + 10 - i % 10
for i in a:
    total += i
total += c[0]
print(total)