CF913C Party Lemonade

题目描述

题意 没有柠檬水的新年派对不是新年派对。像往常一样,你期待着客人,而柠檬水已经成为一种令人愉快的必需品。 你最喜欢的商店卖 n 种不同价格的装在不同瓶子里的柠檬水。一瓶第 i 种柠檬水,体积为2^{i-1},价格为c_{i}卢布。商店里的每种柠檬水可以被认为有无限瓶。 你想要买至少 L 升的柠檬水,你需要花费多少卢布?

输入格式

输出格式

说明/提示

In the first example you should buy one 8-liter bottle for 90 roubles and two 2-liter bottles for 30 roubles each. In total you'll get 12 liters of lemonade for just 150 roubles. In the second example, even though you need only 3 liters, it's cheaper to buy a single 8-liter bottle for 10 roubles. In the third example it's best to buy three 1-liter bottles for 10 roubles each, getting three liters for 30 roubles.