foods = [int(input()) for i in range(5)]

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
if li = []:
    ans = sum(foods)
else:    
    ans = sum(foods) - max(li)
print(ans)