there stone arrange row stone associate value integer give array stonevaluein round game Alice divide row nonempty row ie leave row right row Bob calculate value row sum value stone row Bob throw away row maximum value Alices score increase value remain row if value row equal Bob let Alice decide row throw away the round start remain rowthe game end stone remain Alices initially zeroreturn maximum score Alice obtain Example 1input stonevalue 623455output 18explanation in round Alice divide row 623 455 the left row value 11 right row value 14 Bob throw away right row alice score 11in second round Alice divide row 6 23 this time Bob throw away left row Alices score 16 11 5the round Alice choice divide row 2 3 Bob throw away right row Alices score 18 16 2 the game end stone remain rowExample 2input stoneValue 7777777output 28example 3input stonevalue 4output 0 constraints1 stonevaluelength 5001 stoneValuei 106