#include #include using namespace std; using mint = atcoder::modint998244353; int main(){ ios::sync_with_stdio(false); cin.tie(0); int h, w; cin >> h >> w; string str; array,400> dp; dp[0][1] = 1; for(int y = 0; y < h; y++){ cin >> str; for(int x2 = 0; x2 < w; x2++){ for(int x1 = 0; x1 < x2; x1++){ if(str[x1] == '#' || str[x2] == '#') dp[x1][x2] = 0; if(x1 + 1 < x2 && str[x1 + 1] == '.') dp[x1 + 1][x2] += dp[x1][x2]; } } for(int x1 = 0; x1 < w; x1++){ for(int x2 = x1 + 1; x2 < w; x2++){ if(x2 + 1 < w && str[x2 + 1] == '.') dp[x1][x2 + 1] += dp[x1][x2]; } } } cout << dp[w - 2][w - 1].val() << '\n'; }