#include using namespace std; typedef long long ll; vector dx = {0,1}; vector dy = {1,0}; ll ans = 0; void dfs(vector> &S, ll x, ll y, ll houseki,ll h,ll w) { if (S[x][y]=='o') houseki++; if (S[x][y]=='x') houseki--; if (houseki==-1) return; if (x==h-1&&y==w-1) { ++ans; return; } for (ll i = 0; i < 2; ++i) { ll nx = dx[i]+x; ll ny = dy[i]+y; if (nx >= 0 && nx < h && ny >= 0 && ny < w && S[nx][ny]!='#') { dfs(S,nx,ny,houseki,h,w); } } } void solve() { int h, w; cin >> h >> w; vector> s(h, vector(w)); vector> seen(h, vector(w)); for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) cin >> s[i][j]; ll hou = 0; dfs(s,0,0,hou,h,w); cout << ans << endl; } int main() { solve(); return 0; }