dishes = []
for i in range(5):
    dishes.append(int(input()))
last = 10
last_index = 5
for i in range(5):
    if dishes[i] % 10 != 0:
        last = min(last,dishes[i]%10)
        last_index = i
ans = 0
for i in range(5):
    if i != last_index:
        if dishes[i] % 10 != 0:
            ans += dishes[i] + 10 - dishes[i] % 10
        else:
            ans += dishes[i]
    else:
        ans += dishes[i]
print(ans)
        