MOD = 10 ** 9 + 7



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

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



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

dp[1][1] = 1



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

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

        if r == 1 and c == 1:

            continue

        if a[r - 1][c - 1] == '#':

            continue

        else:

            dp[r][c] = (dp[r - 1][c] + dp[r][c - 1]) % MOD

print((dp[H][W]))

mod = 10 ** 9 + 7



h, w = list(map(int, input().split()))

a = tuple(eval(input()) for _ in range(h))



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

dp[0][0] = 1



# 配る

for r in range(h):

    for c in range(w):

        if a[r][c] == '#':

            continue

        if r + 1 < h and a[r + 1][c] == '.':

            dp[r + 1][c] = (dp[r + 1][c] + dp[r][c]) % mod

        if c + 1 < w and a[r][c + 1] == '.':

            dp[r][c + 1] = (dp[r][c + 1] + dp[r][c]) % mod

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

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

mod = 10**9 + 7
h, w = list(map(int, input().split()))
a = tuple(eval(input()) for _ in range(h))
dp = [[0] * w for _ in range(h)]
dp[0][0] = 1
# 配る
for r in range(h):
    for c in range(w):
        if a[r][c] == "#":
            continue
        if r + 1 < h and a[r + 1][c] == ".":
            dp[r + 1][c] = (dp[r + 1][c] + dp[r][c]) % mod
        if c + 1 < w and a[r][c + 1] == ".":
            dp[r][c + 1] = (dp[r][c + 1] + dp[r][c]) % mod
print((dp[h - 1][w - 1]))

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