There is an N×M grid in which there are N rows and M colums. A cell (i,j) is defined as the ith row from the top and jth column from left. You are located at (1, 1) initially and can perform the following steps any number of times:
There are some obstacles in the path.
You are initially located at (1, 1) and wants to reach (N, M) but you are interested in knowing the number of ways you can reach (N, M) from (1, 1). Since these numbers can huge, print it modulo (109+7).
Two ways are considered different if they have a different number of steps or differ in some positions.
Note
Input format
Output format
For each test case, print a single line denoting the number of ways to reach (N, M) from (1, 1) modulo (109+7).
Constraints
1≤T≤10
1≤N,M≤1000
Each cell consists of either . or *.
The grid consists of (1, 1) and (N, M).
There are 8 ways: