You are given a $$N * M$$ grid in which each cell consists of either 0 or 1. A cell $$(i,j)$$ is blocked if its value is 1. Standing at a cell $$(i,j)$$, you can perform the following steps.
You are initially located at cell $$(1,1)$$. Determine the number of ways in which you can reach $$(N, M)$$ starting from your initial location.
Since the answer can be large, print it modulo (\(10^9 + 7\)).
Example: Let 3 * 3 grid be
0 | 1 | 0 |
1 | 0 | 0 |
0 | 0 | 0 |
If you are standing at cell (1,1), then:
The answer will be 2.
Input format
Output format
Print a single line containing the number of ways to reach $$(N, M)$$ from $$(1,1)$$ modulo \(10^9 + 7\).
Constraints
\(1 \le N, M \le 1000\)
Each cell consists of either '0' or '1'.
There are 3 ways to reach (3,3) from (1,1).