MOD = 10**9+7

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

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



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

dp[0][0] = 1

for i in range(H):

    for j in range(W):

        if j+1 < W:

            if a[i][j+1] != '#':

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

        if i+1 < H:

            if a[i+1][j] != '#':

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

            

print((dp[H-1][W-1] % MOD))
H, W = list(map(int, input().split()))

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

MOD = 10**9 + 7



dp = [[0]*1100 for _ in range(1100)]

dp[1][1] = 1

for h in range(1, H+1):

    for w in range(1, W+1):

        if h == 1 and w == 1:

            continue

        if a[h-1][w-1] == '#':

            dp[h][w] = 0

        else:

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

print((dp[H][W] % MOD))
MOD = 10**9 + 7
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for i in range(H):
    for j in range(W):
        if j + 1 < W:
            if a[i][j + 1] != "#":
                dp[i][j + 1] += dp[i][j] % MOD
        if i + 1 < H:
            if a[i + 1][j] != "#":
                dp[i + 1][j] += dp[i][j] % MOD
print((dp[H - 1][W - 1] % MOD))

H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
MOD = 10**9 + 7
dp = [[0] * 1100 for _ in range(1100)]
dp[1][1] = 1
for h in range(1, H + 1):
    for w in range(1, W + 1):
        if h == 1 and w == 1:
            continue
        if a[h - 1][w - 1] == "#":
            dp[h][w] = 0
        else:
            dp[h][w] += (dp[h - 1][w] + dp[h][w - 1]) % MOD
print((dp[H][W] % MOD))

-MOD = 10**9 + 7 -dp = [[0] * W for _ in range(H)] -dp[0][0] = 1 -for i in range(H): -    for j in range(W): -        if j + 1 < W: -            if a[i][j + 1] != "#": -                dp[i][j + 1] += dp[i][j] % MOD -        if i + 1 < H: -            if a[i + 1][j] != "#": -                dp[i + 1][j] += dp[i][j] % MOD -print((dp[H - 1][W - 1] % MOD)) +MOD = 10**9 + 7 +dp = [[0] * 1100 for _ in range(1100)] +dp[1][1] = 1 +for h in range(1, H + 1): +    for w in range(1, W + 1): +        if h == 1 and w == 1: +            continue +        if a[h - 1][w - 1] == "#": +            dp[h][w] = 0 +        else: +            dp[h][w] += (dp[h - 1][w] + dp[h][w - 1]) % MOD +print((dp[H][W] % MOD))