import sys

input = sys.stdin.readline



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

MOD = 10 ** 9 + 7

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



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

dp[0][0] = 1

 

for y in range(H):

  for x in range(W):

    if y+1 < H and A[y+1][x] == '.':

      dp[y+1][x] += dp[y][x]

      dp[y+1][x] = dp[y+1][x] % MOD



    if x+1 < W and A[y][x+1] == '.':

      dp[y][x+1] += dp[y][x]

      dp[y][x+1] = dp[y][x+1] % MOD



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

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

maze = [[-1 for i in range(w)] for j in range(h)]



ans = 0

for i in range(h):

    maze[i] = eval(input())



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

dp[1][1] = 1



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

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

        if maze[i-1][j-1] == '.':

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





ans = dp[h][w]%p



print(ans)
import sys

input = sys.stdin.readline
H, W = list(map(int, input().split()))
MOD = 10**9 + 7
A = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for y in range(H):
    for x in range(W):
        if y + 1 < H and A[y + 1][x] == ".":
            dp[y + 1][x] += dp[y][x]
            dp[y + 1][x] = dp[y + 1][x] % MOD
        if x + 1 < W and A[y][x + 1] == ".":
            dp[y][x + 1] += dp[y][x]
            dp[y][x + 1] = dp[y][x + 1] % MOD
print((dp[H - 1][W - 1]))

p = 10**9 + 7
h, w = list(map(int, input().split()))
maze = [[-1 for i in range(w)] for j in range(h)]
ans = 0
for i in range(h):
    maze[i] = eval(input())
dp = [[0] * (w + 1) for _ in range(h + 1)]
dp[1][1] = 1
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if maze[i - 1][j - 1] == ".":
            dp[i][j] += dp[i - 1][j] % p + dp[i][j - 1] % p
ans = dp[h][w] % p
print(ans)

-import sys - -input = sys.stdin.readline -H, W = list(map(int, input().split())) -MOD = 10**9 + 7 -A = [eval(input()) for _ in range(H)] -dp = [[0] * W for _ in range(H)] -dp[0][0] = 1 -for y in range(H): -    for x in range(W): -        if y + 1 < H and A[y + 1][x] == ".": -            dp[y + 1][x] += dp[y][x] -            dp[y + 1][x] = dp[y + 1][x] % MOD -        if x + 1 < W and A[y][x + 1] == ".": -            dp[y][x + 1] += dp[y][x] -            dp[y][x + 1] = dp[y][x + 1] % MOD -print((dp[H - 1][W - 1])) +p = 10**9 + 7 +h, w = list(map(int, input().split())) +maze = [[-1 for i in range(w)] for j in range(h)] +ans = 0 +for i in range(h): +    maze[i] = eval(input()) +dp = [[0] * (w + 1) for _ in range(h + 1)] +dp[1][1] = 1 +for i in range(1, h + 1): +    for j in range(1, w + 1): +        if maze[i - 1][j - 1] == ".": +            dp[i][j] += dp[i - 1][j] % p + dp[i][j - 1] % p +ans = dp[h][w] % p +print(ans)