
You are given an array nums consisting of positive integers.
Starting with score = 0 , apply the following algorithm:
Choose the smallest integer of the array that is not marked. If there is a tie, choose the one with the smallest index.
Add the value of the chosen integer to score .
Mark the chosen element and its two adjacent elements if they exist .
Repeat until all the array elements are marked.
Return the score you get after applying the above algorithm .
1 <= nums.length <= 10 ^51 <= nums[i] <= 10 ^6