H,W,K=map(int,input().split()) S = [input() for i in range(H)] dp = [[[0 for k in range(K)] for i in range(W)] for j in range(H)] ans = 0 for k in range(K): dp[0][0][0]=1 for i in range(H): for j in range(W): if S[i][j]=='.': if i!=0: dp[i][j][k]=(dp[i][j][k]+dp[i-1][j][k])%998244353 if j!=0: dp[i][j][k]=(dp[i][j][k]+dp[i][j-1][k])%998244353 if S[i][j]=='o': if i!=0: dp[i][j][k]=(dp[i][j][k]+dp[i-1][j][k-1])%998244353 if j!=0: dp[i][j][k]=(dp[i][j][k]+dp[i][j-1][k-1])%998244353 ans=(ans+dp[H-1][W-1][k])%998244353 print(ans)