from itertools import *

import sys

md=10**9+7

mis=list(map(int,sys.stdin.readline().split()))



h,w=mis

t=[[0]*(w+1) for _ in range(h+1)]

s=[]

for _ in range(h):

    s+=[eval(input())]



for i,j in product(list(range(h)),list(range(w))):

    if i==0 and j==0:

        t[i+1][j+1]=1

    elif s[i][j]==".":

        t[i+1][j+1]=(t[i][j+1]+t[i+1][j])%md

    else:

        t[i+1][j+1]=0

print((t[-1][-1]))

md = 10 ** 9 + 7

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

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

t = [[1] * w for _ in range(h)]

for i, ai in enumerate(a):

    ti = t[i]

    for j, aij in enumerate(ai):

        if aij == "#":

            ti[j] = 0

        else:

            if j == 0:

                if i > 0:

                    ti[j] = t[i - 1][j]

            elif i == 0:

                if j > 0:

                    ti[j] = ti[j - 1]

            else:

                ti[j] = (ti[j - 1] + t[i - 1][j]) % md

print((t[-1][-1]))

from itertools import *
import sys

md = 10**9 + 7
mis = list(map(int, sys.stdin.readline().split()))
h, w = mis
t = [[0] * (w + 1) for _ in range(h + 1)]
s = []
for _ in range(h):
    s += [eval(input())]
for i, j in product(list(range(h)), list(range(w))):
    if i == 0 and j == 0:
        t[i + 1][j + 1] = 1
    elif s[i][j] == ".":
        t[i + 1][j + 1] = (t[i][j + 1] + t[i + 1][j]) % md
    else:
        t[i + 1][j + 1] = 0
print((t[-1][-1]))

md = 10**9 + 7
h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
t = [[1] * w for _ in range(h)]
for i, ai in enumerate(a):
    ti = t[i]
    for j, aij in enumerate(ai):
        if aij == "#":
            ti[j] = 0
        else:
            if j == 0:
                if i > 0:
                    ti[j] = t[i - 1][j]
            elif i == 0:
                if j > 0:
                    ti[j] = ti[j - 1]
            else:
                ti[j] = (ti[j - 1] + t[i - 1][j]) % md
print((t[-1][-1]))

-from itertools import * -import sys - -mis = list(map(int, sys.stdin.readline().split())) -h, w = mis -t = [[0] * (w + 1) for _ in range(h + 1)] -s = [] -for _ in range(h): -    s += [eval(input())] -for i, j in product(list(range(h)), list(range(w))): -    if i == 0 and j == 0: -        t[i + 1][j + 1] = 1 -    elif s[i][j] == ".": -        t[i + 1][j + 1] = (t[i][j + 1] + t[i + 1][j]) % md -    else: -        t[i + 1][j + 1] = 0 +h, w = list(map(int, input().split())) +a = [eval(input()) for _ in range(h)] +t = [[1] * w for _ in range(h)] +for i, ai in enumerate(a): +    ti = t[i] +    for j, aij in enumerate(ai): +        if aij == "#": +            ti[j] = 0 +        else: +            if j == 0: +                if i > 0: +                    ti[j] = t[i - 1][j] +            elif i == 0: +                if j > 0: +                    ti[j] = ti[j - 1] +            else: +                ti[j] = (ti[j - 1] + t[i - 1][j]) % md