~/algor $ cat problems/matritsa-yollar-soni
Number of paths
Medium
1000 ms
64 MB
63%
A grid of size $n \times m$ is given: . is a free cell, # is an obstacle. A robot wants to go from the top-left cell to the bottom-right cell; it moves only right or down and only through free cells. How many different paths are there? The answer may be large, so print it modulo $10^{9} + 7$. If the start or the finish cell is an obstacle, the answer is $0$.
Input
The first line contains two positive integers $n$ and $m$.
Each of the next $n$ lines contains a string of $m$ characters (. or #).
Output
One integer — the number of paths modulo $10^{9} + 7$.
Note
$1 \le n, m \le 100$
Examples
Input #1
3 4 .... .#.. ....
Output #1
4
Input #2
2 2 .# #.
Output #2
0