import sys sys.setrecursionlimit(1 << 20) H,W = map(int, input().split()) A = [ list(input()) for _ in range(H) ] dx = [0,1] dy = [1,0] global ans ans = 0 def dfs(sx,sy,cnt): global ans if sx==H-1 and sy==W-1: #print(ans) ans += 1 return for x,y in zip(dx,dy): if not (0<=sx+x<=H-1): continue if not (0<=sy+y<=W-1): continue if A[sx+x][sy+y]=="#": continue if A[sx+x][sy+y]=="x" and cnt==0: continue if A[sx+x][sy+y]=="x": cnt -= 1 elif A[sx+x][sy+y]=="o": cnt += 1 dfs(sx+x,sy+y,cnt) dfs(0,0,1) print(ans)