from collections import defaultdict import heapq as hq N, M, K = map(int, input().split()) R = list(map(int, input().split())) Edge = [list(map(int, input().split())) for _ in range(M)] graph = defaultdict(list) for i in range(M): a, b, c = Edge[i] d = -1 if i+1 in R: d = R.index(i+1) graph[a].append([b, c, d]) graph[b].append([a, c, d]) INF = 10**18 dist = [INF]*(1 << 13) dist[1] = 0 task = [1] mask = (1 << 13)-1 msks = (1 << 8)-1 while task: t = hq.heappop(task) d = t >> 13 x = t & mask if d > dist[x]: continue v = x & msks s = x >> 8 for u, c, f in graph[v]: ns = (s << 8)+u if f >= 0: ns |= 1 << (f+8) if dist[ns] > d+c: dist[ns] = d+c hq.heappush(task, ns+((d+c) << 13)) print(dist[(((1 << K)-1) << 8)+N])