The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next weeks, the price of milk and labor will fluctuate weekly such that it will cost the company cents to produce one unit of yogurt in week . Yucky's factory, being well-designed, can produce arbitrarily many units of yogurt each week. Yucky Yogurt owns a warehouse that can store unused yogurt at a constant fee of cents per unit of yogurt per week. Fortuitously, yogurt does not spoil. Yucky Yogurt's warehouse is enormous, so it can hold arbitrarily many units of yogurt. Yucky wants to find a way to make weekly deliveries of units of yogurt to its clientele ( is the delivery quantity in week ). Help Yucky minimize its costs over the entire Nweek period. Yogurt produced in week , as well as any yogurt already in storage, can be used to meet Yucky's demand for that week.
Lines : Line contains two space-separated integers: and .
第一行输入两个整数 和 。
接下来 行输入 和 。
输出格式
Line : Line contains a single integer: the minimum total cost to satisfy the yogurt schedule. Note that the total might be too large for a 32-bit integer.