Introduction - If you have any usage issues, please Google them yourself
22. Cutting wood
Results: 10/Discount: 0.9
Background
People need to put a cut into the wood with long paragraphs, there is a company called Analog Cutting Machinery (ACM) of the company is operating the business. Them according to the length of wood before cutting charges, the longer the wood, the higher the fees, and each time to receive a fee cut.
Obviously, cutting wood in here, different order will produce different cutting price. For instance, one with 10 meters of wood, you need to cut the 2,4,7 meters. If the sequence of cutting in these three locations, the cost of required 1086 = 24, because the original length of 10 meters of wood, cut two meters 8 meters left, cut off the remaining four meters 6 meters. If the cut in accordance with the order 4,2,7, cost is 1046 = 20.
Task
Your boss has a lot of wood to be cut, and now he wants you to help him find the cheapest way of cutting.
Input
One input may contain multiple sets of data. The first line of each set of dat