input: 
  def knapsack(weights: List[int], values: List[int], W: int) -> int:
      """
      Calculate the maximum possible revenue from the items with given weights and values.
      >>> knapsack([2, 1, 3], [4, 2, 3], 5)
      7
      """
  
output:     
      n = len(weights)
      dp = [[0] * (W + 1) for _ in range(n + 1)]
      
      for i in range(1, n + 1):
          for w in range(W + 1):
              if weights[i - 1] <= w:
                  dp[i][w] = max(dp[i - 1][w], dp[i - 1][w - weights[i - 1]] + values[i - 1])
              else:
                  dp[i][w] = dp[i - 1][w]
      
      return dp[n][W]
  