def h_grid1(MOD=10**9 + 7):

    H, W = [int(i) for i in input().split()]

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



    # path[r][c]: マス(r, c)に(0-based)到達する経路の数

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

    path[0][0] = 1  # スタート地点は必ず到達できる



    def can_reach(row, col):

        return 0 <= row < H and 0 <= col < W and Grid[row][col] == '.'



    for row in range(H):

        for col in range(W):

            if Grid[row][col] == '#':

                continue

            for nr, nc in ((row, col + 1), (row + 1, col)):

                if can_reach(nr, nc):

                    path[nr][nc] += path[row][col]

                    path[nr][nc] %= MOD

    return path[H - 1][W - 1]



print((h_grid1()))
def h_grid1(MOD=10**9 + 7):

    H, W = [int(i) for i in input().split()]

    Grid = ['#' * (W + 1)] + ['#' + eval(input()) for _ in range(H)]  # 左と上を埋める



    # path[r][c]: マス(r, c)に(0-based)到達する経路の数

    path = [[0] * (W + 1) for _ in range(H + 1)]

    path[0][1] = 1  # path[1][1] = 1 (スタート地点) とするための便宜上の代入



    for row in range(1, H + 1):

        for col in range(1, W + 1):

            if Grid[row][col] == '.':

                path[row][col] = (path[row - 1][col] + path[row][col - 1]) % MOD

    return path[H][W]



print((h_grid1()))
def h_grid1(MOD=10**9 + 7):
    H, W = [int(i) for i in input().split()]
    Grid = [eval(input()) for _ in range(H)]
    # path[r][c]: マス(r, c)に(0-based)到達する経路の数
    path = [[0] * W for _ in range(H)]
    path[0][0] = 1  # スタート地点は必ず到達できる

    def can_reach(row, col):
        return 0 <= row < H and 0 <= col < W and Grid[row][col] == "."

    for row in range(H):
        for col in range(W):
            if Grid[row][col] == "#":
                continue
            for nr, nc in ((row, col + 1), (row + 1, col)):
                if can_reach(nr, nc):
                    path[nr][nc] += path[row][col]
                    path[nr][nc] %= MOD
    return path[H - 1][W - 1]


print((h_grid1()))

def h_grid1(MOD=10**9 + 7):
    H, W = [int(i) for i in input().split()]
    Grid = ["#" * (W + 1)] + ["#" + eval(input()) for _ in range(H)]  # 左と上を埋める
    # path[r][c]: マス(r, c)に(0-based)到達する経路の数
    path = [[0] * (W + 1) for _ in range(H + 1)]
    path[0][1] = 1  # path[1][1] = 1 (スタート地点) とするための便宜上の代入
    for row in range(1, H + 1):
        for col in range(1, W + 1):
            if Grid[row][col] == ".":
                path[row][col] = (path[row - 1][col] + path[row][col - 1]) % MOD
    return path[H][W]


print((h_grid1()))

-    Grid = [eval(input()) for _ in range(H)] +    Grid = ["#" * (W + 1)] + ["#" + eval(input()) for _ in range(H)]  # 左と上を埋める -    path = [[0] * W for _ in range(H)] -    path[0][0] = 1  # スタート地点は必ず到達できる - -    def can_reach(row, col): -        return 0 <= row < H and 0 <= col < W and Grid[row][col] == "." - -    for row in range(H): -        for col in range(W): -            if Grid[row][col] == "#": -                continue -            for nr, nc in ((row, col + 1), (row + 1, col)): -                if can_reach(nr, nc): -                    path[nr][nc] += path[row][col] -                    path[nr][nc] %= MOD -    return path[H - 1][W - 1] +    path = [[0] * (W + 1) for _ in range(H + 1)] +    path[0][1] = 1  # path[1][1] = 1 (スタート地点) とするための便宜上の代入 +    for row in range(1, H + 1): +        for col in range(1, W + 1): +            if Grid[row][col] == ".": +                path[row][col] = (path[row - 1][col] + path[row][col - 1]) % MOD +    return path[H][W]