Alice caretaker n garden want plant flower maximize total beauty gardensyou give 0indexed integer array flower size n flowersi number flower plant ith garden Flowers plant remove you give integer newflowers maximum number flower Alice additionally plant you give integer target partialA garden consider complete target flower the total beauty garden determine sum followingthe number complete garden multiply fullThe minimum number flower incomplete garden multiply partial if incomplete garden value 0return maximum total beauty Alice obtain plant newflowers flower Example 1input flower 1311 newFlowers 7 target 6 12 partial 1output 14explanation Alice plant 2 flower 0th garden 3 flower 1st garden 1 flower 2nd garden 1 flower 3rd gardenthe garden 3622 she plant total 2 3 1 1 7 flowersthere 1 garden completethe minimum number flower incomplete garden 2Thus total beauty 1 12 2 1 12 2 14no way planting flower obtain total beauty high 14example 2input flower 2453 newflowers 10 target 5 2 partial 6output 30explanation Alice plant 3 flower 0th garden 0 flower 1st garden 0 flower 2nd garden 2 flower 3rd gardenthe garden 5455 she plant total 3 0 0 2 5 flowersthere 3 garden completethe minimum number flower incomplete garden 4thus total beauty 3 2 4 6 6 24 30no way planting flower obtain total beauty high 30note Alice garden complete case obtain low total beauty Constraints1 flowerslength 1051 flowersi target 1051 newflowers 10101 partial 105