The incoming Protoss army just finished its +1 ground attack upgrade and zealot speed upgrade, and is bearing down on the Zerg natural with a nasty timing attack.
The Zerg army has a bunch of creep colonies already built, and will convert some of them into sunken colonies in an attempt at holding the attack. Due to the nature of the timing attack and limited resources, the Zerg will refuse to convert creep colonies that are directly adjacent to each other.
The Zerg base is modeled as an
How many different subsets of creep colonies can the Zerg convert to sunken colonies? Note that the Zerg can choose not to convert any sunken colonies, which may be a viable strategy as creep colonies have more health than sunken colonies.
Constraints
Input Specification
The first line will contain two integers,
Each of the next
Output Specification
Output the number of different configurations the Zerg can convert, modulo
Sample Input
2 3
1 1 1
0 1 0
Sample Output
9
Comments