N, M, K = map(int, input().split()) A = set(map(lambda x: int(x) - 1, input().split())) T = [list(map(int, input().split())) for _ in range(N)] ans = 10 ** 18 # dfs で順列全探索 def generate_permutations(determined, left, m): if m == 0: yield determined for add in left: left_copy = [x for x in left if x != add] for p in generate_permutations(determined + [add], left_copy, m-1): yield p for p in generate_permutations([], list(range(N)), M): if p[-1] not in A: continue ans = min(ans, sum(T[p[i]][p[i+1]] for i in range(M-1))) print(ans)