N,M,K = map(int,input().split()) R = list(map(lambda x:int(x) - 1,input().split())) dic = {} for i in range(K): dic[R[i]] = i G = [[] for i in range(N)] for i in range(M): a,b,c = map(int,input().split()) G[a - 1].append([b - 1, c, -1 if i not in dic else dic[i]]) G[b - 1].append([a - 1, c, -1 if i not in dic else dic[i]]) import heapq as hq q = [] hq.heappush(q, (0, 0, 0)) # コスト、頂点、今まで訪れた道 seen = set() # (v, status)のペアを持つ INF = 1 << 60 best = [[INF] * N for i in range(1 << K)] goal = (1 << K) - 1 while q: cost, v, status = hq.heappop(q) # print(v,bin(status)[2:].zfill(2)) if v == N - 1 and status == goal: print(cost) break if (v, status) in seen: continue seen.add((v, status)) for child, c, road in G[v]: next_status = status if road != -1: # 通るべき道である next_status |= (1 << road) if (child, next_status) in seen: continue if best[next_status][child] <= cost + c: continue best[next_status][child] = cost + c hq.heappush(q, (cost + c, child, next_status))