import sys

import numpy as np

from functools import lru_cache

from collections import deque



#input = sys.stdin.readline

#sys.setrecursionlimit(10 ** 5)



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

grid = [list(eval(input())) for i in range(H)]

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

dp[0][0] = 1

mod = (10 ** 9) + 7



for i in range(H):

  for j in range(W):

    if i > 0 or j > 0:

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

        dp[i][j] = 0

      else:

        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod



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

#print(dp)
import sys

buf = sys.stdin.buffer



import numpy as np

MOD = 10 ** 9 + 7



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



grid = np.frombuffer(buf.read(),dtype='S1').reshape(H,-1)[:,:W]



#print(grid)



MOD = 10 ** 9 + 7

dp = np.zeros(W, dtype = np.int64)

dp[0] = 1



for row in grid:

  #print(row == b"#")

  wall = (row == b'#')

  # 上から落としてくる

  dp[wall] = 0

  # 左から右に

  np.cumsum(dp, out = dp)

  # 壁の補正

  sub = np.maximum.accumulate(dp * wall)

  dp -= sub

  dp %= MOD



answer = dp[-1]

print(answer)
import sys
import numpy as np
from functools import lru_cache
from collections import deque

# input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 5)
H, W = list(map(int, input().split()))
grid = [list(eval(input())) for i in range(H)]
dp = [[0] * (W + 1) for i in range(H + 1)]
dp[0][0] = 1
mod = (10**9) + 7
for i in range(H):
    for j in range(W):
        if i > 0 or j > 0:
            if grid[i][j] == "#":
                dp[i][j] = 0
            else:
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod
print((dp[H - 1][W - 1]))
# print(dp)

import sys

buf = sys.stdin.buffer
import numpy as np

MOD = 10**9 + 7
H, W = list(map(int, buf.readline().split()))
grid = np.frombuffer(buf.read(), dtype="S1").reshape(H, -1)[:, :W]
# print(grid)
MOD = 10**9 + 7
dp = np.zeros(W, dtype=np.int64)
dp[0] = 1
for row in grid:
    # print(row == b"#")
    wall = row == b"#"
    # 上から落としてくる
    dp[wall] = 0
    # 左から右に
    np.cumsum(dp, out=dp)
    # 壁の補正
    sub = np.maximum.accumulate(dp * wall)
    dp -= sub
    dp %= MOD
answer = dp[-1]
print(answer)

+ +buf = sys.stdin.buffer -from functools import lru_cache -from collections import deque -# input = sys.stdin.readline -# sys.setrecursionlimit(10 ** 5) -H, W = list(map(int, input().split())) -grid = [list(eval(input())) for i in range(H)] -dp = [[0] * (W + 1) for i in range(H + 1)] -dp[0][0] = 1 -mod = (10**9) + 7 -for i in range(H): -    for j in range(W): -        if i > 0 or j > 0: -            if grid[i][j] == "#": -                dp[i][j] = 0 -            else: -                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod -print((dp[H - 1][W - 1])) -# print(dp) +MOD = 10**9 + 7 +H, W = list(map(int, buf.readline().split())) +grid = np.frombuffer(buf.read(), dtype="S1").reshape(H, -1)[:, :W] +# print(grid) +MOD = 10**9 + 7 +dp = np.zeros(W, dtype=np.int64) +dp[0] = 1 +for row in grid: +    # print(row == b"#") +    wall = row == b"#" +    # 上から落としてくる +    dp[wall] = 0 +    # 左から右に +    np.cumsum(dp, out=dp) +    # 壁の補正 +    sub = np.maximum.accumulate(dp * wall) +    dp -= sub +    dp %= MOD +answer = dp[-1] +print(answer)