eolymp
bolt
Try our new interface for solving problems
Problems

Conscription

Conscription

Time limit 1 second
Memory limit 128 MiB

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.

Input data

First line contains three integers n, g, h~(1 \le n \le 10000, 0 \le g, h \le n). 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 (grunt) and his ability to throw a spear (headhunter).

Output data

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.

Examples

Input example #1
6 2 2
3 1
3 6
5 4
9 11
8 6
6 3
Output example #1
39
Input example #2
4 0 0
1 2
2 1
3 4
4 3
Output example #2
12
Input example #3
2 2 2
4 5
2 3
Output example #3
-1