H, W = [int(item) for item in input().split()]

grid = [[item for item in input().strip()] for _ in range(H)]



# print(H, W) 

# print(grid)



dp = [[0 for _ in range(W+1)] for _ in range(H+1)]

dp[0][1] = 1



for i in range(H):

    for j in range(W):

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

            pass

        else:

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



print((dp[H][W]%(10**9+7)))
H, W = [int(item) for item in input().split()]

grid = [[item for item in input().strip()] for _ in range(H)]



# print(H, W) 

# print(grid)



dp = [[0 for _ in range(W+1)] for _ in range(H+1)]

dp[0][1] = 1



for i in range(H):

    for j in range(W):

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

            pass

        else:

            dp[i+1][j+1] = (dp[i][j+1] + dp[i+1][j])%(10**9+7)



print((dp[H][W]))
H, W = [int(item) for item in input().split()]
grid = [[item for item in input().strip()] for _ in range(H)]
# print(H, W)
# print(grid)
dp = [[0 for _ in range(W + 1)] for _ in range(H + 1)]
dp[0][1] = 1
for i in range(H):
    for j in range(W):
        if grid[i][j] == "#":
            pass
        else:
            dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j]
print((dp[H][W] % (10**9 + 7)))

H, W = [int(item) for item in input().split()]
grid = [[item for item in input().strip()] for _ in range(H)]
# print(H, W)
# print(grid)
dp = [[0 for _ in range(W + 1)] for _ in range(H + 1)]
dp[0][1] = 1
for i in range(H):
    for j in range(W):
        if grid[i][j] == "#":
            pass
        else:
            dp[i + 1][j + 1] = (dp[i][j + 1] + dp[i + 1][j]) % (10**9 + 7)
print((dp[H][W]))

-            dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j] -print((dp[H][W] % (10**9 + 7))) +            dp[i + 1][j + 1] = (dp[i][j + 1] + dp[i + 1][j]) % (10**9 + 7) +print((dp[H][W]))