Souvenirs
문제
Amaru is buying souvenirs in a foreign shop. There are types of souvenirs. There are infinitely many souvenirs of each type available in the shop.
Each type of souvenir has a fixed price. Namely, a souvenir of type () has a price of coins, where is a positive integer.
Amaru knows that souvenir types are sorted in decreasing order by price, and that the souvenir prices are distinct. Specifically, . Moreover, he was able to learn the value of . Unfortunately, Amaru does not have any other information about the prices of the souvenirs.
To buy some souvenirs, Amaru will perform a number of transactions with the seller.
Each transaction consists of the following steps:
- Amaru hands some (positive) number of coins to the seller.
- The seller puts these coins in a pile on the table in the back room, where Amaru cannot see them.
- The seller considers each souvenir type in that order, one by one. Each type is considered exactly onceper transaction.
- When considering souvenir type , if the current number of coins in the pile is at least , then
- the seller removes coins from the pile, and
- the seller puts one souvenir of type on the table.
- When considering souvenir type , if the current number of coins in the pile is at least , then
- The seller gives Amaru all the coins remaining in the pile and all souvenirs on the table.
Note that there are no coins or souvenirs on the table before a transaction begins.
Your task is to instruct Amaru to perform some number of transactions, so that:
- in each transaction he buys at least one souvenir, and
- overall he buys exactly souvenirs of type , for each such that . Note that this means that Amaru should not buy any souvenir of type .
Amaru does not have to minimize the number of transactions and has an unlimited supply of coins.