Stone Game VIII

Alice and Bob take turns playing a game, with Alice going first.

There are n stones arranged in a row. On each turn, a player must choose an integer x > 1 and remove the leftmost x stones from the row. The player adds the sum of the removed stones to their score, then places a new stone on the left end whose value equals that sum. The game ends when only one stone remains.

Assuming both play optimally, return the maximum score difference (Alice minus Bob).

Examples
Input: [-1,2,-3,4,-5]
Output: 5
Hints

Stone Game VIII

Alice and Bob take turns playing a game, with Alice going first.