import itertools N,M,K = map(int,input().split()) R = [i-1 for i in map(int,input().split())] INF = 10**9 dist = [[INF]*N for _ in [0]*N] route = [[0]*2 for _ in [0]*M] for i in range(M): A,B,C = map(int,input().split()) A -= 1; B -= 1 route[i] = [A,B,C] dist[A][B] = dist[B][A] = C def warshall_floyd(dist): for i in range(N): dist[i][i] = 0 for k in range(N): for i in range(N): for j in range(N): d = dist[i][k]+dist[k][j] if(dist[i][j] > d): dist[i][j] = d return 0 warshall_floyd(dist) ans = INF rsum = sum(route[i][2] for i in R) for rlist in itertools.permutations(R): for bit in range(1 << K): s = rsum path = [0] for i in range(K): if(bit & (1 << i)): path.append(route[rlist[i]][0]) path.append(route[rlist[i]][1]) else: path.append(route[rlist[i]][1]) path.append(route[rlist[i]][0]) path.append(N-1) s += sum(dist[path[i]][path[i+1]] for i in range(0,len(path)-1,2)) if(ans > s): ans = s print(ans)