Question
Freelancer Deadline Earnings
A freelancer has
Find the maximum total payment the freelancer can earn.
Input
The first line contains an integer KaTeX can only parse string typed expression.
Each of the next KaTeX can only parse string typed expression lines contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the deadline and payment of a task.
Output
Print a single integer — the maximum total payment.
Example
Example 1:
Input
Example 2:
Input
Input
5
2 100
1 19
2 27
1 25
3 15Output142Example 2:
Input
4
1 10
1 20
1 30
1 40Output40