# Candy

Alice has 10 candies arranged in a row. Each of them is assigned a "yummy value":

$3, \ 7, \ 5, \ 4, \ 8, \ 9, \ 6, \ 2, \ 8, \ 3.$

Alice would prefer eating all of them, but her mother wants her to distribute 9 candies to her friends, and she can only eat the one left.

The mechanism to distribute the candies is as follows:

1. Pick 3 consecutive candies and give them to her friends.
2. Merge the other candies without changing the order.
3. Continue until there is only 1 candy left.

Assuming that Alice distributes the candy optimally, what is the maximum "yummy value" she can save for herself?

×