PLEASE HELP ME

Can someone please help me with this submission codeforces DIV 2 contest 665 problem D
Link to Submission:
https://codeforces.com/contest/1401/submission/90741918

When m>n-1, multiply the first k large numbers of array p where k=m-n+1. Then multiply this number with largest value of w. Now for rest n-2 values multiply normally.