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$ 个精灵的生命值和攻击值。
输入格式
无
输出格式
无
说明/提示
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 $ .