import math

sm = 0
dishes = []
for i in range(5):
    nm = int(input())
    if nm % 10 == 0:
        sm += nm
        continue
    dishes.append(nm)
last = min(dishes, key=(lambda x: x % 10), default=0)
for e in dishes:
    if e == last:
        continue
    sm += math.ceil(e / 10) * 10

print(sm + last)