2883: AtCoder Grand Contest 031 B - Reversi
Description
Problem Statement
Input is given from Standard Input in the following format:
Snuke will perform the following operation zero or more times:
Find the number of possible final sequences of colors of the stones, modulo 109+7.
Constraints
Input
N
C1
::
CN
Output
Print the number of possible final sequences of colors of the stones, modulo 109+7
Sample Input Copy
5
1
2
1
2
2
Sample Output Copy
3
HINT
We can make three sequences of colors of stones, as follows:
- (1,2,1,2,2), by doing nothing.
- (1,1,1,2,2), by choosing the first and third stones to perform the operation.
- (1,2,2,2,2), by choosing the second and fourth stones to perform the operation.