#include using namespace std; using ll = long long; #define all(p) p.begin(),p.end() #define rep(i,a,b) for(int i=(int)a;i<(int)b;i++) const int mod=998244353; int main(){ int H,W,K; cin>>H>>W>>K; vector dp(H,vector(W,vector(K))); rep(i,0,K) dp[0][0][i]=1; vector p(H); rep(i,0,H) cin>>p[i]; rep(i,0,H) rep(j,0,W){ if(p[i][j]=='#') continue; if(p[i][j]=='o'){ for(int k=K-1;k>0;k--) dp[i][j][k]=dp[i][j][k-1]; dp[i][j][0]=0; } for(auto &x:dp[i][j]) x%=mod; if(i+1!=H) rep(k,0,K) dp[i+1][j][k]+=dp[i][j][k]; if(j+1!=W) rep(k,0,K) dp[i][j+1][k]+=dp[i][j][k]; } cout<