import heapq def dijkstra(s, n, graph): INF = 10 ** 18 dist = [INF] * n dist[s] = 0 bef = [0] * n bef[s] = s hq = [(0, s)] #距離、地点を記録したヒープを作る heapq.heapify(hq) visit = [False] * n #訪れたかの判定 while(len(hq) > 0): c, v = heapq.heappop(hq) #ヒープから地点を1つ持ってくる visit[v] = True if c > dist[v]: continue for to, cost in graph[v]: if visit[to] == False and dist[v] + cost < dist[to]: dist[to] = cost + dist[v] bef[to] = v heapq.heappush(hq, (dist[to], to)) ''' return bef ''' return dist n, m, k = map(int,input().split()) r = list(map(int,input().split())) for i in range(k): r[i] -= 1 graph = [[] for _ in range(n + 1)] r_cost = 0 r_edges = [] r.sort() for i in range(m): a, b, c = map(int,input().split()) graph[a - 1].append((b - 1, c)) graph[b - 1].append((a - 1, c)) if i in r: r_cost += c r_edges.append([a - 1, b - 1]) dist = [[] for _ in range(n)] for a, b in r_edges: dist[a] = dijkstra(a, n, graph) dist[b] = dijkstra(b, n, graph) dist[0] = dijkstra(0, n, graph) dist[n - 1] = dijkstra(n - 1, n, graph) INF = 10 ** 12 ans = INF for i in range(2 ** k): dp = [[INF] * k for _ in range(2 ** k)] for j in range(k): p = r_edges[j][1 & (i >> j)] dp[2 ** j][j] = dist[0][p] + r_cost for i2 in range(0, 2 ** k): for x in range(k): fr = r_edges[x][(1 & (i >> x)) ^ 1] if not(i2 & (2 ** x)): continue for y in range(k): to = r_edges[y][1 & (i >> y)] mask = i2 | (2 ** y) d = dp[i2][x] + dist[fr][to] if (i2 & (2 ** y) == 0): dp[mask][y] = min(dp[mask][y], d) c = INF for z in range(k): p = r_edges[z][(1 & (i >> z)) ^ 1] d = dp[-1][z] + dist[n - 1][p] c = min(c, d) ans = min(ans, c) print(ans)