

def mod(num):

    return num % (10 ** 9 + 7)



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

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



for i in range(H):

    a = eval(input())

    for j in range(W):

        if a[j] == "#":

            dp[i][j] = -1



dp[0][0] = 1



for col in range(1, W):

    if dp[0][col] != -1:

        dp[0][col] = dp[0][col - 1]

    else:

        dp[0][col] = 0



for row in range(1, H):

    for col in range(W):

        if dp[row][col] != -1:

            if col == 0:

                dp[row][col] = dp[row - 1][col]

            else:

                dp[row][col] = mod(dp[row - 1][col] + dp[row][col - 1])

        else:

            dp[row][col] = 0



print((dp[-1][-1]))
#!/usr/bin/env python3



#import

#import math

#import numpy as np

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

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



def mod(num):

    return num % (10 ** 9 + 7)

    

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



for i in range(H):

    for j in range(W):

        if i == 0 and j == 0:

            dp[i][j] = 1

            continue



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

            continue



        if i == 0:

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

        elif j == 0:

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

        else:

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

            

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

def mod(num):
    return num % (10**9 + 7)


H, W = list(map(int, input().split()))
dp = [[0] * W for _ in range(H)]
for i in range(H):
    a = eval(input())
    for j in range(W):
        if a[j] == "#":
            dp[i][j] = -1
dp[0][0] = 1
for col in range(1, W):
    if dp[0][col] != -1:
        dp[0][col] = dp[0][col - 1]
    else:
        dp[0][col] = 0
for row in range(1, H):
    for col in range(W):
        if dp[row][col] != -1:
            if col == 0:
                dp[row][col] = dp[row - 1][col]
            else:
                dp[row][col] = mod(dp[row - 1][col] + dp[row][col - 1])
        else:
            dp[row][col] = 0
print((dp[-1][-1]))

#!/usr/bin/env python3
# import
# import math
# import numpy as np
H, W = list(map(int, input().split()))
A = [list(eval(input())) for _ in range(H)]


def mod(num):
    return num % (10**9 + 7)


dp = [[0] * W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if i == 0 and j == 0:
            dp[i][j] = 1
            continue
        if A[i][j] == "#":
            continue
        if i == 0:
            dp[i][j] = dp[i][j - 1]
        elif j == 0:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = mod(dp[i - 1][j] + dp[i][j - 1])
print((dp[-1][-1]))

+#!/usr/bin/env python3 +# import +# import math +# import numpy as np +H, W = list(map(int, input().split())) +A = [list(eval(input())) for _ in range(H)] + + -H, W = list(map(int, input().split())) -    a = eval(input()) -        if a[j] == "#": -            dp[i][j] = -1 -dp[0][0] = 1 -for col in range(1, W): -    if dp[0][col] != -1: -        dp[0][col] = dp[0][col - 1] -    else: -        dp[0][col] = 0 -for row in range(1, H): -    for col in range(W): -        if dp[row][col] != -1: -            if col == 0: -                dp[row][col] = dp[row - 1][col] -            else: -                dp[row][col] = mod(dp[row - 1][col] + dp[row][col - 1]) +        if i == 0 and j == 0: +            dp[i][j] = 1 +            continue +        if A[i][j] == "#": +            continue +        if i == 0: +            dp[i][j] = dp[i][j - 1] +        elif j == 0: +            dp[i][j] = dp[i - 1][j] -            dp[row][col] = 0 +            dp[i][j] = mod(dp[i - 1][j] + dp[i][j - 1])