#include using namespace std; typedef long long ll; typedef pair P; typedef vector

VP; typedef vector VI; typedef vector VVI; #define REP(i, n) for (ll i = 0; i < (n); i++) #define ALL(v) v.begin(), v.end() #define OUT(n) cout << n << "\n" // constexpr ll MOD=998244353; // constexpr ll MOD=1000000007; // constexpr ll INF=2e18; ll ans = 0; void generatePaths(int right, int down, ll cnt, VVI &A, ll x, ll y) { if (A[x][y] == 'o') { cnt += 1; } else if (A[x][y] == 'x') { cnt -= 1; } else { return; } if (cnt < 0) { return; } // 右に移動できるなら if (right > 0 ) { generatePaths(right - 1, down, cnt, A, x + 1, y); } // 下に移動できるなら if (down > 0) { generatePaths(right, down - 1, cnt, A, x, y + 1); } if (right == 0 && down == 0) { ans += 1; return; } return; } int main() { ios::sync_with_stdio(false); cin.tie(0); ll H, W; cin >> H >> W; VVI A(H, VI(W)); REP(i, H) { REP(j, W) { char c; cin >> c; A[i][j] = c; } } generatePaths(W - 1, H - 1, 0, A, 0, 0); OUT(ans); }