#dpe. [dp_e]Knapsack 2
[dp_e]Knapsack 2
Problem Statement
There are items, numbered . For each (), Item has a weight of and a value of .
Taro has decided to choose some of the items and carry them home in a knapsack. The capacity of the knapsack is , which means that the sum of the weights of items taken must be at most .
Find the maximum possible sum of the values of items that Taro takes home.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the maximum possible sum of the values of items that Taro takes home.
Sample Input 1
Sample Output 1
Items and should be taken. Then, the sum of the weights is , and the sum of the values is .
Sample Input 2
Sample Output 2
Sample Input 3
Sample Output 3
Items and should be taken. Then, the sum of the weights is , and the sum of the values is .