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

    if a[0][i] == "#":

        break

    dp[0][i] = 1

for j in range(h):

    if a[j][0] == "#":

        break

    dp[j][0] = 1



for i in range(1,h):

    for j in range(1,w):

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

            continue

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

print((dp[h-1][w-1]%(10**9+7)))
h,w=list(map(int,input().split()))

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

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

dp[0][0] = 1

for i in range(h):

    for j in range(w):

        if i == 0 and j == 0: 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] = dp[i-1][j] + dp[i][j-1]

            dp[i][j] %= 1000000007

print((dp[h-1][w-1]))
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(w):
    if a[0][i] == "#":
        break
    dp[0][i] = 1
for j in range(h):
    if a[j][0] == "#":
        break
    dp[j][0] = 1
for i in range(1, h):
    for j in range(1, w):
        if a[i][j] == "#":
            continue
        dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
print((dp[h - 1][w - 1] % (10**9 + 7)))

h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
dp = [[0 for _ in range(w)] for __ in range(h)]
dp[0][0] = 1
for i in range(h):
    for j in range(w):
        if i == 0 and j == 0:
            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] = dp[i - 1][j] + dp[i][j - 1]
            dp[i][j] %= 1000000007
print((dp[h - 1][w - 1]))

-dp = [[0] * w for _ in range(h)] +dp = [[0 for _ in range(w)] for __ in range(h)] -for i in range(w): -    if a[0][i] == "#": -        break -    dp[0][i] = 1 -for j in range(h): -    if a[j][0] == "#": -        break -    dp[j][0] = 1 -for i in range(1, h): -    for j in range(1, w): +for i in range(h): +    for j in range(w): +        if i == 0 and j == 0: +            continue -        dp[i][j] = dp[i - 1][j] + dp[i][j - 1] -print((dp[h - 1][w - 1] % (10**9 + 7))) +        if i == 0: +            dp[i][j] = dp[i][j - 1] +        elif j == 0: +            dp[i][j] = dp[i - 1][j] +        else: +            dp[i][j] = dp[i - 1][j] + dp[i][j - 1] +            dp[i][j] %= 1000000007 +print((dp[h - 1][w - 1]))