QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 256 MB 總分: 100

#13290. Dominoes

统计

There is an $n \times m$ rectangular grid, some positions of which contain obstacles. We want to place some $1 \times 2$ or $2 \times 1$ dominoes in this grid such that no two dominoes overlap, and no domino is placed on an obstacle. Additionally, the placement must satisfy the condition that there is at least one domino spanning across every two adjacent rows, and at least one domino spanning across every two adjacent columns. Find the number of different ways to place the dominoes. Note that you do not need to cover all non-obstacle cells.

Input

The first line contains two integers $n, m$. The next $n$ lines each contain $m$ characters, representing the rectangular grid. The character "x" indicates an obstacle at that position, and the character "." indicates no obstacle.

Output

A single integer representing the number of different placement methods modulo $19901013$.

Examples

Input 1

3 3
...
...
...

Output 1

2

Note

The two placement methods are:

112 411
4.2 4.2
433 332

Note that the numbers here are only used to distinguish the dominoes; different permutations do not represent different solutions.

Constraints

For 40% of the data, $1 \le n, m \le 8$. For 90% of the data, $1 \le n, m \le 14$. For 100% of the data, $1 \le n, m \le 15$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.