from collections import deque



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

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



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

dp[0][0] = 1

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

q = deque()

q.append((0, 0))

while q:

    t = q.popleft()

    i = t[0]

    j = t[1]

    used[i][j] = 2

    if i != H-1 and L[i+1][j] == "." and used[i+1][j] < 2:

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

        if used[i+1][j] == 0:

            q.append((i+1, j))

            used[i+1][j] = 1

    if j != W-1and L[i][j+1] == "." and used[i][j+1] < 2:

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

        if used[i][j+1] == 0:

            q.append((i, j+1))

            used[i][j+1] = 1

        

print((dp[H-1][W-1]%(10**9+7)))
H,W = list(map(int, input().split()))

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



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 A[i][j] == "#":

            continue

        if i > 0:

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

        if j > 0:

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

        dp[i][j] %= mod



print((dp[H-1][W-1]))
from collections import deque

H, W = list(map(int, input().split()))
L = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
used = [[0] * W for _ in range(H)]
q = deque()
q.append((0, 0))
while q:
    t = q.popleft()
    i = t[0]
    j = t[1]
    used[i][j] = 2
    if i != H - 1 and L[i + 1][j] == "." and used[i + 1][j] < 2:
        dp[i + 1][j] += dp[i][j]
        if used[i + 1][j] == 0:
            q.append((i + 1, j))
            used[i + 1][j] = 1
    if j != W - 1 and L[i][j + 1] == "." and used[i][j + 1] < 2:
        dp[i][j + 1] += dp[i][j]
        if used[i][j + 1] == 0:
            q.append((i, j + 1))
            used[i][j + 1] = 1
print((dp[H - 1][W - 1] % (10**9 + 7)))

H, W = list(map(int, input().split()))
A = [eval(input()) for _ in range(H)]
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 A[i][j] == "#":
            continue
        if i > 0:
            dp[i][j] += dp[i - 1][j]
        if j > 0:
            dp[i][j] += dp[i][j - 1]
        dp[i][j] %= mod
print((dp[H - 1][W - 1]))

-from collections import deque - -L = [eval(input()) for _ in range(H)] +A = [eval(input()) for _ in range(H)] +mod = 10**9 + 7 -used = [[0] * W for _ in range(H)] -q = deque() -q.append((0, 0)) -while q: -    t = q.popleft() -    i = t[0] -    j = t[1] -    used[i][j] = 2 -    if i != H - 1 and L[i + 1][j] == "." and used[i + 1][j] < 2: -        dp[i + 1][j] += dp[i][j] -        if used[i + 1][j] == 0: -            q.append((i + 1, j)) -            used[i + 1][j] = 1 -    if j != W - 1 and L[i][j + 1] == "." and used[i][j + 1] < 2: -        dp[i][j + 1] += dp[i][j] -        if used[i][j + 1] == 0: -            q.append((i, j + 1)) -            used[i][j + 1] = 1 -print((dp[H - 1][W - 1] % (10**9 + 7))) +for i in range(H): +    for j in range(W): +        if A[i][j] == "#": +            continue +        if i > 0: +            dp[i][j] += dp[i - 1][j] +        if j > 0: +            dp[i][j] += dp[i][j - 1] +        dp[i][j] %= mod +print((dp[H - 1][W - 1]))