Problem:
 Score : 100 points    Problem Statement There is a grid with H horizontal rows and W vertical columns.
Let (i, j) denote the square at the i -th row from the top and the j -th column from the left.  For each i and j ( 1 \leq i \leq H , 1 \leq j \leq W ), Square (i, j) is described by a character a_{i, j} .
If a_{i, j} is . , Square (i, j) is an empty square; if a_{i, j} is # , Square (i, j) is a wall square.
It is guaranteed that Squares (1, 1) and (H, W) are empty squares.  Taro will start from Square (1, 1) and reach (H, W) by repeatedly moving right or down to an adjacent empty square.  Find the number of Taro's paths from Square (1, 1) to (H, W) .
As the answer can be extremely large, find the count modulo 10^9 + 7 .      Constraints  H and W are integers.  2 \leq H, W \leq 1000  a_{i, j} is . or # .  Squares (1, 1) and (H, W) are empty squares.         Input Input is given from Standard Input in the following format:  H  W  a_{1, 1} \ldots a_{1, W}  :  a_{H, 1} \ldots a_{H, W}       Output Print the number of Taro's paths from Square (1, 1) to (H, W) , modulo 10^9 + 7 .        Sample Input 1 3 4
...#
.#..
....      Sample Output 1 3  There are three paths as follows:        Sample Input 2 5 2
..
#.
..
.#
..      Sample Output 2 0  There may be no paths.       Sample Input 3 5 5
..#..
.....
#...#
.....
..#..      Sample Output 3 24       Sample Input 4 20 20
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................      Sample Output 4 345263555  Be sure to print the count modulo 10^9 + 7 .

Solution (Python):

"""
Created on Sun Jan  6 21:36:22 2019

@author: Yamazaki Kenichi
"""

H,W = map(int,input().split())
a = [input() for i in range(H)]

r =[[0]*W for i in range(H)]
r[0][0]=1


for i in range(1,W):
    if a[0][i]== '.':
        r[0][i] = r[0][i-1]

for j in range(1,H):
    if a[j][0] =='.':
        r[j][0] = r[j-1][0]
            
for j in range(1,H):
    for i in range(1,W):
        if a[j][i] == '.':
            r[j][i] = r[j-1][i]+r[j][i-1]

print(r[H-1][W-1]%1000000007)

Solution (Python):
mod = 1000000007
h, w = map(int, input().split())
a = [list(input()) for i in range(h)]
dp = [[0] * (w + 1) for i in range(h + 1)]
dp[1][1] = 1

for j in range(1, h + 1):
    for i in range(1, w + 1):
        if i == j == 1:
            continue

        if a[j - 1][i - 1] == '
            dp[j][i] = 0
        else:
            dp[j][i] = dp[j - 1][i] + dp[j][i - 1]
            dp[j][i] %= mod

print(dp[h][w])

Solution (Python):
H, W = map(int, input().split())
path = []
for i in range(H):
    path.append(input())
dp = [[0 for i in range(W+1)] for j in range(H+1)]
for i in range(1, H+1):
    if path[i-1][0] == "
        break
    else:
        dp[i][1] = 1
for i in range(1, W+1):
    if path[0][i-1] == "
        break
    else:
        dp[1][i] = 1
for i in range(1, H):
    for j in range(1, W):
        if path[i][j] == "
            dp[i+1][j+1] = 0
        else:
            dp[i+1][j+1] = (dp[i][j+1] + dp[i+1][j]) % 1000000007
print(dp[H][W])

Solution (Python):
H, W = map(int, raw_input().split())
G = [raw_input().strip() for _ in xrange(H)]
dp = [[0 for i in xrange(W)] for _ in xrange(H)]
mod = 10**9 + 7

dp[0][0] = 1 if G[0][0] == '.' else 0

for i in xrange(H):
    for j in xrange(W):
        if i + 1 < H and G[i+1][j] == '.':
            dp[i+1][j] += dp[i][j]
            dp[i+1][j] %= mod
        if j + 1 < W and G[i][j+1] == '.':
            dp[i][j+1] += dp[i][j]
            dp[i][j+1] %= mod

print dp[H-1][W-1]

