##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
| # | Title | Points | Solved | Admin | |
|---|---|---|---|---|---|
An array is called edible if all of the following conditions hold:
The tastiness of an edible array is the number of maximal contiguous blocks consisting only of zeros.
Hamid chooses an edible array of length exactly uniformly at random among all possible edible arrays of length . Then he changes the array times.
Assume the current edible array is and its length is . To construct the next array, first add one to the beginning of and one to the end of . More formally, define , , and for .
The new array has length , and for each :
The new array is also edible.
Find the expected value of the sum of tastiness values of all edible arrays Hamid sees, including the initial array.
Output the answer modulo . More precisely, if the expected value is equal to , output .
There are four possible initial arrays. The initial tastiness is always . After one change, exactly two of them have one zero block, so the expected sum is .
The expected tastiness of the initial array is , and the expected tastiness after the change is . Their sum is .
For the three arrays Hamid sees, the expected tastiness values are , , and . The total is .
The expected total tastiness of the four arrays is .
After enough changes, all later arrays have tastiness . For this case, the expected total tastiness is .
There are four possible initial arrays. The initial tastiness is always . After one change, exactly two of them have one zero block, so the expected sum is .
The expected tastiness of the initial array is , and the expected tastiness after the change is . Their sum is .
For the three arrays Hamid sees, the expected tastiness values are , , and . The total is .
The expected total tastiness of the four arrays is .
After enough changes, all later arrays have tastiness . For this case, the expected total tastiness is .
There are four possible initial arrays. The initial tastiness is always . After one change, exactly two of them have one zero block, so the expected sum is .
The expected tastiness of the initial array is , and the expected tastiness after the change is . Their sum is .
For the three arrays Hamid sees, the expected tastiness values are , , and . The total is .
The expected total tastiness of the four arrays is .
After enough changes, all later arrays have tastiness . For this case, the expected total tastiness is .