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

grid=[None]*h

for i in range(h):

  grid[i]=eval(input())

  

dp=[[0 for i in range(w)] for j in range(h)]

DIV=10**9+7



for i in range(h):

  for j in range(w):

    if grid[i][j]=="#":

      dp[i][j]=0

    elif i==0 and j==0:

      dp[i][j]=1

    else:

      up=0

      left=0

      if i>0:

        up=dp[i-1][j]

      if j>0:

        left=dp[i][j-1]

      dp[i][j]=(up+left)%DIV

        

print((dp[-1][-1]))
import sys

readline = sys.stdin.readline



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

G = [None] * (H + 1)

G[0] = "." * (W + 1)

for i in range(H):

  G[i + 1] = "." + readline().rstrip()



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

dp[1][0] = 1 # 便宜上、枠外に1を入れておくことで、dp[1][1]が1になる

DIV = 10 ** 9 + 7



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

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

    if G[i][j] == "#":

      dp[i][j] = 0

    else:

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

      dp[i][j] %= DIV

      

print((dp[H][W]))
h, w = list(map(int, input().split()))
grid = [None] * h
for i in range(h):
    grid[i] = eval(input())
dp = [[0 for i in range(w)] for j in range(h)]
DIV = 10**9 + 7
for i in range(h):
    for j in range(w):
        if grid[i][j] == "#":
            dp[i][j] = 0
        elif i == 0 and j == 0:
            dp[i][j] = 1
        else:
            up = 0
            left = 0
            if i > 0:
                up = dp[i - 1][j]
            if j > 0:
                left = dp[i][j - 1]
            dp[i][j] = (up + left) % DIV
print((dp[-1][-1]))

import sys

readline = sys.stdin.readline
H, W = list(map(int, readline().split()))
G = [None] * (H + 1)
G[0] = "." * (W + 1)
for i in range(H):
    G[i + 1] = "." + readline().rstrip()
dp = [[0] * (W + 1) for i in range(H + 1)]
dp[1][0] = 1  # 便宜上、枠外に1を入れておくことで、dp[1][1]が1になる
DIV = 10**9 + 7
for i in range(1, H + 1):
    for j in range(1, W + 1):
        if G[i][j] == "#":
            dp[i][j] = 0
        else:
            dp[i][j] = dp[i][j - 1] + dp[i - 1][j]
            dp[i][j] %= DIV
print((dp[H][W]))

-h, w = list(map(int, input().split())) -grid = [None] * h -for i in range(h): -    grid[i] = eval(input()) -dp = [[0 for i in range(w)] for j in range(h)] +import sys + +readline = sys.stdin.readline +H, W = list(map(int, readline().split())) +G = [None] * (H + 1) +G[0] = "." * (W + 1) +for i in range(H): +    G[i + 1] = "." + readline().rstrip() +dp = [[0] * (W + 1) for i in range(H + 1)] +dp[1][0] = 1  # 便宜上、枠外に1を入れておくことで、dp[1][1]が1になる -for i in range(h): -    for j in range(w): -        if grid[i][j] == "#": +for i in range(1, H + 1): +    for j in range(1, W + 1): +        if G[i][j] == "#": -        elif i == 0 and j == 0: -            dp[i][j] = 1 -            up = 0 -            left = 0 -            if i > 0: -                up = dp[i - 1][j] -            if j > 0: -                left = dp[i][j - 1] -            dp[i][j] = (up + left) % DIV -print((dp[-1][-1])) +            dp[i][j] = dp[i][j - 1] + dp[i - 1][j] +            dp[i][j] %= DIV +print((dp[H][W]))