H,W,K=map(int,input().split()) S=[input() for _ in range(H)] MOD=998244353 dp=[[[0]*K for _ in range(W)] for _ in range(H)] dp[0][0][0]=1 for i in range(H): for j in range(W): s=S[i][j] if s=='#': continue if i: if s=='o': for k in range(1,K): dp[i][j][k]+=dp[i-1][j][k-1] dp[i][j][k]%=MOD else: for k in range(K): dp[i][j][k]+=dp[i-1][j][k] dp[i][j][k]%=MOD if j: if s=='o': for k in range(1,K): dp[i][j][k]+=dp[i][j-1][k-1] dp[i][j][k]%=MOD else: for k in range(K): dp[i][j][k]+=dp[i][j-1][k] dp[i][j][k]%=MOD print(sum(dp[-1][-1])%MOD)