2014: 最多获得的短信条数

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

Description

某云短信厂商,为庆祝国庆,推出充值优惠活动。
现在给出客户预算,和优惠售价序列,求最多可获得的短信总条数。

Input

第一行客户预算M,其中 0 ≤ M ≤ 10^6
第二行给出售价表, P1, P2, … Pn , 其中 1 ≤ n ≤ 100 ,
Pi为充值 i 元获得的短信条数。
1 ≤ Pi ≤ 1000 , 1 ≤ n ≤ 100

Output

最多获得的短信条数

Sample Input Copy

6
10 20 30 40 60

Sample Output Copy

70

Source/Category