output_description: Print the maximum possible sum of the values of items that Taro takes home.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N W
      w_1 v_1
      w_2 v_2
      :
      w_N v_N
attempt: import java.util.*;
  public class Main{
      public static void main(String args[]){
          Scanner in = new Scanner(System.in);
          int N = in.nextInt();
          int W = in.nextInt();
          int w[] = new int[N];
          int v[] = new int[N];
          for(int i=0;i<N;i++){
              w[i] = in.nextInt();
              v[i] = in.nextInt();
          }
          in.close();
          long dp[][] = new long[N+1][W+1];
          for(int i=0;i<W+1;i++){
              dp[N][i] = 0;
          }
          for(int i=N-1;i>=0;i--){
              for(int j=0;j<W+1;j++){
                  if(j < w[i]){
                      dp[i][j] = dp[i+1][j];
                  }
                  else{
                      dp[i][j] = Math.max(dp[i+1][j],dp[i+1][j-w[i]]+v[i]);
                  }
              }
          }
          System.out.println(dp[0][W]);
      }
  }
problem_description: Statement
  
  There are N items, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N),
  Item i has a weight of w_i and a value of v_i.
  
  Taro has decided to choose some of the N items and carry them home in a
  knapsack. The capacity of the knapsack is W, which means that the sum of the
  weights of items taken must be at most W.
  
  Find the maximum possible sum of the values of items that Taro takes home.
samples: [{"input": "3 8\n    3 30\n    4 50\n    5 60", "output": "90\n    \n\nItems 1 and 3 should be taken. Then, the sum of the weights is 3 + 5 = 8, and\nthe sum of the values is 30 + 60 = 90.\n\n* * *"}, {"input": "5 5\n    1 1000000000\n    1 1000000000\n    1 1000000000\n    1 1000000000\n    1 1000000000", "output": "5000000000\n    \n\nThe answer may not fit into a 32-bit integer type.\n\n* * *"}, {"input": "6 15\n    6 5\n    5 6\n    6 4\n    6 6\n    3 5\n    7 2", "output": "17\n    \n\nItems 2, 4 and 5 should be taken. Then, the sum of the weights is 5 + 6 + 3 =\n14, and the sum of the values is 6 + 6 + 5 = 17."}]