# 配るDP

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

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



m = 1000000007



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

dp[0][0] = 1

for h in range(H - 1):

    for w in range(W - 1):

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

            continue

        if a[h][w + 1] != '#':

            dp[h][w + 1] = (dp[h][w + 1] + dp[h][w]) % m

        if a[h + 1][w] != '#':

            dp[h + 1][w] = (dp[h + 1][w] + dp[h][w]) % m

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

        continue

    if a[h + 1][W - 1] != '#':

        dp[h + 1][W - 1] = (dp[h + 1][W - 1] + dp[h][W - 1]) % m

for w in range(W - 1):

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

        continue

    if a[H - 1][w + 1] != '#':

        dp[H - 1][w + 1] = (dp[H - 1][w + 1] + dp[H - 1][w]) % m



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

# 貰うDP

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

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



m = 1000000007



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

dp[0][0] = 1

for w in range(1, W):

    if a[0][w] != '#':

        dp[0][w] = dp[0][w - 1]



for h in range(1, H):

    if a[h][0] != '#':

        dp[h][0] = dp[h - 1][0]

    for w in range(1, W):

        if a[h][w] != '#':

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



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

# 配るDP
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
m = 1000000007
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for h in range(H - 1):
    for w in range(W - 1):
        if a[h][w] == "#":
            continue
        if a[h][w + 1] != "#":
            dp[h][w + 1] = (dp[h][w + 1] + dp[h][w]) % m
        if a[h + 1][w] != "#":
            dp[h + 1][w] = (dp[h + 1][w] + dp[h][w]) % m
    if a[h][W - 1] == "#":
        continue
    if a[h + 1][W - 1] != "#":
        dp[h + 1][W - 1] = (dp[h + 1][W - 1] + dp[h][W - 1]) % m
for w in range(W - 1):
    if a[H - 1][w] == "#":
        continue
    if a[H - 1][w + 1] != "#":
        dp[H - 1][w + 1] = (dp[H - 1][w + 1] + dp[H - 1][w]) % m
print((dp[H - 1][W - 1]))

# 貰うDP
H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
m = 1000000007
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for w in range(1, W):
    if a[0][w] != "#":
        dp[0][w] = dp[0][w - 1]
for h in range(1, H):
    if a[h][0] != "#":
        dp[h][0] = dp[h - 1][0]
    for w in range(1, W):
        if a[h][w] != "#":
            dp[h][w] = (dp[h][w - 1] + dp[h - 1][w]) % m
print((dp[H - 1][W - 1]))

-# 配るDP +# 貰うDP -for h in range(H - 1): -    for w in range(W - 1): -        if a[h][w] == "#": -            continue -        if a[h][w + 1] != "#": -            dp[h][w + 1] = (dp[h][w + 1] + dp[h][w]) % m -        if a[h + 1][w] != "#": -            dp[h + 1][w] = (dp[h + 1][w] + dp[h][w]) % m -    if a[h][W - 1] == "#": -        continue -    if a[h + 1][W - 1] != "#": -        dp[h + 1][W - 1] = (dp[h + 1][W - 1] + dp[h][W - 1]) % m -for w in range(W - 1): -    if a[H - 1][w] == "#": -        continue -    if a[H - 1][w + 1] != "#": -        dp[H - 1][w + 1] = (dp[H - 1][w + 1] + dp[H - 1][w]) % m +for w in range(1, W): +    if a[0][w] != "#": +        dp[0][w] = dp[0][w - 1] +for h in range(1, H): +    if a[h][0] != "#": +        dp[h][0] = dp[h - 1][0] +    for w in range(1, W): +        if a[h][w] != "#": +            dp[h][w] = (dp[h][w - 1] + dp[h - 1][w]) % m