Solve the wood cutting problem using O(n^3) DP.