Problem B
Fair Prizes

The ground level of Wally’s Water Park has plenty of games
for people who want a break from the slides, and they’re not
even that rigged! One game in particular seems intriguing:
there are
The operator says that, included with the park’s admission, you can take as many toys as you are able to with the provided claws! How many toys can you take home?
Input
The first line of input consists of four integers
The next line consists of
Output
Output the maximum number of toys that you can take using the claws.
Sample Input 1 | Sample Output 1 |
---|---|
3 4 1 2 1 2 4 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
4 5 3 2 1 3 4 5 |
3 |
Sample Input 3 | Sample Output 3 |
---|---|
6 11 4 3 1 2 5 8 10 11 |
5 |
Sample Input 4 | Sample Output 4 |
---|---|
4 1000 2 6 3 8 20 25 |
4 |