SP1877 EPURSE - Enrich my purse

Description

Jack plays this ball game for the first time in his club. Jack has a ball, which bounces with a width of **W**. Coins are arranged on a straight line at regular intervals. If the ball strikes the i-th coin, Jack gains **money**\[i\] (which could possibly be negative). Jack can take atmost **B** turns, to throw the ball. At each turn, jack can either throw the ball from left to right, or right to left, and choose which ball to start the knock out. If he chooses to knock out from ball i to the right, he will knock out i, i+W, i+2W, ...; Similarly if he chooses to knock out from right to left, starting from ball i he will knock out, i, i-W, i-2W, ...; Please note that once a ball is knocked out, it is removed and it's place contains a void. i.e., you cant gain **money\[i\]** for the same **i** twice. Jack wants to maximise his money gained, by carefully choosing his turns. If there is more than one way to gain the same money, jack wishes to minimise the number of times he throws.

Input Format

N/A

Output Format

N/A