mod = 10 ** 9 + 7



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

a = tuple(eval(input()) for _ in range(h))



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

dp[0][0] = 1



# 配る

for r in range(h):

    for c in range(w):

        if a[r][c] == '#':

            continue

        if r + 1 < h and a[r + 1][c] == '.':

            dp[r + 1][c] = (dp[r + 1][c] + dp[r][c]) % mod

        if c + 1 < w and a[r][c + 1] == '.':

            dp[r][c + 1] = (dp[r][c + 1] + dp[r][c]) % mod

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

def main():

    import sys

    readline = sys.stdin.readline



    mod = 10 ** 9 + 7



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

    a = [readline().rstrip() for _ in range(h)]



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

    dp[0][0] = 1



    for r in range(h):

        for c in range(w):

            if a[r][c] == '#': continue

            if r > 0:

                dp[r][c] += dp[r - 1][c]

            if c > 0:

                dp[r][c] += dp[r][c - 1]

            dp[r][c] %= mod



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





if __name__ == '__main__':

    main()

mod = 10**9 + 7
h, w = list(map(int, input().split()))
a = tuple(eval(input()) for _ in range(h))
dp = [[0] * w for _ in range(h)]
dp[0][0] = 1
# 配る
for r in range(h):
    for c in range(w):
        if a[r][c] == "#":
            continue
        if r + 1 < h and a[r + 1][c] == ".":
            dp[r + 1][c] = (dp[r + 1][c] + dp[r][c]) % mod
        if c + 1 < w and a[r][c + 1] == ".":
            dp[r][c + 1] = (dp[r][c + 1] + dp[r][c]) % mod
print((dp[h - 1][w - 1]))

def main():
    import sys

    readline = sys.stdin.readline
    mod = 10**9 + 7
    h, w = list(map(int, readline().split()))
    a = [readline().rstrip() for _ in range(h)]
    dp = [[0] * w for _ in range(h)]
    dp[0][0] = 1
    for r in range(h):
        for c in range(w):
            if a[r][c] == "#":
                continue
            if r > 0:
                dp[r][c] += dp[r - 1][c]
            if c > 0:
                dp[r][c] += dp[r][c - 1]
            dp[r][c] %= mod
    print((dp[h - 1][w - 1]))


if __name__ == "__main__":
    main()

-mod = 10**9 + 7 -h, w = list(map(int, input().split())) -a = tuple(eval(input()) for _ in range(h)) -dp = [[0] * w for _ in range(h)] -dp[0][0] = 1 -# 配る -for r in range(h): -    for c in range(w): -        if a[r][c] == "#": -            continue -        if r + 1 < h and a[r + 1][c] == ".": -            dp[r + 1][c] = (dp[r + 1][c] + dp[r][c]) % mod -        if c + 1 < w and a[r][c + 1] == ".": -            dp[r][c + 1] = (dp[r][c + 1] + dp[r][c]) % mod -print((dp[h - 1][w - 1])) +def main(): +    import sys + +    readline = sys.stdin.readline +    mod = 10**9 + 7 +    h, w = list(map(int, readline().split())) +    a = [readline().rstrip() for _ in range(h)] +    dp = [[0] * w for _ in range(h)] +    dp[0][0] = 1 +    for r in range(h): +        for c in range(w): +            if a[r][c] == "#": +                continue +            if r > 0: +                dp[r][c] += dp[r - 1][c] +            if c > 0: +                dp[r][c] += dp[r][c - 1] +            dp[r][c] %= mod +    print((dp[h - 1][w - 1])) + + +if __name__ == "__main__": +    main()