from itertools import permutations, combinations N,M,K=(int(x) for x in input().split()) L=[i for i in range(N)] A=set(map(int, input().split())) T=[] for i in range(N): a=list(map(int, input().split())) T.append(a) ans=float("inf") for i in combinations(L, M): for j in permutations(i): time=0 L_time=0 for k in range(1, len(j)): time += T[j[k-1]][j[k]] if not int(j[-1]+1) in A: L_time=float("inf") for k in A: L_time = min(L_time, T[j[-1]][k-1]) ans = min(ans, time+L_time) print(ans)