You must buy products with prices . You may buy them in any order, and each product must be bought exactly once. Initially, your voucher is worth zero.
When you buy a product with price while holding a voucher worth , you pay in cash. The old voucher expires, and you receive a new voucher worth exactly the amount you just paid.
Find the largest possible value of your voucher after all products have been bought.
Buying in the given order produces voucher values .
Buy the products in the order . The voucher values are .
Buying in the given order produces voucher values . No order gives a larger final value.
The only purchase gives a voucher worth .
Buy the product priced first, then the one priced .