basic working model of knapsack exercise