knapsack example (finished)