import heapq as hq import sys input = sys.stdin.readline INF = 10 ** 18 N,M,K = map(int, input().split()) R = [i - 1 for i in map(int, input().split())] S = set(R) edge = [[] for _ in [0] * M] route = [[] for _ in [0] * N] rsum = 0 for i in range(M): a,b,c = map(int, input().split()) a -= 1; b -= 1 route[a].append((b,c)) route[b].append((a,c)) if(i in S): edge[i] = [a,b,c] rsum += c def dijkstra(s,route): que = [(s,0)] dist = [INF] * N while(que): v,d = hq.heappop(que) if(dist[v] < INF): continue dist[v] = d for nv,nd in route[v]: hq.heappush(que,(nv,d + nd)) return dist dist = [[] for _ in [0] * N] T = set([0,N - 1]) for i in S: T.add(edge[i][0]) T.add(edge[i][1]) for i in T: dist[i] = dijkstra(i,route) ans = INF for rbit in range(1 << K): b = [(rbit >> i) & 1 for i in range(K)] dp = [[INF] * K for _ in [0] * (1 << K)] for i in range(K): k = edge[R[i]][b[i]] dp[1 << i][i] = rsum + dist[0][k] for bit in range(1, 1 << K): for s in range(K): if not(bit & (1 << s)): continue k = edge[R[s]][b[s] ^ 1] for t in range(K): l = edge[R[t]][b[t]] p = bit | (1 << t) q = dp[bit][s] + dist[k][l] if((bit & (1 << t)) == 0 and dp[p][t] > q): dp[p][t] = q for i in range(K): k = edge[R[i]][b[i] ^ 1] d = dp[-1][i] + dist[k][N - 1] if(ans > d): ans = d print(ans)