import sys

sys.setrecursionlimit(10**9)

mod=10**9+7

m,n=list(map(int,input().split()))

grid=[eval(input()) for _ in range(m)]

cache={}

def dp(i,j):

  if i<0 or j<0 or i>=len(grid) or j>=len(grid[0]) or grid[i][j]=='#':

    return 0

  elif (i,j) in cache:

    return cache[(i,j)]

  elif i==m-1 and j==n-1:

    return 1

  cache[(i,j)]=dp(i+1,j)+dp(i,j+1)

  return cache[(i,j)]



print((dp(0,0)%mod)) 

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

grid=[eval(input()) for _ in range(h)]

mod=10**9+7

dp=[0]*w

for  i in range(h):

    for j in range(w):

        if i==j==0:

            dp[j]=1

        elif grid[i][j]=='#':

            dp[j]=0

        elif j>0:

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

print((dp[w-1]%mod))
import sys

sys.setrecursionlimit(10**9)
mod = 10**9 + 7
m, n = list(map(int, input().split()))
grid = [eval(input()) for _ in range(m)]
cache = {}


def dp(i, j):
    if i < 0 or j < 0 or i >= len(grid) or j >= len(grid[0]) or grid[i][j] == "#":
        return 0
    elif (i, j) in cache:
        return cache[(i, j)]
    elif i == m - 1 and j == n - 1:
        return 1
    cache[(i, j)] = dp(i + 1, j) + dp(i, j + 1)
    return cache[(i, j)]


print((dp(0, 0) % mod))

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

-import sys - -sys.setrecursionlimit(10**9) +h, w = list(map(int, input().split())) +grid = [eval(input()) for _ in range(h)] -m, n = list(map(int, input().split())) -grid = [eval(input()) for _ in range(m)] -cache = {} - - -def dp(i, j): -    if i < 0 or j < 0 or i >= len(grid) or j >= len(grid[0]) or grid[i][j] == "#": -        return 0 -    elif (i, j) in cache: -        return cache[(i, j)] -    elif i == m - 1 and j == n - 1: -        return 1 -    cache[(i, j)] = dp(i + 1, j) + dp(i, j + 1) -    return cache[(i, j)] - - -print((dp(0, 0) % mod)) +dp = [0] * w +for i in range(h): +    for j in range(w): +        if i == j == 0: +            dp[j] = 1 +        elif grid[i][j] == "#": +            dp[j] = 0 +        elif j > 0: +            dp[j] = dp[j] + dp[j - 1] +print((dp[w - 1] % mod))