fib function and dynamic Knapsack problem