#include #include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define all(x) begin(x), end(x) template bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; } struct IOST { IOST() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20); } } IOST; using mint = atcoder::modint998244353; int main(){ int h,w; cin>>h>>w; vector s(h); rep(i,0,h) cin>>s[i]; map,mint> dp; rep(i,1,w){ if(s[0][i]=='#') break; dp[{0,i}]=1; } rep(i,1,h){ map,mint> ndp; vector> nx(w); for(int j=w-1;j>=0;j--){ if(s[i][j]=='#') continue; nx[j].push_back(j); if(j+1