#P3674. Super Assassin
Super Assassin
Description
The Nerubian Assassin, Anub'arak, is a notorious hero in the world of DotA. He(It?) might not be a good warrior, but his terrific assaulting abilities can always frighten his enemies. Recently Anub'arak had received an order to kill a very important person. The protection is almost invulnerable, so Anub'arak must make full use of his abilities and try to knock that guy down in several seconds. Due to some fantastic reasons, you are standing at the same side of Anub'arak and you must make a perfect plan for him now.
Anub'arak have N attacking skills, when the ith skill was used alone, it will deal Di damage instantly. Besides, most of Anub'arak 's skill has a powerful effect which can enhance the damage of next strike to a higher level----The skill with an enhancing ability of Ei will produce a (Ei × 10) percent extra damage for the next strike. A skill with Ei = 0 has no enhancing effect. Each of these skills can be used at most once or the enemy will have a chance to counterattack. Since time is not enough, Anub'arak can select at most 6 skills, and your task is to calculate the maximum possible damage. It is guaranteed that the result is a 32-bit integer.
Input
The first line of the input file contains a number N (1≤N ≤ 300), which stands for the total skills Anub'arak can use. The following N lines contain two integers each. The first integer Di (10 ≤ Di ≤ 100,000,000, which is a multiple of 10) describes the basic damage of the ith skill, and the second integer Ei (0 ≤ Ei ≤10) describe the enhancing level of the ith skill.
Output
Only a integer, which stands for the possible maximum damage.
7
700 7
600 6
500 5
400 4
300 3
200 2
100 1
3940
Hint
The sequence of skills is: (200,2)->(400,4)->(600,6)->(700,7)->(500,5)->(300,3)
Total damage is:200+400*1.2+600*1.4+700*1.6+500*1.7+300*1.5=3940Source
POJ Founder Monthly Contest – 2008.07.27, Mars