CF976E Well played!
题目描述
Max 最近沉迷于一款打怪游戏《赛某号》。现在,他正在参加赛某号的春季联赛。
他有 $n$ 只精灵。每只精灵都有对应的生命值 $hp_i$ 和攻击值 $dmg_i$。在比赛过程中,Max 可以借助巴拉拉小魔仙之力,说出这两种咒语:
1. “乌卡拉!血量!加倍!“意即将当前精灵的生命值加倍。(使得 $hp_i \gets 2\times hp_i$)
2. “乌卡拉!生命之力!”意即将当前精灵的生命值赋给当前精灵的攻击值。(使得 $dmg_i\gets hp_i$)
Max 当然不能无限使用这两种咒语。在一局游戏中,他可以使用第一种咒语 $a$ 次,第二次咒语 $b$ 次。由于Max 购买了超级 Nono,所以这两种咒语都可以被多次用在同一精灵身上,且咒语的使用顺序没有限制。Max 可以不用完所有的咒语。
Max 非常希望通过使用这些咒语使得自己的精灵战斗群的攻击值达到最大。现在,Max 想知道这个最大值。
输入第 $2$ 行到第 $n+1$ 行,每行两个整数 $hp$,$dmg$。第 $i$ 行表示第 $i-1$ 个精灵的生命值和攻击值。
输入格式
The first line contains three integers $ n $ , $ a $ , $ b $ ( $ 1
输出格式
输出一行一个整数,代表 Max 的精灵战斗群能达到的最大攻击值。
**样例 1 解释**
Max 在第二只精灵上先使用第一种魔咒将其生命值加倍,此时的生命值为 $12$。此时,再用第二种魔咒将它的攻击值赋为当前的生命值,则第二只精灵的攻击值为 $12$。可以证明,不存在其它的方案使得这两只精灵的攻击值总和更大。
说明/提示
In the first example Max should use the spell of the first type on the second creature, then the spell of the second type on the same creature. Then total damage will be equal to $ 15+6·2=27 $ .
In the second example Max should use the spell of the second type on the first creature, then the spell of the second type on the third creature. Total damage will be equal to $ 10+11+5=26 $ .