Ruby is playing with the board from a board game.
The board has
Whenever a black tile is folded onto a white tile, the resulting tile is a black tile. Ruby defines a move as a vertical fold followed by a horizontal fold.
Ruby has performed a number of moves on her board, but in doing so forgot what her original board looked like! Her board is currently size
In this game, orientation of the board does matter. That is, the board is not the same as
.
Given her folded board, how many distinct assortments of tiles in the original board could have resulted in her current board? Since this number may be quite large, output it
Constraints
Subtask 1 [10%]
Subtask 2 [20%]
Subtask 3 [30%]
Subtask 4 [40%]
Input Specification
The first line of input will contain the space-separated integers
The next .
representing a white tile, and #
representing a black tile.
Output Specification
A single integer, the number of unique boards that could have resulted in Ruby's final folded board.
Sample Input
1 1
# .
. #
Sample Output
225
Explanation
There are 225 possible
Comments