#include using namespace std; int main() { int H, W; cin >> H >> W; vector A(H); for(int i = 0; i < H; i++) { cin >> A[i]; } vector dp(H, vector(W, vector(H+W))); dp[0][0][1] = 1; for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { for(int k = 0; k < H+W; k++) { if(i < H-1 && A[i+1][j] == 'o' && k+1 < H+W) dp[i+1][j][k+1] += dp[i][j][k]; if(i < H-1 && A[i+1][j] == 'x' && k-1 >= 0) dp[i+1][j][k-1] += dp[i][j][k]; if(j < W-1 && A[i][j+1] == 'o' && k+1 < H+W) dp[i][j+1][k+1] += dp[i][j][k]; if(j < W-1 && A[i][j+1] == 'x' && k-1 >= 0) dp[i][j+1][k-1] += dp[i][j][k]; } } } cout << accumulate(dp[H-1][W-1].begin(), dp[H-1][W-1].end(), 0LL) << endl; }