import sys import io, os input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline import heapq INF = 10**18 def dijkstra(s, edge): n = len(edge) dist = [INF]*n dist[s] = 0 edgelist = [] heapq.heappush(edgelist,(dist[s], s)) while edgelist: minedge = heapq.heappop(edgelist) if dist[minedge[1]] < minedge[0]: continue v = minedge[1] for e in edge[v]: if dist[e[1]] > dist[v]+e[0]: dist[e[1]] = dist[v]+e[0] heapq.heappush(edgelist,(dist[e[1]], e[1])) return dist def main(): n, m, k = map(int, input().split()) R = list(map(int, input().split())) R = [r-1 for r in R] toid = {} for i, r in enumerate(R): toid[r] = i g = [[] for i in range(n)] ABC = [] for i in range(m): a, b, c = map(int, input().split()) a, b = a-1, b-1 g[a].append((c, b)) g[b].append((c, a)) if i in toid: ABC.append((a, b, c)) dists = dijkstra(0, g) distt = dijkstra(n-1, g) D = [] for i in range(k): a, b = ABC[i][0], ABC[i][1] dista = dijkstra(a, g) distb = dijkstra(b, g) D.append([dista,distb]) dp = [[[INF]*2 for i in range(k)] for i in range(1<>i)&1: continue ns = s|(1<>j)&1): continue if i == j: continue for x in range(2): for y in range(2): dp[ns][i][x] = min(dp[ns][i][x], dp[s][j][y]+D[i][1-x][ABC[j][y]]+c) ans = INF for i in range(k): for x in range(2): v = ABC[i][x] ans = min(ans, dp[(1<