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):

  for j in range(w):

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

      dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % divisor

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

      dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % divisor

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

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 i + 1 < h and ai1[j] != '#':

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

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

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

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

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):
    for j in range(w):
        if i + 1 < h and a[i + 1][j] != "#":
            dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % divisor
        if j + 1 < w and a[i][j + 1] != "#":
            dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % divisor
print((dp[h - 1][w - 1]))

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 i + 1 < h and ai1[j] != "#":
                dpi1[j] = (dpi1[j] + dpi[j]) % divisor
            if j + 1 < w and ai[j + 1] != "#":
                dpi[j + 1] = (dpi[j + 1] + dpi[j]) % divisor
    print((dp[h - 1][w - 1]))


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): -    for j in range(w): -        if i + 1 < h and a[i + 1][j] != "#": -            dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % divisor -        if j + 1 < w and a[i][j + 1] != "#": -            dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % divisor -print((dp[h - 1][w - 1])) +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 i + 1 < h and ai1[j] != "#": +                dpi1[j] = (dpi1[j] + dpi[j]) % divisor +            if j + 1 < w and ai[j + 1] != "#": +                dpi[j + 1] = (dpi[j + 1] + dpi[j]) % divisor +    print((dp[h - 1][w - 1])) + + +main()