modify knapsack.c