As = []
for i in range(5):
    x = int(input())
    time_b = (x//10 + 1)*10
    amari  = time_b%10
    As.append((amari, x, time_b))

As = sorted(As, key=lambda x:x[0])

sumed = sum([x[2] for x in As[1:]])

print(sumed + As[0][1])