H,W,K = map(int,input().split()) S = [input() for _ in range(H)] MOD = 998244353 #dp[h][w][k]=マス(h,w)に体力の減少kで行くことができる移動経路の数 dp = [[[0]*K for _ in range(W)] for _ in range(H)] dp[0][0][0] = 1 for h in range(H): for w in range(W): for k in range(K): if h+1 <= H-1: if S[h+1][w] == ".": dp[h+1][w][k] += dp[h][w][k] elif S[h+1][w] == "o" and k <= K-2: dp[h+1][w][k+1] += dp[h][w][k] if w+1 <= W-1: if S[h][w+1] == ".": dp[h][w+1][k] += dp[h][w][k] elif S[h][w+1] == "o" and k <= K-2: dp[h][w+1][k+1] += dp[h][w][k] dp[h][w][k] %= MOD ans = 0 for k in range(K): ans += dp[H-1][W-1][k] ans %= MOD print(ans)