Colin has

optional courses numbered from

to

, so he has to do a lot of homework.
For the

-th course, Colin must write an essay with no less than

words. And Colin can write one word per second.
However, Colin wants to finish homework as fast as possible, so he decides to reuse his homework. For the

-th course homework, he can write

words directly, or spend
)
seconds to copy and modify
previous finished homework
)
. If

, he will just
keep 
words. But if

, he has to write another

words. Notice that Colin can finish his homework in any order.
Colin doesn't have enough time to make his homework plan because of the deadline, so he wants you to write a program to determine the order of doing homework so that he can finish homework as fast as possible(no matter write or copy).