1515: 买瓜子(50分)

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

校庆,采购瓜子。资金N(1<=n<=1000)元,M(1<= m<=30)种瓜子。
问最多能采购多少千克的瓜子?比如N=80元,M=2种。第1种,每袋18元10千克;第2种,每袋30元20千克。

Sample Input Copy

80 2
18 10
30 20

Sample Output Copy

50