시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB79272028.571%

문제

Nerissa owns a rectangular-shaped paddy field which is divided into R × C small squares (R rows and C columns) of the same size. Each square is either an empty soil (empty square, which can be used for any purpose) or a rice-planted soil (specifically to plant rice).

To prevent birds like crows or sparrows from disturbing the crops, Nerissa decides to put some scarecrows on the field. Each scarecrow can only be placed on an empty square. Furthermore, to prevent other humans from stealing the crops, the scarecrow arrangement must be sacred. An arrangement is said to be sacred if all the following conditions are satisfied:

  • Each row contains at least one scarecrow,
  • Each consecutive two columns contain at least one scarecrow.

Now Nerissa wonders, how many different sacred arrangements are there? Two arrangement are different if there is a square that contains a scarecrow in one arrangement but not in the other arrangement. Help Nerissa to compute this number.

입력

The first line contains two integers: R C (1 ≤ R ≤ 14; 1 ≤ C ≤ 1000) in a line denoting the size of paddy field in term of the number of squares (number of rows and columns, respectively). The paddy field is given in the next R lines where each line contains a string of length C. Each square is represented by either '.' which denotes an empty soil, or 'v' which denotes a rice-planted soil. 

출력

The output contains an integer representing the number of different sacred arrangement, in a line. As the output can be very large, modulo the output by 1,000,000,007.

예제 입력 1

2 2
v.
..

예제 출력 1

3

예제 입력 2

1 3
...

예제 출력 2

5

예제 입력 3

2 3
vvv
...

예제 출력 3

0

예제 입력 4

3 3
...
.v.
...

예제 출력 4

145

예제 입력 5

2 4
.vv.
.v.v

예제 출력 5

5

힌트

Explanation for the 2nd sample case

For the second sample, the following are all 5 sacred arrangements (the scarecrows are denoted by character '*'):

***    *.*    **.    .**    .*.

Explanation for the 3rd sample case

Notice that, for the third sample, we cannot put any scarecrow in the first row. As a sacred arrangement requires at least one scarecrow in each row, thus, in this case, there is no possible sacred arrangement.

Explanation for the 5th sample case

For the fifth sample, the following are all 5 sacred arrangements (the scarecrows are denoted by character '*'):

*vv*    *vv*    *vv.    *vv.    .vv*
*v*v    .v*v    .v*v    *v*v    *v*v