#include "bits/stdc++.h" /* #include "boost/multiprecision/cpp_int.hpp" namespace mp = boost::multiprecision; using i128=mp::cpp_int; */ using namespace std; typedef long long ll; typedef int64_t i64; typedef vector vi; typedef vector vvi; typedef vector vvvi; typedef vector vll; typedef vector vvll; typedef vector vvvll; typedef vector vs; typedef vector vc; typedef vector vvc; typedef vector vd; typedef vector vvd; #define rep(i,a,n) for(int i=a;in;i--) #define yes(ans) if(ans)cout<<"yes"<>h>>w; vs d(h); rep(i,0,h) cin>>d[i]; vi now(h+w-2,1); rep(i,0,h-1) now[i]=0; int ans=0; do{ int x=0,y=0; int cnt=1; bool wh=1; rep(i,0,h+w-2){ if(now[i]==0) x++; else y++; if(d[x][y]=='#') wh=0; else if(d[x][y]=='o'){ cnt++; } else{ cnt--; if(cnt<0) wh=0; } } if(wh) ans++; }while(next_permutation(all(now))); cout<