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

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



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

dp[0][0] = 1



MOD = 10 ** 9 + 7



for y in range(H):

	for x in range(W):

		if y + 1 < H and STAGE[y + 1][x] == ".":

			dp[y + 1][x] += dp[y][x] % MOD

		if x + 1 < W and STAGE[y][x + 1] == ".":

			dp[y][x + 1] += dp[y][x] % MOD



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

def main():

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

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



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

	dp[0][0] = 1



	MOD = 10 ** 9 + 7



	for y in range(H):

		for x in range(W):

			if y + 1 < H and STAGE[y + 1][x] == ".":

				dp[y + 1][x] += dp[y][x] % MOD

			if x + 1 < W and STAGE[y][x + 1] == ".":

				dp[y][x + 1] += dp[y][x] % MOD



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



main()

H, W = list(map(int, input().split()))
STAGE = [eval(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = 1
MOD = 10**9 + 7
for y in range(H):
    for x in range(W):
        if y + 1 < H and STAGE[y + 1][x] == ".":
            dp[y + 1][x] += dp[y][x] % MOD
        if x + 1 < W and STAGE[y][x + 1] == ".":
            dp[y][x + 1] += dp[y][x] % MOD
print((dp[-1][-1] % MOD))

def main():
    H, W = list(map(int, input().split()))
    STAGE = [eval(input()) for _ in range(H)]
    dp = [[0] * W for _ in range(H)]
    dp[0][0] = 1
    MOD = 10**9 + 7
    for y in range(H):
        for x in range(W):
            if y + 1 < H and STAGE[y + 1][x] == ".":
                dp[y + 1][x] += dp[y][x] % MOD
            if x + 1 < W and STAGE[y][x + 1] == ".":
                dp[y][x + 1] += dp[y][x] % MOD
    print((dp[-1][-1] % MOD))


main()

-H, W = list(map(int, input().split())) -STAGE = [eval(input()) for _ in range(H)] -dp = [[0] * W for _ in range(H)] -dp[0][0] = 1 -MOD = 10**9 + 7 -for y in range(H): -    for x in range(W): -        if y + 1 < H and STAGE[y + 1][x] == ".": -            dp[y + 1][x] += dp[y][x] % MOD -        if x + 1 < W and STAGE[y][x + 1] == ".": -            dp[y][x + 1] += dp[y][x] % MOD -print((dp[-1][-1] % MOD)) +def main(): +    H, W = list(map(int, input().split())) +    STAGE = [eval(input()) for _ in range(H)] +    dp = [[0] * W for _ in range(H)] +    dp[0][0] = 1 +    MOD = 10**9 + 7 +    for y in range(H): +        for x in range(W): +            if y + 1 < H and STAGE[y + 1][x] == ".": +                dp[y + 1][x] += dp[y][x] % MOD +            if x + 1 < W and STAGE[y][x + 1] == ".": +                dp[y][x + 1] += dp[y][x] % MOD +    print((dp[-1][-1] % MOD)) + + +main()