def list3d(a, b, c, val=0): return [[[val] * c for _ in range(b)] for _ in range(a)] MOD = 998244353 H, W, K = map(int, input().split()) S = [input() for _ in range(H)] dp = list3d(H+1, W+1, H+W+1) dp[0][0][0] = 1 for i in range(H): for j in range(W): if S[i][j] == '#': continue for k in range(K): if i+1 < H and S[i+1][j] != '#': d = 1 if S[i+1][j] == 'o' else 0 dp[i+1][j][k+d] += dp[i][j][k] dp[i+1][j][k+d] %= MOD if j+1 < W and S[i][j+1] != '#': d = 1 if S[i][j+1] == 'o' else 0 dp[i][j+1][k+d] += dp[i][j][k] dp[i][j+1][k+d] %= MOD ans = 0 for k in range(K): ans += dp[H-1][W-1][k] ans %= MOD print(ans)