Problem:
 Score : 100 points    Problem Statement There is a grid with H horizontal rows and W vertical columns.
Let (i, j) denote the square at the i -th row from the top and the j -th column from the left.  For each i and j ( 1 \leq i \leq H , 1 \leq j \leq W ), Square (i, j) is described by a character a_{i, j} .
If a_{i, j} is . , Square (i, j) is an empty square; if a_{i, j} is # , Square (i, j) is a wall square.
It is guaranteed that Squares (1, 1) and (H, W) are empty squares.  Taro will start from Square (1, 1) and reach (H, W) by repeatedly moving right or down to an adjacent empty square.  Find the number of Taro's paths from Square (1, 1) to (H, W) .
As the answer can be extremely large, find the count modulo 10^9 + 7 .      Constraints  H and W are integers.  2 \leq H, W \leq 1000  a_{i, j} is . or # .  Squares (1, 1) and (H, W) are empty squares.         Input Input is given from Standard Input in the following format:  H  W  a_{1, 1} \ldots a_{1, W}  :  a_{H, 1} \ldots a_{H, W}       Output Print the number of Taro's paths from Square (1, 1) to (H, W) , modulo 10^9 + 7 .        Sample Input 1 3 4
...#
.#..
....      Sample Output 1 3  There are three paths as follows:        Sample Input 2 5 2
..
#.
..
.#
..      Sample Output 2 0  There may be no paths.       Sample Input 3 5 5
..#..
.....
#...#
.....
..#..      Sample Output 3 24       Sample Input 4 20 20
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................      Sample Output 4 345263555  Be sure to print the count modulo 10^9 + 7 .

Solution (Python):
n,m=map(int,input().split())
grid=[list(input()) for i in range(n)]
ans=[[0]*m for i in range(n)]
mod=10**9 +7
ans[0][0]=1
for i in range(1,n):
    if grid[i][0]=='.':
        ans[i][0]=ans[i-1][0]
for i in range(1,m):
    if grid[0][i]=='.':
        ans[0][i]=ans[0][i-1]


for i in range(1,n):
    for j in range(1,m):
        if grid[i][j]=='.':
            ans[i][j]=(ans[i-1][j]+ans[i][j-1])%mod


print(ans[n-1][m-1]%mod)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    h,w=map(int,input().split())
    A=[input() for _ in range(h)]
    dp=[[0]*w for _ in range(h)] 
    dp[0][0]=1
    mod=10**9+7
    for i in range(h):
        for j in range(w):
            if A[i][j]=="
            if i>=1 and j>=1:    
                dp[i][j]+=(dp[i-1][j]+dp[i][j-1])%mod
            elif j==0:
                dp[i][j]+=dp[i-1][j]%mod
            else:
                dp[i][j]+=dp[i][j-1]%mod
    print(dp[-1][-1]%mod)

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    h,w=map(int,input().split())
    A=[input() for _ in range(h)]
    dp=[[0]*w for _ in range(h)] 
    dp[0][0]=1
    mod=10**9+7
    for i in range(h):
        for j in range(w):
            if A[i][j]=="
            if i>=1 and j>=1:    
                dp[i][j]+=(dp[i-1][j]+dp[i][j-1])%mod
            elif j==0:
                dp[i][j]+=dp[i-1][j]%mod
            else:
                dp[i][j]+=dp[i][j-1]%mod
    print(dp[-1][-1]%mod)

if __name__=='__main__':
    main()

Solution (Python):
mod=1000000007
n,m=map(int,input().split())
ll=[]
dp=[]
for i in range(n):
  s=input()
  ll.append(s)
  l=[0]*m
  dp.append(l)
