favorite We need a little bit of your help to keep things running, click on this banner to learn more



To organize a campaign on Azeroth Orgrim Doomhammer needs one more squad. On war appeal arrived n orcs. Doomhammer immediately estimated the abilities of each orc in close combat and javelin throw. Now he must determine which of them to be appointed soldier-infantryman (grunt), and who the bounty hunter (headhunter). At the same time, in order for the troop to be combat-ready, it is necessary that the troop should have at least g grunts and at least h headhunters. After determining each orc into some type of troop, the strength of all troop can be determined as the sum of abilities of all orcs in the specialization assigned to them.

Write a program that determines the maximum possible strength of the newly created troop.


First line contains three integers n, g, h (1n10000, 0g, hn). Then n lines are given, each of them contains two integers in the interval from 0 to 10000 - the ability of the corresponding orc in close combat and his ability to throw a spear.


Print the maximum strength of the battle-worthy army that can be created from conscripts. If you can not create an army that satisfies the given conditions, print the number -1.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4 0 0
1 2
2 1
3 4
4 3
Output example #1
Input example #2
3 1 1
5 5
6 7
6 8
Output example #2
Input example #3
2 2 2
4 5
2 3
Output example #3
Input example #4
3 0 3
5 2
6 1
7 0
Output example #4
Author vetal_n