H,W = list(map(int,input().split()))

grid = [eval(input()) for i in range(H)]



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



for i in range(H):

    if grid[i][0] == '#':

        break

    dp[i][0] = 1



for j in range(W):

    if grid[0][j] == '#':

        break

    dp[0][j] = 1



for i in range(1,H):

    for j in range(1,W):

        if grid[i][j] == '.':

            dp[i][j] = dp[i-1][j]+dp[i][j-1]

            dp[i][j] %= 1000000007



print((dp[H-1][W-1]%1000000007))
MOD = 1000000007



H, W = list(map(int, input().split()))

A = [eval(input()) for _ in range(H)]



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

dp[0][0] = 1



for i in range(1, H):

    if A[i][0] == '.':

        dp[i][0] = dp[i - 1][0]



for j in range(1, W):

    if A[0][j] == '.':

        dp[0][j] = dp[0][j - 1]



for i in range(1, H):

    for j in range(1, W):

        if A[i][j] == '.':

            dp[i][j] = dp[i - 1][j] + dp[i][j - 1]

            dp[i][j] %= MOD



print((dp[H - 1][W - 1]))
H, W = list(map(int, input().split()))
grid = [eval(input()) for i in range(H)]
dp = [[0 for j in range(W)] for i in range(H)]
for i in range(H):
    if grid[i][0] == "#":
        break
    dp[i][0] = 1
for j in range(W):
    if grid[0][j] == "#":
        break
    dp[0][j] = 1
for i in range(1, H):
    for j in range(1, W):
        if grid[i][j] == ".":
            dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
            dp[i][j] %= 1000000007
print((dp[H - 1][W - 1] % 1000000007))

MOD = 1000000007
H, W = list(map(int, input().split()))
A = [eval(input()) for _ in range(H)]
dp = [[0 for j in range(W)] for i in range(H)]
dp[0][0] = 1
for i in range(1, H):
    if A[i][0] == ".":
        dp[i][0] = dp[i - 1][0]
for j in range(1, W):
    if A[0][j] == ".":
        dp[0][j] = dp[0][j - 1]
for i in range(1, H):
    for j in range(1, W):
        if A[i][j] == ".":
            dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
            dp[i][j] %= MOD
print((dp[H - 1][W - 1]))

+MOD = 1000000007 -grid = [eval(input()) for i in range(H)] +A = [eval(input()) for _ in range(H)] -for i in range(H): -    if grid[i][0] == "#": -        break -    dp[i][0] = 1 -for j in range(W): -    if grid[0][j] == "#": -        break -    dp[0][j] = 1 +dp[0][0] = 1 +for i in range(1, H): +    if A[i][0] == ".": +        dp[i][0] = dp[i - 1][0] +for j in range(1, W): +    if A[0][j] == ".": +        dp[0][j] = dp[0][j - 1] -        if grid[i][j] == ".": +        if A[i][j] == ".": -            dp[i][j] %= 1000000007 -print((dp[H - 1][W - 1] % 1000000007)) +            dp[i][j] %= MOD +print((dp[H - 1][W - 1]))