for i in range(n):
  if(ll[i][0]=='
    break
  dp[i][0]=1
for j in range(m):
  if(ll[0][j]=='
    break
  dp[0][j]=1
for i in range(1,n):
  for j in range(1,m):
    if(ll[i][j]!='
    	dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod
print(dp[n-1][m-1])

Solution (Python):
import sys
sys.setrecursionlimit(1000000) 
mod = 1000000007

def main():
    input = sys.stdin.readline  
    H, W = map(int, input().rstrip().split())
    maps = []
    for _ in range(H):
        line = input().rstrip()
        maps.append(line)

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

    for i in range(H):
        for j in range(W):
            if (i == 0 and j == 0) or maps[i][j] == "
                continue
            tmp = 0
            if i - 1 >= 0 and maps[i-1][j] == ".":
                tmp += dp[i-1][j]
                tmp %= mod
            if j - 1 >= 0 and maps[i][j-1] == ".":
                tmp += dp[i][j-1]
                tmp %= mod
            dp[i][j] = tmp
    print(dp[H-1][W-1])

if __name__ == '__main__':
    main()

Solution (Python):
h,w=map(int,input().split())
l=[]
for i in range(h):
    l.append(list(input()))
dp=[]
for i in range(h):
    dp.append([0]*w)
c=1
for i in range(w):
    if l[0][i]=='
        c=0
    dp[0][i]=c
c=1
for i in range(h):
    if l[i][0]=='
        c=0
    dp[i][0]=c
for i in range(1,h):
    for j in  range(1,w):
        if l[i][j]=='.':
            dp[i][j]=dp[i-1][j]+dp[i][j-1]
        else:
            dp[i][j]=0
print(dp[h-1][w-1]%1000000007)

Solution (Python):
h, w = map(int, input().split())
maze = [list(input()) for i in range(h)]
mod = 10 ** 9 + 7

dp = [[0] * (w + 1) for i in range(h + 1)]

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if i == j == 1:
            dp[i][j] = 1
        elif maze[i - 1][j - 1] == ".":
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod

print(dp[h][w])

Solution (Python):
n, m = map(int, input().strip().split())
grid = []
for i in range(n):
    grid.append(input())
dp = [[None]*m for _ in range(n)]
dp[n-1][m-1] = 1
for i in range(n-2, -1, -1):
    if grid[i][m-1] == '.':
        dp[i][m-1] = dp[i+1][m-1]
    else:
        dp[i][m-1] = 0
for j in range(m-2, -1, -1):
    if grid[n-1][j] == '.':
        dp[n-1][j] = dp[n-1][j+1]
    else:
        dp[n-1][j] = 0
for i in range(n-2, -1, -1):
    for j in range(m-2, -1, -1):
        if grid[i][j] == '.':
            dp[i][j] = (dp[i+1][j] + dp[i][j+1])%(10**9 + 7)
        else:
            dp[i][j] = 0
print(dp[0][0])

Solution (Python):
n, m = map(int, input().strip().split())
grid = []
for i in range(n):
    grid.append(input())
dp = [[None]*m for _ in range(n)]
dp[n-1][m-1] = 1
for i in range(n-2, -1, -1):
    if grid[i][m-1] == '.':
        dp[i][m-1] = dp[i+1][m-1]
    else:
        dp[i][m-1] = 0
for j in range(m-2, -1, -1):
    if grid[n-1][j] == '.':
        dp[n-1][j] = dp[n-1][j+1]
    else:
        dp[n-1][j] = 0
for i in range(n-2, -1, -1):
    for j in range(m-2, -1, -1):
        if grid[i][j] == '.':
            dp[i][j] = (dp[i+1][j] + dp[i][j+1])%(10**9 + 7)
        else:
            dp[i][j] = 0
print(dp[0][0])

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    mod = 10**9 + 7
    H, W = geta(int)
    g = []
    for _ in range(H):
        g.append(gete())

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

    for i in range(W):
        if g[0][i] == "
        dp[0][i] = 1

    for i in range(H):
        if g[i][0] == "
        dp[i][0] = 1

    for i, gi in enumerate(g[1:], 1):
        for j, gij in enumerate(gi[1:], 1):
            if gij == "
                dp[i][j] = 0
            else:
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod

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


if __name__ == "__main__":
    main()

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    mod = 10**9 + 7
    H, W = geta(int)
    g = []
    for _ in range(H):
        g.append(gete())

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

    for i, gi in enumerate(g):
        if i == 0:
            w = gi.index("
            dp[0] = [1 if j < w else 0 for j in range(W)]
        else:
            for j, gij in enumerate(gi):
                if gij == "
                    dp[i][j] = 0
                else:
                    dp[i][j] = (dp[i - 1][j] +
                                (dp[i][j - 1] if j > 0 else 0)) % mod

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


if __name__ == "__main__":
    main()

Solution (Python):
h,w = map(int,input().split())
grid = ["
for _ in range(h):
    x = input()
    x = "
    grid.append(x)
p = 10**9 + 7
dp = [[0]*(w+1) for _ in range(h+1)]
dp[1][1] =1
for i in range(h):
    for j in range(w):
        if grid[i][j+1] == ".":
            dp[i+1][j+1] += dp[i][j+1]
            dp[i+1][j+1] %= p
        if grid[i+1][j] == ".":
            dp[i+1][j+1] += dp[i+1][j]
            dp[i+1][j+1] %= p
print(dp[h][w])

Solution (Python):
large_p = 10**9 + 7
def main():
    h, w = map(int, input().split())
    grid = [tuple(map(str, input())) for _ in range(h)]
    grid_root = [[0] * w for _ in range(h)]

    
    flag = 1
    for i1 in range(w):
        if grid[0][i1] == '
            flag = 0
        grid_root[0][i1] += flag

    flag = 1
    for i2 in range(h):
        if grid[i2][0] == '
            flag = 0
        grid_root[i2][0] += flag
    for j1 in range(1, h):
        for j2 in range(1, w):
            if grid[j1][j2] == '.':
                grid_root[j1][j2] = grid_root[j1-1][j2] + grid_root[j1][j2-1]
    print(grid_root[h-1][w-1] % large_p)

if __name__ == '__main__':
    main()

Solution (Python):

import sys

MOD = 1000000007  


def solve(H: int, W: int, a: "List[List[str]]"):
    dp = [[0] * W for _ in range(H)]
    dp[0][0] = 1
    for h in range(H):
        for w in range(W):
            if h == 0 and w == 0:
                dp[h][w] = 1
            elif h == 0:
                if a[h][0][w-1] == ".":
                    dp[h][w] = dp[h][w-1]
            elif w == 0:
                if a[h-1][0][w] == ".":
                    dp[h][w] = dp[h-1][w]
            else:
                if a[h-1][0][w] == "." and a[h][0][w-1] == ".":
                    dp[h][w] = (dp[h-1][w] + dp[h][w-1]) % MOD
                elif a[h-1][0][w] == ".":
                    dp[h][w] = dp[h-1][w]
                elif a[h][0][w-1] == ".":
                    dp[h][w] = dp[h][w-1]
    print(dp[-1][-1])
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  
    W = int(next(tokens))  
    a = [[next(tokens) for _ in range(1)]
         for _ in range(H)]  
    solve(H, W, a)


if __name__ == '__main__':
    main()

Solution (Python):
r,c=map(int,input().split())
m=[]
for i in range(r):
    m.append(list(input()))
dp=[[0 for j in range(c)] for i in range(r)]

dp[0][0]=1
for i in range(0,r):
    for j in range(0,c):
        if m[i][j]=='.':
            dp[i][j]+=(dp[i-1][j]+dp[i][j-1])
        

print((dp[r-1][c-1])%(1000000007))

Solution (Python):
n,m=map(int,input().split())
a=[0]*n
dp=[[0 for i in range (m)]for j in range (n)]
dp[0][0]=1
MOD=int(1e9+7)

for i in range (n):
    a[i]=input()

for i in range (n):
    for j in range (m):
        if a[i][j]=='.':
            if i>0:
                dp[i][j]+=dp[i-1][j]
            if j>0:
                dp[i][j]+=dp[i][j-1]
            dp[i][j]%=MOD

print(dp[n-1][m-1])

Solution (Python):
from sys import stdin


def solve():
    r,c = [int(i) for i in stdin.readline().split()]
    A = []
    for _ in range(r):
        k = str(input())
        l = [1 if i == '.' else '
        A.append(l)
    pre = False
    for i in range(c):
        if pre: A[0][i] = '
        elif A[0][i] == '
    for i in range(1, r):
        for j in range(c):
            if A[i][j] == '
            elif j == 0: A[i][j] = A[i-1][j]
            elif A[i-1][j] == '
            elif A[i-1][j] == '
            elif A[i][j-1] == '
            else: A[i][j] = A[i][j-1] + A[i-1][j]
    if A[-1][-1] == '
    else: return A[-1][-1] % ((10**9) + 7)

print(solve())

Solution (Python):

MOD = int(1e9)+7
def main():
    H, W = map(int, input().split())
    mat = []
    for i in range(H):
        mat.append(input())

    ways = [[0]*(W+1) for i in range(H+1)]
    ways[0][1] = 1
    for i in range(1, H+1):
        for j in range(1, W+1):
            if mat[i-1][j-1] != '
                ways[i][j] = (ways[i-1][j]+ways[i][j-1])%MOD
    print(ways[H][W])


if __name__ == "__main__":
    main()

Solution (Python):
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
LIN=lambda : list(IN())
mod=1000000007



def main():
	
	h, w = IN()
	
	map_l = [input() for _ in range(h)]
	l_l = [[0] * w for _ in range(h)]
	l_l[0][0]=1
	for hi in range(h):
		for wi in range(w):
			if map_l[hi][wi] == '
				continue
			if wi > 0:
				l_l[hi][wi] += l_l[hi][wi-1]
				l_l[hi][wi] %= mod
			if hi > 0:
				l_l[hi][wi] += l_l[hi-1][wi]
				l_l[hi][wi] %= mod
				
	print(l_l[h-1][w-1])
		
	
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Solution (Python):
H, W = map(int, input().split(' '))
a = [['0' for _ in range(W + 1)] for _ in range(H + 1)]
dp = [[0 for _ in range(W + 1)] for _ in range(H + 1)]
for i in range(H):
  str_a = input()
  for j in range(W):
     a[i+1][j+1] = str_a[j]
i, j = 1, 1
while i <= H and a[i][1] == '.':
  dp[i][1] = 1
  i += 1
while j <= W and a[1][j] == '.':
  dp[1][j] = 1
  j += 1
for i in range(2, H + 1):
  for j in range(2, W + 1):
    if a[i][j] == '.':
      dp[i][j] = dp[i-1][j] + dp[i][j-1]
print(dp[H][W] % 1000000007)

Solution (Python):
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

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

for i in range(h):
    for j in range(w):
        if (j != w - 1) and (a[i][j + 1] == '.'):
                dp[i][j + 1] += dp[i][j]
        if (i != h - 1) and (a[i + 1][j] == '.'):
                dp[i + 1][j] += dp[i][j]
print(dp[-1][-1]%(10**9+7))

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    m, n = map(int, input().split())
    grid = [input() for _ in range(m)]
    dp = [[0] * n for _ in range(m)]
    dp[0][0] = 1

    D = [(1, 0), (0, 1)]
    for i in range(m):
        for j in range(n):
            for di, dj in D:
                ni, nj = i + di, j + dj
                if not (0 <= ni < m and 0 <= nj < n):
                    continue
                if grid[ni][nj] == '
                    continue
                dp[ni][nj] += dp[i][j]
                if dp[ni][nj] >= MOD:
                    dp[ni][nj] -= MOD

    print(dp[m - 1][n - 1])
resolve()

Solution (Python):
h, w = map(int, input().split())
field = [input() for _ in range(h)]
MOD = 10 ** 9 + 7

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

for i in range(1, w):
    if field[0][i] == ".":
        dp[0][i] = dp[0][i-1] 

for i in range(1, h):
    if field[i][0] == ".":
        dp[i][0] = dp[i-1][0]

for row in range(1, h):
    for col in range(1, w):
        if field[row][col] == ".":
            dp[row][col] = (dp[row-1][col] + dp[row][col-1]) % MOD
print(dp[-1][-1])

Solution (Python):
h,w = map(int, input().split())
a = ["
mod = 10 ** 9 + 7
dp = [[0]*(w+1) for i in range(h+1)]
dp[1][1] = 1
for i in range(1,h+1):
  for j in range(1,w+1):
    if a[i][j] == ".":
      dp[i][j] += (dp[i-1][j] + dp[i][j-1])
      dp[i][j] %= mod
print(dp[h][w])

Solution (Python):
a=input().split()
H=int(a[0])
W=int(a[1])
n_list=[[0 for i in range(W)] for i in range(H)]
m_list=[]
for i in range(H) :
  m_list.append(input())

for i in range(H) :
  if m_list[i][0]=='.' :
    n_list[i][0]=1
  else :
    break

for i in range(W) :
  if m_list[0][i]=='.' :
    n_list[0][i]=1
  else :
    break

for i in range(1,H) :
  for j in range(1,W) :
    if m_list[i][j]=='
      n_list[i][j]=0
    else :
      n_list[i][j]=n_list[i-1][j]+n_list[i][j-1]
print(n_list[-1][-1]%(10**9+7))

Solution (Python):
h,w = map(int,input().split())
stage = [["
for i in range(1,h+1):
    stage[i][1:w+1] = list(input())
dp = [[0 for x in range(w+2)] for x in range(h+2)]
dp[1][1] = 1
for j in range(1,h+1):
    for i in range(1,w+1):
        dp[j][i] = dp[j][i]%(10**9+7)
        if(stage[j+1][i] == "."):
            dp[j+1][i] += dp[j][i]
        if(stage[j][i+1] == "."):
            dp[j][i+1] += dp[j][i]
print(dp[h][w])

Solution (Python):
mod = 10**9 + 7
H, W = map(int, input().split())
Maze = [[0]*(W+1) for _ in range(H+1)]
Memo = [[0]*(W+1) for _ in range(H+1)]
Memo[H-1][W-1] = 1
for i in range(H):
    S = input()
    for j in range(W):
        Maze[i][j] = S[j]

for a in range(H-1, -1, -1):
    for b in range(W-1, -1, -1):
        if Maze[a][b] == '
            Memo[a][b] = 0
        elif (a == H-1) and (b == W-1):
            continue
        else:
            Memo[a][b] = Memo[a+1][b] + Memo[a][b+1]
            Memo[a][b] %= mod
print(Memo[0][0])

Solution (Python):
H,W=map(int,input().split())
A=[input() for i in range(H)]
d=[[0]*(W+1) for i in range(H+1)]
d[0][1]=1
m=10**9+7
for i in range(H):
    for j in range(W):
        if A[i][j]=='.':
            d[i+1][j+1]=(d[i][j+1]+d[i+1][j])%m
print(d[-1][-1])

Solution (Python):
import sys,queue,math,copy,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
D = ((1,0),(0,1))

H,W  = LI()
dp = [[0 for _ in range(W+1)] for _ in range(H+1)]
mp = [sys.stdin.readline().rstrip() for _ in range(H)]

dp[0][1] = 1
for i in range(1,H+1):
    for j in range(1,W+1):
        if mp[i-1][j-1] == '
        dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD

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

Solution (Python):
def cornerval(i, j, a, dp, h, w):

	if a[i][j] == '
		return 0
	elif(j== w-1):
		if(dp[i+1][j] == 0):
			return 0
		else:
			return 1
	elif(i==h-1):
		if(dp[i][j+1] == 0):
			return 0
		else:
			return 1

l = 10**9 + 7
h, w = map(int, raw_input().split())
a = []
for i in range(h):
	t= raw_input()
	t = list(t)
	a.append(t)

dp=[[0 for x in range(w)] for x in range(h)]
dp[h-1][w-1] = 1
i=h-1
for j in range(w-2, -1, -1):
	dp[i][j] = cornerval(i, j, a, dp, h, w)
j = w-1
for i in range(h-2, -1, -1):
	dp[i][j] = cornerval(i, j, a, dp, h, w)
dp[h-1][w-1] = 0


for i in range(h-2, -1, -1):
	for j in range(w-2, -1, -1):
		if(a[i][j] == '
			dp[i][j] = 0
		else:
			dp[i][j] = ((dp[i+1][j] % l) + (dp[i][j+1] % l)) % l


print(dp[0][0])

Solution (Python):

"""
Created on Mon May  4 15:14:09 2020

@author: Kanaru Sato
"""
import itertools

h,w = list(map(int, input().split()))
mod = 10**9+7
Map = []
for i in range(h):
    Map.append(list(input()))

dp = [[0 for i in range(w)] for j in range(h)]

for i in range(h):
    for j in range(w):
        if i == 0 and j == 0:
            dp[i][j] = 1
        else:
            if Map[i][j] == "
                dp[i][j] = -1
            else:
                if i-1 >= 0 and dp[i-1][j] != -1:
                    dp[i][j] += dp[i-1][j]
                if j-1 >= 0 and dp[i][j-1] != -1:
                    dp[i][j] += dp[i][j-1]
                dp[i][j] %= mod

print(dp[h-1][w-1])

Solution (Python):
from collections import defaultdict,deque
import sys, bisect, math, itertools
from functools import lru_cache

sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

h, w = inpl()
maze = [list(input())[:-1] for _ in range(h)]
dp = [[0] * w for _ in range(h)]
dp[0][0] = 1
for i in range(h):
    for j in range(w):
        if i == 0 and j == 0:
            continue
        left = dp[i][j-1] if j-1>=0 and maze[i][j-1] == "." else 0
        up = dp[i-1][j] if i-1>=0 and maze[i-1][j] == "." else 0
        dp[i][j] = left + up
print(dp[h-1][w-1] % mod)

Solution (Python):
h, w = map(int, input().split())
grid = [list(input()) for _ in range(h)]

MOD = 10 ** 9 + 7
dp = [[0] * w for _ in range(h)]

i = 0
while i < w and grid[0][i] != '
	dp[0][i] = 1
	i += 1

j = 0
while j < h and grid[j][0] != '
	dp[j][0] = 1
	j += 1

for i in range(1, h):
	for j in range(1, w):
		if grid[i][j] == '
			dp[i][j] == 0
		else:
			dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
			dp[i][j] %= MOD

print(dp[h-1][w-1])

Solution (Python):
h,w=map(int,input().split())
maze=[tuple(input()) for _ in range(h)]
dp=[[0]*w for _ in range(h)]
mod=10**9+7
dp[0][0]=1
for y in range(h):
  for x in range(w):
    if maze[y][x]=='
      dp[y][x]=0
    else:
      if y>0:
        dp[y][x]+=dp[y-1][x]
      if x>0:
        dp[y][x]+=dp[y][x-1]
      dp[y][x]%=mod
print(dp[-1][-1])

Solution (Python):
h, w = map(int, input().split())
mod = 10**9 + 7
g = [input() for _ in range(h)]
dp = [[0 for _ in range(w)] for _ in range(h)]
dp[0][0] = 1
for i in range(h):
    for j in range(w):
        if i > 0 and g[i - 1][j] == '.':
            dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod
        if j > 0 and g[i][j - 1] == '.':
            dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod
print(dp[-1][-1])

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

h, w = na()
a = nsn(h)

dp = [[0] * (w + 1) for _ in range(h + 1)]
dp[1][1] = 1
for i in range(h):
    for j in range(w):
        if a[i][j] == '.':
            dp[i + 1][j + 1] += dp[i][j + 1] + dp[i + 1][j]

print(dp[h][w] % mod)

Solution (Python):

H,W=map(int,input().split())
A=[[x for x in input()] for i in range(H)]
mod=10**9+7

dp=[[0 for i in range(W+1)] for j in range(H+1)]
dp[H-1][W-1]=1

for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if i==H-1 and j==W-1:
            continue
        
        if A[i][j]=="
            continue
        elif A[i][j]==".":
            dp[i][j]=(dp[i+1][j]+dp[i][j+1])%mod

print(dp[0][0])

Solution (Python):
mod = 10**9+7
h,w = map(int,input().split())
grid = [[l == "
dp = [[0]*w for _ in range(h)]
dp[0][0] = 1
for s in range(1,h+w):
  for i in range(max(0,s-w+1),min(h,s+1)):
    j = s-i
    if grid[i][j]:
      continue
    if i == 0:
      dp[i][j] = dp[i][j-1]
    elif j == 0:
      dp[i][j] = dp[i-1][j]
    else:
      dp[i][j] = (dp[i][j-1]+dp[i-1][j])%mod
print(dp[-1][-1]%mod)

Solution (Python):
H,W=map(int,input().split())
p=10**9+7
ma=[]
dp=[[0]*(W+2) for j in range(H+2)]
an=[]
dp[1][1]=1
for i in range(H):
     ma.append(list(input()))
     for j in range(W):
         if i==j==0:
             continue
         if ma[i][j]=="
             dp[i + 1][j + 1]=0
         else:
             dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j])%p
print(dp[H][W])

Solution (Python):
h,w=map(int,input().split())
l=[[1 if i=='.' else 0 for i in input()] for _ in range(h)]
for i in range(w):
    if l[0][i]==0:
        for j in range(i+1,w):
            l[0][j]=0
        break
for i in range(h):
    if l[i][0]==0:
        for j in range(i+1,h):
            l[j][0]=0
        break
for i in range(1,h):
    for j in range(1,w):
        if l[i][j]!=0:
            l[i][j]=l[i-1][j]+l[i][j-1]
print(l[h-1][w-1]%(10**9+7))

Solution (Python):
h,w=map(int,input().split())
l=[[1 if i=='.' else 0 for i in input()] for _ in range(h)]
for i in range(w):
    if l[0][i]==0:
        for j in range(i+1,w):
            l[0][j]=0
        break
for i in range(h):
    if l[i][0]==0:
        for j in range(i+1,h):
            l[j][0]=0
        break
for i in range(1,h):
    for j in range(1,w):
        if l[i][j]!=0:
            l[i][j]=l[i-1][j]+l[i][j-1]
print(l[h-1][w-1]%(10**9+7))

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

M = 10 ** 9 + 7
H, W = map(int, readline().split())
grid = []
for i in range(H):
    grid.append(readline().decode("utf-8").rstrip())
    assert len(grid[-1]) == W


def solve():
    t = [0] * W
    t[0] = 1
    for c in range(1, W):
        if grid[0][c] == ".":
            t[c] = t[c - 1]
    for r in range(1, H):
        for c in range(W):
            if grid[r][c] == "
                t[c] = 0
            elif c > 0:
                t[c] += t[c - 1]
                t[c] %= M
        
    return t[-1]


if __name__ == "__main__":
    print(solve())

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

M = 10 ** 9 + 7
H, W = map(int, readline().split())
grid = []
for i in range(H):
    grid.append(readline().decode("utf-8").rstrip())
    assert len(grid[-1]) == W


def solve():
    t = [0] * W
    t[0] = 1
    for c in range(1, W):
        if grid[0][c] == ".":
            t[c] = t[c - 1]
    for r in range(1, H):
        for c in range(W):
            if grid[r][c] == "
                t[c] = 0
            elif c > 0:
                t[c] += t[c - 1]
                t[c] %= M
        
    return t[-1]


if __name__ == "__main__":
    print(solve())

Solution (Python):
H,W=map(int,input().split())

grid=[]

m=10**9+7

for i in range(H):
    a= list(input())
    grid.append(a)

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

for i in reversed(range(H)):
    for j in reversed(range(W)):
        dp[i][j] = dp[i+1][j] + dp[i][j+1]
        dp[H-1][W-1]=1
        if grid[i][j]=="
            dp[i][j]=0
print(dp[0][0]%m)

Solution (Python):
MOD = 10 ** 9 + 7
h, w = map(int, input().split())
grid = '
for _ in range(h):
    grid += '
grid += '
D = [0] * len(grid)
start = w + 3
goal = -(w + 4)
D[start] = 1
for i in range(start + 1, len(grid)):
    if grid[i] == '
        continue
    D[i] = (D[i - 1] + D[i - (w + 2)]) % MOD
print(D[goal])

Solution (Python):
from collections import deque

MOD = 10 ** 9 + 7
h, w = map(int, input().split())
grid = '
for _ in range(h):
    grid += '
grid += '
D = [0] * len(grid)
start = w + 3
goal = -(w + 4)
D[start] = 1
for i in range(start + 1, len(grid)):
    if grid[i] == '
        continue
    D[i] = (D[i - 1] + D[i - (w + 2)]) % MOD
print(D[goal])

Solution (Python):
n,m=map(int,raw_input().split())
a=[list(raw_input().strip()) for _ in xrange(n)]
z=[[0]*(m+1) for _ in xrange(n+1)]
z[0][1]=1
for i in xrange(n):
    for j in xrange(m):
        if a[i][j]=='.':
            z[i+1][j+1]+=z[i+1][j]+z[i][j+1]
print z[-1][-1]%(pow(10,9)+7)

Solution (Python):
h, w = map(int, input().split())
grid = []
for _ in range(h):
    grid.append(input())

dp = [0]*(w+1)
dp[1] = 1
for i in grid:
    newdp = dp[:]
    for j, k in enumerate(i):
        newdp[j+1] = dp[j+1] + newdp[j] if k=='.' else 0
    dp = newdp
print(dp[-1]%(10**9+7))

Solution (Python):
H, W = map(int, input().split())
a = [list(input()) for i in range(H)]

dp = [[0]*W for i in range(H)]
mod = 10**9 + 7
dp[0][0] = 1

for i in range(H):
    for j in range(W):
        if a[i][j] == '
            continue
        if j > 0:
            dp[i][j] += dp[i][j-1]
        if i > 0:
            dp[i][j] += dp[i-1][j]
        dp[i][j] %= mod
print(dp[-1][-1])

Solution (Python):
import numpy as np

H,W = map(int,input().split())
A = list()
for i in range(H):
    A.append(list(input()))
dp = [[0]*(W) for i in range(H)]
dp[0][0] = 1

for i in range(H):   
    for j in range(W):
        if A[i][j] == '.':
            
            try:
                if A[i][j+1] == '.':
                    dp[i][j+1] += dp[i][j]
            except IndexError as e:
                
                pass
            
            try:
                if A[i+1][j] == '.':
                    dp[i+1][j] += dp[i][j]
        
            except IndexError as e:
                
                pass

print(dp[-1][-1] % (10**9 +7))

Solution (Python):
import itertools

MOD = 10 ** 9 + 7

H, W = map(int, input().split())
A = [input() for _ in range(H)]

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

it = itertools.product(range(H), range(W))
next(it)
for h, w in it:
    if A[h][w] == '.':
        dp[h + 1][w + 1] = (dp[h][w + 1] + dp[h + 1][w]) % MOD
print(dp[H][W])

Solution (Python):
MOD = pow(10,9) + 7
H, W = map(int,raw_input().split())

grid = [[0]*W for h in range(H)]
grid[0][0] = 1

for h in range(H) :  
  row = raw_input()

  for w in range(W) :
    if row[w] == '
    if h > 0 : grid[h][w] += grid[h-1][w]
    if w > 0 : grid[h][w] += grid[h][w-1]
    grid[h][w] %= MOD
  
print grid[-1][-1] % MOD

Solution (Python):
h, w = map(int, input().split())
p = 10**9+7
S = [input() for i in range(h)]
DP = [[0 for j in range(w)] for i in range(h)]
DP[0][0] = 1
for i in range(h):
    for j in range(w):
        if i > 0 and S[i-1][j] == '.':
            DP[i][j] += DP[i-1][j]
        if j > 0 and S[i][j-1] == '.':
            DP[i][j] += DP[i][j-1]
        DP[i][j] %= p
print(DP[h-1][w-1])