H, W, K = map(int, input().split()) S = [] for i in range(H): S.append(list(input())) dp = [[[0] * (K + 2) for i in range(W)] for j in range(H)] dp[0][0][K] = 1 mod = 998244353 for i in range(H): for j in range(W): if S[i][j] == "#": continue for k in range(K + 1): if i: if S[i][j] == ".": dp[i][j][k] += dp[i - 1][j][k] else: dp[i][j][k] += dp[i - 1][j][k + 1] if j: if S[i][j] == ".": dp[i][j][k] += dp[i][j - 1][k] else: dp[i][j][k] += dp[i][j - 1][k + 1] dp[i][j][k] %= mod ans = 0 for i in range(1, K + 1): ans += dp[H-1][W-1][i] ans %= mod print(ans)