from collections import deque h,w=map(int,input().split()) a=[list(input()) for _ in range(h)] roots=deque([[(0,0,1)]]) count=0 while roots: t=roots.popleft() x,y,c=t[-1] if x==h-1 and y==w-1: count+=1 continue if x+10 ) ): d= c-1 if a[x+1][y]=="x" else c+1 g=t.copy() g.append((x+1,y,d)) roots.append(g) if y+10 ) ): d= c-1 if a[x][y+1]=="x" else c+1 g=t.copy() g.append((x,y+1,d)) roots.append(g) print(count)