#P434. 练75.2采购奖品
练75.2采购奖品
Description
The annual New Year party is coming soon. Xiao Ming, as the class monitor, is responsible for organizing and planning the event. He decides to purchase some prizes to reward students who actively participate in each activity. To encourage more participation, the number of prizes purchased should be as large as possible. The class fund can spend up to yuan. Given the prices and stock quantities of types of items available in the store, how can Xiao Ming buy the maximum number of items?
Input Format
The input consists of lines:
The first line contains two positive integers () and (), representing the available budget and the number of types of items available for purchase.
The next lines each contain two numbers (separated by a space), representing the unit price and stock quantity of each item. Both and do not exceed .
Output Format
An integer representing the maximum number of items that can be purchased.
Sample
500 6
100 3
20 15
50 10
35 5
5 6
60 225