import numpy as np import itertools H, W, K = map(int, input().split()) pow_table = (K ** np.arange(H * W, dtype=np.int32)).reshape((H, W)) pow_hash = lambda x: np.sum(x * pow_table) st = set() for t in itertools.product(range(K), repeat=H * W): if len(set(t)) != K: continue grid = np.array(t).reshape((H, W)) g4 = np.tile(grid, (2, 2)) for h, w in itertools.product(range(H), range(W)): if pow_hash(g4[h:h + H, w:w + W].data) in st: break else: st.add(pow_hash(grid)) print(len(st))