h,w,k = map(int,input().split()) S = [input() for i in range(h)] mod = 998244353 dp = [[[0]*k for i in range(w)] for j in range(h)] dp[0][0][k-1] = 1 for i in range(h): for j in range(w): s = S[i][j] if s == "#": continue for x in range(k): if dp[i][j][x] == 0: continue if i != h-1: ns = S[i+1][j] if ns == ".": dp[i+1][j][x] += dp[i][j][x] dp[i+1][j][x] %= mod elif ns == "o" and x: dp[i+1][j][x-1] += dp[i][j][x] dp[i+1][j][x-1] %= mod if j != w-1: ns = S[i][j+1] if ns == ".": dp[i][j+1][x] += dp[i][j][x] dp[i][j+1][x] %= mod elif ns == "o" and x: dp[i][j+1][x-1] += dp[i][j][x] dp[i][j+1][x-1] %= mod print(sum(dp[-1][-1])%mod)