#include using ll=long long; #define rep(i,s,n) for (ll i = (s); i < (n); i++) using namespace std; using Graph = vector>; ll MOD=1e9+7; const ll INF=1e18; int main(){ ll h,w; cin>>h>>w; ll x0,y0,x1,y1; x0=0;y0=0;x1=h-1;y1=w-1; vector G(h*w); rep(i,0,h){ rep(j,0,w){ cin>>G[i*w+j]; } } vector J(h*w); vector C(h*w); vector seen(h*w); queue q; q.push(x0*w+y0); J[0]=0; C[0]=1; vector dx={1,0}; vector dy={0,1}; while(!q.empty()){ ll v=q.front(); q.pop(); if(seen[v]) continue; seen[v]=true; ll vx=v/w; ll vy=v%w; if(G[v]=='o'){ J[v]++; } else if(G[v]=='x'){ J[v]--; } else{ J[v]=0; C[v]=0; } rep(i,0,2){ ll nx=vx+dx[i]; ll ny=vy+dy[i]; if(nx==x1 && ny==y1){ } ll nv=nx*w+ny; if(nx>=0 && nx=0 && ny