Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Super Assassin
Time Limit: 10000MSMemory Limit: 65536K
Total Submissions: 2534Accepted: 561
Case Time Limit: 2000MS

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.

Sample Input

7
700 7
600 6
500 5
400 4
300 3
200 2
100 1

Sample Output

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=3940

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator