dishes = []
serve = []
for i in range(5):
    dish = int(input())
    dishes.append(dish)
    if dish % 10 != 0:
        time = 10 - dish%10
        serve.append(time)
sort_serve = sorted(serve)
sort_serve.remove(sort_serve[len(sort_serve)-1])
ans = sum(dishes) + sum(sort_serve)
print(ans)