""" bitdpっぽくやるのね… 10^7... 厳しめ dp[bit][最後][LorR] = mincost """ from sys import stdin import heapq def Dijkstra(lis,start): ret = [float("inf")] * len(lis) ret[start] = 0 q = [(0,start)] while len(q) > 0: ncost,now = heapq.heappop(q) if ncost != ret[now]: continue for nex,ecost in lis[now]: if ret[nex] > ncost + ecost: ret[nex] = ncost + ecost heapq.heappush(q , (ret[nex] , nex)) return ret N,M,K = map(int,stdin.readline().split()) R = list(map(int,stdin.readline().split())) for i in range(K): R[i] -= 1 lis = [ [] for i in range(M) ] ABC = [] for i in range(M): A,B,C = map(int,stdin.readline().split()) A -= 1 B -= 1 ABC.append( (A,B,C) ) lis[A].append( (B,C) ) lis[B].append( (A,C) ) ddic = {} ddic[0] = Dijkstra(lis,0) for nr in R: l,r,_ = ABC[nr] if l not in ddic: ddic[l] = Dijkstra(lis,l) if r not in ddic: ddic[r] = Dijkstra(lis,r) #print (ddic) inf = float("inf") dp = [ [[inf,inf] for j in range(K)] for i in range(2**K) ] # dp[bit][最後][LorR] = mincost for i,nr in enumerate(R): l,r,c = ABC[nr] dp[2**i][i][0] = ddic[0][r] + c dp[2**i][i][1] = ddic[0][l] + c def popcnt(x): ret = 0 while x: ret += x%2 x //= 2 return ret for bit in range(2**K): for lastNR in range(K): for lastSide in range(2): lastL,lastR,_ = ABC[R[lastNR]] lastV = [lastL,lastR][lastSide] if dp[bit][lastNR][lastSide] == inf: continue for newNR in range(K): newbit = 2**newNR | bit if bit == newbit: continue newL,newR,newC = ABC[R[newNR]] dp[newbit][newNR][0] = min(dp[newbit][newNR][0] , dp[bit][lastNR][lastSide] + ddic[lastV][newR] + newC ) dp[newbit][newNR][1] = min(dp[newbit][newNR][1] , dp[bit][lastNR][lastSide] + ddic[lastV][newL] + newC ) ans = inf bit = 2**K-1 for lastNR in range(K): for lastSide in range(2): lastL,lastR,_ = ABC[R[lastNR]] lastV = [lastL,lastR][lastSide] ans = min(ans , dp[bit][lastNR][lastSide] + ddic[lastV][N-1]) print (ans)