There are students in the class where each of them has two parameters, marks and the bound. There are two arrays and denoting the marks and the bound of students in the class. Initially, the cutoff is zero for passing. Now, each of the students will be evaluated on the basis of his marks.
If the marks obtained by the student are greater than the cutoff, he or she will pass and the cutoff will be incremented by the bound of that student.
Your task is to find the maximum number of students that can pass if the arrangement of students is done properly.
Input format
Output format
Print lines. For each test case:
Constraints
The sum of over all test cases does not exceed 2000.
Order should be [2,1,3,4,5], initially cutoff is zero.
Second student has more marks than cutoff, he will pass and cutoff will now be one as bound for second student is 1.
First student has marks equal to cutoff, he will also pass and cutoff will be 1+3=4.
Third student has marks equal to cutoff , he will also pass and cutoff will be 4+7=11.
Now fourth and fifth students will fail because both of them have marks less than 11.