import sys

sys.setrecursionlimit(10**5+10)

input = sys.stdin.readline

def I(): return int(sys.stdin.readline())

def MI(): return list(map(int, sys.stdin.readline().split()))

def LI(): return list(map(int, sys.stdin.readline().split()))

def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]

def S(): return sys.stdin.readline()

def LS(): return sys.stdin.readline().split()

def LS2(N): return [sys.stdin.readline().split() for i in range(N)]

def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]

MOD = 1000000007

INF = float("inf")



H,W = LI()

c = [list(S()) for i in range(H)]

dp = FILL(0,H+1,W+1)

dp[0][0] = 1

for i in range(H):

    for j in range(W):

        if i+1<H:

            if c[i+1][j] == '.':

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



        if j+1<W:

            if c[i][j+1] == '.':

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



        dp[i][j] %= MOD





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

import sys

import math

from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

from collections import deque

from bisect import bisect_left

from itertools import product

def I(): return int(sys.stdin.readline())

def MI(): return list(map(int, sys.stdin.readline().split()))

def LI(): return list(map(int, sys.stdin.readline().split()))

def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]

#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる

def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))

def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]

#文字列として取得

def ST(): return sys.stdin.readline().rstrip()

def LST(): return sys.stdin.readline().rstrip().split()

def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]

def FILL(i,h): return [i for j in range(h)]

def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]

def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]

def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]

def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)

#'0.01'や'1E1'などで指定、整数に戻すならintをかます

MOD = 1000000007

INF = float("inf")

sys.setrecursionlimit(10**6+10)



H,W = MI()

V = [list(ST()) for _ in range(H)]

dp = FILL2(0,H+1,W+1)

dp[1][1]=1

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

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

        if V[i-1][j-1] == '.' and (i!=1 or j!=1):

            dp[i][j] = (dp[i-1][j] + dp[i][j-1])%MOD

print((dp[H][W]))

import sys

sys.setrecursionlimit(10**5 + 10)
input = sys.stdin.readline


def I():
    return int(sys.stdin.readline())


def MI():
    return list(map(int, sys.stdin.readline().split()))


def LI():
    return list(map(int, sys.stdin.readline().split()))


def LI2(N):
    return [list(map(int, sys.stdin.readline().split())) for i in range(N)]


def S():
    return sys.stdin.readline()


def LS():
    return sys.stdin.readline().split()


def LS2(N):
    return [sys.stdin.readline().split() for i in range(N)]


def FILL(i, h, w):
    return [[i for j in range(w)] for k in range(h)]


MOD = 1000000007
INF = float("inf")
H, W = LI()
c = [list(S()) for i in range(H)]
dp = FILL(0, H + 1, W + 1)
dp[0][0] = 1
for i in range(H):
    for j in range(W):
        if i + 1 < H:
            if c[i + 1][j] == ".":
                dp[i + 1][j] += dp[i][j]
        if j + 1 < W:
            if c[i][j + 1] == ".":
                dp[i][j + 1] += dp[i][j]
        dp[i][j] %= MOD
print((dp[H - 1][W - 1]))

import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product


def I():
    return int(sys.stdin.readline())


def MI():
    return list(map(int, sys.stdin.readline().split()))


def LI():
    return list(map(int, sys.stdin.readline().split()))


def LI2(N):
    return [list(map(int, sys.stdin.readline().split())) for i in range(N)]


# 文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI():
    return list(map(int, list(sys.stdin.readline().rstrip())))


def LSI2(N):
    return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]


# 文字列として取得
def ST():
    return sys.stdin.readline().rstrip()


def LST():
    return sys.stdin.readline().rstrip().split()


def LST2(N):
    return [sys.stdin.readline().rstrip().split() for i in range(N)]


def FILL(i, h):
    return [i for j in range(h)]


def FILL2(i, h, w):
    return [FILL(i, w) for j in range(h)]


def FILL3(i, h, w, d):
    return [FILL2(i, w, d) for j in range(h)]


def FILL4(i, h, w, d, d2):
    return [FILL3(i, w, d, d2) for j in range(h)]


def sisha(num, digit):
    return Decimal(str(num)).quantize(Decimal(digit), rounding=ROUND_HALF_UP)


#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6 + 10)
H, W = MI()
V = [list(ST()) for _ in range(H)]
dp = FILL2(0, H + 1, W + 1)
dp[1][1] = 1
for i in range(1, H + 1):
    for j in range(1, W + 1):
        if V[i - 1][j - 1] == "." and (i != 1 or j != 1):
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD
print((dp[H][W]))

- -sys.setrecursionlimit(10**5 + 10) -input = sys.stdin.readline +import math +from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN +from collections import deque +from bisect import bisect_left +from itertools import product -def S(): -    return sys.stdin.readline() +# 文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる +def LSI(): +    return list(map(int, list(sys.stdin.readline().rstrip()))) -def LS(): -    return sys.stdin.readline().split() +def LSI2(N): +    return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)] -def LS2(N): -    return [sys.stdin.readline().split() for i in range(N)] +# 文字列として取得 +def ST(): +    return sys.stdin.readline().rstrip() -def FILL(i, h, w): -    return [[i for j in range(w)] for k in range(h)] +def LST(): +    return sys.stdin.readline().rstrip().split() +def LST2(N): +    return [sys.stdin.readline().rstrip().split() for i in range(N)] + + +def FILL(i, h): +    return [i for j in range(h)] + + +def FILL2(i, h, w): +    return [FILL(i, w) for j in range(h)] + + +def FILL3(i, h, w, d): +    return [FILL2(i, w, d) for j in range(h)] + + +def FILL4(i, h, w, d, d2): +    return [FILL3(i, w, d, d2) for j in range(h)] + + +def sisha(num, digit): +    return Decimal(str(num)).quantize(Decimal(digit), rounding=ROUND_HALF_UP) + + +#'0.01'や'1E1'などで指定、整数に戻すならintをかます -H, W = LI() -c = [list(S()) for i in range(H)] -dp = FILL(0, H + 1, W + 1) -dp[0][0] = 1 -for i in range(H): -    for j in range(W): -        if i + 1 < H: -            if c[i + 1][j] == ".": -                dp[i + 1][j] += dp[i][j] -        if j + 1 < W: -            if c[i][j + 1] == ".": -                dp[i][j + 1] += dp[i][j] -        dp[i][j] %= MOD -print((dp[H - 1][W - 1])) +sys.setrecursionlimit(10**6 + 10) +H, W = MI() +V = [list(ST()) for _ in range(H)] +dp = FILL2(0, H + 1, W + 1) +dp[1][1] = 1 +for i in range(1, H + 1): +    for j in range(1, W + 1): +        if V[i - 1][j - 1] == "." and (i != 1 or j != 1): +            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD +print((dp[H][W]))