• I am sorry, I am not sure I understand the question.

    I need for the sum created, to be closest to a given number (10, in the example above), but not go over it.