#P11328. Wabbit Contest Badge Collection
Wabbit Contest Badge Collection
Wabbit Contest Badge Collection
You are a Wabbit with an initial level of . You want to participate in contests to increase your strength and collect badges. There are contests in total. The th contest is characterized by two integers and . You can participate in contest if and only if your current level satisfies . When you participate, your level increases by and you earn one badge. You may attempt the contests in any order. Determine the maximum number of badges you can collect by choosing the optimal sequence of contests.
inputFormat
The first line contains a single integer () representing the number of contests. Each of the following lines contains two space-separated integers and , where .
outputFormat
Output a single integer — the maximum number of badges you can collect.
sample
2
1 100
10 1
2
</p>