import sys #input = sys.stdin.readline #文字列につけてはダメ input = sys.stdin.buffer.readline #文字列につけてはダメ #sys.setrecursionlimit(1000000) #import bisect #import itertools #import random from heapq import heapify, heappop, heappush #from collections import defaultdict #from collections import deque #import copy #import math #from functools import lru_cache #MOD = pow(10,9) + 7 #MOD = 998244353 def main(): N,M,K = map(int,input().split()) R = list(map(int,input().split())) R = [r-1 for r in R] R.sort() dic = {} req = 0 G = [[] for _ in range(N)] for i in range(M): a,b,c = map(int,input().split()) a -= 1; b -= 1 G[a].append((c,b)) G[b].append((c,a)) if req < K and i == R[req]: dic[(a,b)] = req dic[(b,a)] = req req += 1 #print(dic) dis = dijkstra_heap2(0,K,G,dic) ans = dis[-1] print(ans) def dijkstra_heap2(s,K,G,dic): INF = pow(10,18) #S:start, V: node, E: Edge, G: Graph V = len(G) K2 = 1 << K #d[i][j]: i番目の頂点にいて通った道の状態がjの時の最短経路 #idx = i * K2 + j d = [INF for _ in range(V * K2)] d[s] = 0 PQ = [] heappush(PQ,(0,s)) while PQ: c,vidx = heappop(PQ) vi = vidx // K2 vj = vidx % K2 if d[vidx] < c: continue d[vidx] = c if vidx == V*K2 - 1: print(c);exit() for cost,ui in G[vi]: uj = vj if (vi,ui) in dic: uj = vj | 1 << dic[(vi,ui)] uidx = ui * K2 + uj if d[uidx] <= cost + d[vidx]: continue d[uidx] = cost + d[vidx] heappush(PQ,(d[uidx], uidx)) return d if __name__ == '__main__': main()