Solution (Python):
h, w = map(int, input().split())
fields = [input() for _ in range(h)]
dp = [[0] * w for _ in range(h)]
for i in range(h):
    if fields[i][0] == '
        break
    dp[i][0] = 1
for j in range(w):
    if fields[0][j] == '
        break
    dp[0][j] = 1
for i in range(1, h):
    for j in range(1, w):
        if fields[i][j] == '
            continue
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % 1000000007
print(dp[-1][-1])

Solution (Python):
h, w = map(int, input().split())
field = []
dp = [[0 for _ in range(w)] for _ in range(h)]
dp[0][0] = 1
for _ in range(h):
    field.append(input())
for column in range(1,w):
    dp[0][column] = int(field[0][column] != '
for row in range(1,h):
    dp[row][0] = int(field[row][0] != '
for row in range(1,h):
    for column in range(1,w):
        if field[row][column] == '
            dp[row][column] = 0
        else:
            dp[row][column] = (dp[row-1][column] + dp[row][column-1]) % 1000000007
print(dp[h-1][w-1])

Solution (Python):
H, W = map(int, input().split())
G = [list(input()) for i in range(H)]
mod = 10 ** 9 + 7


dp = [[0] * W for i in range(H)]
dp[0][0] = 1

for h in range(H):
    for w in range(W):
        if G[h][w] == '
            continue

        dp[h][w] += (dp[h - 1][w] + dp[h][w - 1]) % mod

print(dp[-1][-1])

Solution (Python):
H,W=map(int,input().split())
P=10**9+7
a=[list(input()) for i in range(H)]
dp=[[0 for i in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        if (i,j)==(0,0):
            dp[i][j]=1
        elif i==0:
            if dp[i][j-1]==1 and a[i][j]==".":
                dp[i][j]=1
            else:
                dp[i][j]=0
        elif j==0:
            if dp[i-1][j]==1 and a[i][j]==".":
                dp[i][j]=1
            else:
                dp[i][j]=0
        else:
            if a[i][j]=="
                dp[i][j]=0
            else:
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%P
print(dp[H-1][W-1])

Solution (Python):
H,W = map(int,input().split())
src = [input() for i in range(H)]
MOD = 10**9+7

dp = [[0]*W for i in range(H)]
dp[0][0] = 1
for i in range(H):
    for j in range(W):
        if j+1 < W and src[i][j+1] == '.':
            dp[i][j+1] += dp[i][j]
            dp[i][j+1] %= MOD
        if i+1 < H and src[i+1][j] == '.':
            dp[i+1][j] += dp[i][j]
            dp[i+1][j] %= MOD
print(dp[-1][-1])

Solution (Python):
H,W=map(int,input().split())
MAP=[input() for i in range(H)]
mod=10**9+7

DP=[[0]*W for i in range(H)]
DP[0][0]=1

for i in range(H):
    for j in range(W):
        if MAP[i][j]=="
            continue
        if i!=0 and j!=0:
            DP[i][j]=(DP[i-1][j]+DP[i][j-1])%mod

        if i==0 and j!=0:
            DP[i][j]=DP[i][j-1]

        if i!=0 and j==0:
            DP[i][j]=DP[i-1][j]

print(DP[H-1][W-1])

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

h,w = li()
MOD = 10**9+7

grid = []
grid.append("
for _ in range(h):
    grid.append("
grid.append("

ans = [[0]*(w+2) for _ in range(h+2)]
ans[1][1] = 1
for i in range(1,h+1):
    for j in range(1,w+1):
        if grid[i][j] == "." and (i,j) != (1,1):
            ans[i][j] = ans[i-1][j] + ans[i][j-1]
            ans[i][j] %= MOD
            
print(ans[h][w])

Solution (Python):
H, W = map(int, input().split())
S = [input() for i in range(H)]

MOD = 10**9 + 7

dp = [[0]*(W+1) for i in range(H+1)]
dp[1][0] = 1
for i in range(H):
    s = S[i]
    for j in range(W):
        if s[j] == '
            continue
        dp[i+1][j+1] = (dp[i][j+1] + dp[i+1][j]) % MOD
print(dp[H][W])