UTS needs a computer lab for the new building at 30 Humbert Street, and Mr. Ianine is in charge of buying new computers. Each desktop computer needs a keyboard and a monitor. Luckily, Mr. Ianine has
Being the fair person that he is, Mr. Ianine wants all coupons to be treated equally. He defines the value of the
After using the coupons at the store, Mr. Ianine pairs up his keyboards and monitors. Each pair will be used for one working computer, and any extra unpaired keyboards and monitors are kept away in the IT room. What is the maximum number of working computers that he can get?
Input Specification
The first line contains
The next
Output Specification
Output the maximum number of working computers that Mr. Ianine can get, by using coupons of the same value.
Constraints
Subtask 1 [10%]
Subtask 2 [30%]
Subtask 3 [60%]
No additional constraints.
Sample Input
6
1 4
7 1
0 5
4 1
4 4
2 3
Sample Output
6
Explanation for Sample Output
Mr. Ianine should use the coupons with value
Comments