Solves the common knapsack goal