h, w, k = map(int, input().split()) A = [[0] * w for _ in range(h)] se = set() def dfs(i, j): if i == h: min_ = 10 ** 20 tmp = set() for i in range(h): for j in range(w): tmp.add(A[i][j]) if len(tmp) != k: return for di in range(h): for dj in range(w): tot = 0 for i in range(h): for j in range(w): tot *= 10 tot += A[(i + di) % h][(j + dj) % w] min_ = min(min_, tot) se.add(min_) return for c in range(k): A[i][j] = c if j == w - 1: dfs(i + 1, 0) else: dfs(i, j + 1) dfs(0, 0) print(len(se))