import queue

INF=10**8

R=10**9+7

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

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

d=[[0 for i in range(h)] for _ in range(w)]

sx=0

sy=0

gx=w-1

gy=h-1

q=queue.Queue()

dx=[1,0]

dy=[0,1]

q.put((sx,sy))

d[sy][sx]=1

while not q.empty():

  x,y=q.get()

  if (x,y)==(gx,gy):break

  for i in range(2):

    nx=x+dx[i]

    ny=y+dy[i]

    if nx<w and ny<h:

      if maze[ny][nx]=='.':

        if d[nx][ny]==0:

          q.put((nx,ny))

          d[nx][ny]=d[x][y]

        else:d[nx][ny]+=d[x][y]

print((d[gx][gy]%R))
from collections import*

mod=10**9+7

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

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

dx=[0,1]

dy=[1,0]

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

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

d[0][0]=1

q=deque([(0,0)])

while q:

  x,y=q.popleft()

  if v[x][y]:continue

  v[x][y]=1

  for i,j in zip(dx,dy):

    nx=x+i

    ny=y+j

    if 0<=nx<h and 0<=ny<w and a[nx][ny]==".":

      d[nx][ny]+=d[x][y]

      d[nx][ny]%=mod

      q.append((nx,ny))

print((d[-1][-1]))
import queue

INF = 10**8
R = 10**9 + 7
h, w = list(map(int, input().split()))
maze = [eval(input()) for _ in range(h)]
d = [[0 for i in range(h)] for _ in range(w)]
sx = 0
sy = 0
gx = w - 1
gy = h - 1
q = queue.Queue()
dx = [1, 0]
dy = [0, 1]
q.put((sx, sy))
d[sy][sx] = 1
while not q.empty():
    x, y = q.get()
    if (x, y) == (gx, gy):
        break
    for i in range(2):
        nx = x + dx[i]
        ny = y + dy[i]
        if nx < w and ny < h:
            if maze[ny][nx] == ".":
                if d[nx][ny] == 0:
                    q.put((nx, ny))
                    d[nx][ny] = d[x][y]
                else:
                    d[nx][ny] += d[x][y]
print((d[gx][gy] % R))

from collections import *

mod = 10**9 + 7
h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
dx = [0, 1]
dy = [1, 0]
d = [[0] * w for _ in range(h)]
v = [[0] * w for _ in range(h)]
d[0][0] = 1
q = deque([(0, 0)])
while q:
    x, y = q.popleft()
    if v[x][y]:
        continue
    v[x][y] = 1
    for i, j in zip(dx, dy):
        nx = x + i
        ny = y + j
        if 0 <= nx < h and 0 <= ny < w and a[nx][ny] == ".":
            d[nx][ny] += d[x][y]
            d[nx][ny] %= mod
            q.append((nx, ny))
print((d[-1][-1]))

-import queue +from collections import * -INF = 10**8 -R = 10**9 + 7 +mod = 10**9 + 7 -maze = [eval(input()) for _ in range(h)] -d = [[0 for i in range(h)] for _ in range(w)] -sx = 0 -sy = 0 -gx = w - 1 -gy = h - 1 -q = queue.Queue() -dx = [1, 0] -dy = [0, 1] -q.put((sx, sy)) -d[sy][sx] = 1 -while not q.empty(): -    x, y = q.get() -    if (x, y) == (gx, gy): -        break -    for i in range(2): -        nx = x + dx[i] -        ny = y + dy[i] -        if nx < w and ny < h: -            if maze[ny][nx] == ".": -                if d[nx][ny] == 0: -                    q.put((nx, ny)) -                    d[nx][ny] = d[x][y] -                else: -                    d[nx][ny] += d[x][y] -print((d[gx][gy] % R)) +a = [eval(input()) for _ in range(h)] +dx = [0, 1] +dy = [1, 0] +d = [[0] * w for _ in range(h)] +v = [[0] * w for _ in range(h)] +d[0][0] = 1 +q = deque([(0, 0)]) +while q: +    x, y = q.popleft() +    if v[x][y]: +        continue +    v[x][y] = 1 +    for i, j in zip(dx, dy): +        nx = x + i +        ny = y + j +        if 0 <= nx < h and 0 <= ny < w and a[nx][ny] == ".": +            d[nx][ny] += d[x][y] +            d[nx][ny] %= mod +            q.append((nx, ny)) +print((d[-1][-1]))