you give integer m n represent height width rectangular piece wood you give 2D integer array price pricesi hi wi pricei indicate sell rectangular piece wood height hi width wi pricei dollarsTo cut piece wood vertical horizontal cut entire height width piece split small piece after cut piece wood number small piece sell piece accord price you sell multiple piece shape sell shape the grain wood make difference rotate piece swap height widthReturn maximum money earn cut m x n piece woodNote cut piece wood time want Example 1input m 3 n 5 price 142227213output 19explanation the diagram show possible scenario it consist 2 piece wood shape 2 x 2 selling price 2 7 14 1 piece wood shape 2 x 1 selling price 1 3 3 1 piece wood shape 1 x 4 sell price 1 2 2this obtain total 14 3 2 19 money earnedIt show 19 maximum money earnedexample 2input m 4 n 6 price 3210142413output 32explanation the diagram show possible scenario it consist 3 piece wood shape 3 x 2 selling price 3 10 30 1 piece wood shape 1 x 4 sell price 1 2 2this obtain total 30 2 32 money earnedIt show 32 maximum money earnedNotice rotate 1 x 4 piece wood obtain 4 x 1 piece wood Constraints1 m n 2001 priceslength 2 104pricesilength 31 hi m1 wi n1 pricei 106all shape wood hi wi pairwise distinct