#include using namespace std; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int h, w; cin >> h >> w; vector A(h); cin >> A; long long dp[h][w][30] = {}; dp[0][0][1] = 1; for(int y = 0; y < h; y++){ for(int x = 0; x < w; x++){ for(int s = 0; s < 22; s++){ if(dp[y][x][s] == 0) continue; if(y + 1 < h && A[y + 1][x] != '#'){ int ns = s + (A[y + 1][x] == 'x' ? -1 : 1); if(ns >= 0) dp[y + 1][x][ns] += dp[y][x][s]; } if(x + 1 < w && A[y][x + 1] != '#'){ int ns = s + (A[y][x + 1] == 'x' ? -1 : 1); if(ns >= 0) dp[y][x + 1][ns] += dp[y][x][s]; } } } } long long ans = 0; for(int i = 0; i < 22; i++) ans += dp[h - 1][w - 1][i]; cout << ans << '\n'; }