#include using namespace std; #define all(v) (v).begin(),(v).end() #define pb(a) push_back(a) #define rep(i, n) for(int i=0;i> h >> w; vector s(h); rep(i, h) cin >> s[i]; vector dp(h, vector(w, vector(22, 0LL))); for(int i = 0; i < h; i ++) { for(int j = 0; j < w; j ++) { vector tmp(22, 0LL); if(i == 0 and j == 0) tmp[0] ++; for(int k = 0; k < 22; k ++) { if(i) tmp[k] += dp[i - 1][j][k]; if(j) tmp[k] += dp[i][j - 1][k]; } if(s[i][j] == '#') continue; if(s[i][j] == 'o') { for(int k = 0; k < 21; k ++) { dp[i][j][k + 1] += tmp[k]; } } else { for(int k = 1; k < 22; k ++) { dp[i][j][k - 1] += tmp[k]; } } } } ll ans = 0; for(int i = 0; i < 22; i ++) ans += dp[h - 1][w - 1][i]; cout << ans << endl; return 0; }