li = [int(input()) for i in range(5)]
for i in range(1,10):
    for j in range(5):
        if li[j] % 10 == i:
            a = li[j]
            del li[j]
            break
    else:
        continue
    break

for i in range(4):
    if li[i] % 10 != 0:
        li[i] = (li[i] // 10 + 1) * 10
print(sum(li) + a)