product cut, dynamic programming