# 配るDP

def main():

  divisor = 10 ** 9 + 7

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

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

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

  dp[0][0] = 1

  for i in range(h):

    ai = a[i]    

    dpi = dp[i]    

    if i + 1 < h:

      ai1 = a[i + 1]

      dpi1 = dp[i + 1]

    for j in range(w):

      if j + 1 < w and ai[j + 1] != '#':

        dpi[j + 1] = (dpi[j + 1] + dpi[j]) % divisor

      if i + 1 < h and ai1[j] != '#':

        dpi1[j] = dpi[j]

  print((dp[h - 1][w - 1]))

main()

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

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



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

dp[0][0] = 1

for w in range(1, W):

  if a[0][w] != '#':

    dp[0][w] = dp[0][w - 1]



for h in range(1, H):

  ah = a[h]

  dph = dp[h]

  dph1 = dp[h - 1]

  if ah[0] != '#':

    dph[0] = dph1[0]

  for w in range(1, W):

    if ah[w] != '#':

      dph[w] = (dph[w - 1] + dph1[w]) % 1000000007



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

# 配るDP
def main():
    divisor = 10**9 + 7
    h, w = list(map(int, input().split()))
    a = [eval(input()) for _ in range(h)]
    dp = [[0] * w for _ in range(h)]
    dp[0][0] = 1
    for i in range(h):
        ai = a[i]
        dpi = dp[i]
        if i + 1 < h:
            ai1 = a[i + 1]
            dpi1 = dp[i + 1]
        for j in range(w):
            if j + 1 < w and ai[j + 1] != "#":
                dpi[j + 1] = (dpi[j + 1] + dpi[j]) % divisor
            if i + 1 < h and ai1[j] != "#":
                dpi1[j] = dpi[j]
    print((dp[h - 1][w - 1]))


main()

H, W = list(map(int, input().split()))
a = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
for w in range(1, W):
    if a[0][w] != "#":
        dp[0][w] = dp[0][w - 1]
for h in range(1, H):
    ah = a[h]
    dph = dp[h]
    dph1 = dp[h - 1]
    if ah[0] != "#":
        dph[0] = dph1[0]
    for w in range(1, W):
        if ah[w] != "#":
            dph[w] = (dph[w - 1] + dph1[w]) % 1000000007
print((dp[H - 1][W - 1]))

-# 配るDP -def main(): -    divisor = 10**9 + 7 -    h, w = list(map(int, input().split())) -    a = [eval(input()) for _ in range(h)] -    dp = [[0] * w for _ in range(h)] -    dp[0][0] = 1 -    for i in range(h): -        ai = a[i] -        dpi = dp[i] -        if i + 1 < h: -            ai1 = a[i + 1] -            dpi1 = dp[i + 1] -        for j in range(w): -            if j + 1 < w and ai[j + 1] != "#": -                dpi[j + 1] = (dpi[j + 1] + dpi[j]) % divisor -            if i + 1 < h and ai1[j] != "#": -                dpi1[j] = dpi[j] -    print((dp[h - 1][w - 1])) - - -main() +H, W = list(map(int, input().split())) +a = [eval(input()) for _ in range(H)] +dp = [[0] * W for _ in range(H)] +dp[0][0] = 1 +for w in range(1, W): +    if a[0][w] != "#": +        dp[0][w] = dp[0][w - 1] +for h in range(1, H): +    ah = a[h] +    dph = dp[h] +    dph1 = dp[h - 1] +    if ah[0] != "#": +        dph[0] = dph1[0] +    for w in range(1, W): +        if ah[w] != "#": +            dph[w] = (dph[w - 1] + dph1[w]) % 1000000007 +print((dp[H - 1][W - 1]))