- Time limit: 1.00 s
- Memory limit: 512 MB
A company wants to hire programmers and artists.
There are a total of applicants, and each applicant can become either a programmer or an artist. You know each applicant's programming and artistic skills.
Your task is to select the new employees so that the sum of their skills is maximum.
Input
The first input line has three integers , and : the required number of programmers and artists, and the total number of applicants.
After this, there are lines that describe the applicants. Each line has two integers and : the applicant's programming and artistic skills.
Output
Print one integer: the maximum sum of skills.
Constraints
Example
Input:
2 1 4 3 7 9 8 1 5 4 2
Output:
20
Explanation: An optimal solution is to hire two programmers with skills and and one artist with skill . The sum of the skills is .