import itertools import heapq N,M,K = map(int,input().split()) R = [i-1 for i in map(int,input().split())] route = [[] for _ in [0]*N] edge = [0]*M for i in range(M): A,B,C = map(int,input().split()) A -= 1; B -= 1 edge[i] = [A,B,C] route[A].append((B,C)) route[B].append((A,C)) def dijkstra(route): dist = [[-1]*N for _ in [0]*N] for i in range(N): q = [(0,i)] cnt = 0 while(q and cnt < N): d,v = heapq.heappop(q) if(dist[i][v] == -1): cnt += 1 dist[i][v] = d for nv,nd in route[v]: heapq.heappush(q,(d + nd,nv)) return dist ans = float("inf") rsum = sum(edge[i][2] for i in R) dist = dijkstra(route) 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(edge[rlist[i]][0]) path.append(edge[rlist[i]][1]) else: path.append(edge[rlist[i]][1]) path.append(edge[rlist[i]][0]) path.append(N-1) for i in range(0,len(path)-1,2): s += dist[path[i]][path[i+1]] if(ans > s): ans = s print(ans)