import sys readline = sys.stdin.readline # dp[v][S] = 今までに触った猪の集合がSでvにいるときの最小コスト N,M,K = map(int,readline().split()) R = list(map(int,readline().split())) Rdic = {} # 道の番号から猪の番号を導く for i in range(K): Rdic[R[i] - 1] = i G = [[] for i in range(N)] for i in range(M): a,b,c = map(int,readline().split()) ino = -1 if i in Rdic: # 道の番号が含まれる ino = Rdic[i] # イノシシの番号に変換 G[a - 1].append([b - 1, c, ino]) G[b - 1].append([a - 1, c, ino]) INF = 1 << 60 best = [[INF] * (1 << K) for i in range(N)] import heapq as hq q = [] hq.heappush(q, (0, 0, 0)) # 距離、頂点、今までに触った猪の集合 complete = (1 << K) - 1 while q: d,v,status = hq.heappop(q) if best[v][status] < d: continue best[v][status] = d if v == N - 1 and status == complete: print(best[v][status]) break for child, cost, ino in G[v]: if ino != -1: next_status = status | (1 << ino) if best[child][next_status] <= d + cost: continue best[child][next_status] = d + cost hq.heappush(q, (d + cost, child, status | (1 << ino))) else: if best[child][status] <= d + cost: continue best[child][status] = d + cost hq.heappush(q, (d + cost, child, status))