import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 h, w, k = mi() s = [input() for _ in range(h)] dp = [[[0] * (k + 1) for _ in range(h + 1)] for _ in range(w + 1)] dp[0][0][k] = 1 for i in range(h): for j in range(w): if s[i][j] == '#': continue if s[i][j] == 'o': for x in range(1, k + 1): if i - 1 >= 0: dp[i][j][x - 1] += dp[i - 1][j][x] if j - 1 >= 0: dp[i][j][x - 1] += dp[i][j - 1][x] dp[i][j][x - 1] %= mod else: for x in range(k + 1): if i - 1 >= 0: dp[i][j][x] += dp[i - 1][j][x] if j - 1 >= 0: dp[i][j][x] += dp[i][j - 1][x] dp[i][j][x] %= mod ans = 0 for i in range(1, k + 1): ans += dp[h - 1][w - 1][i] print(ans % mod)