import sys import copy sys.setrecursionlimit(10**4) ans=0 def f(y,x,l,c,k): global ans if fi[y][x]=="o": c+=1 elif fi[y][x]=="x": c-=1 if c<0: return if y+1==H and x+1==W: ans+=1 return k.append([y,x]) l[y][x]=True for i,j in[[1,0],[0,1]]: if y+i