import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); HashMap idxes = new HashMap<>(); for (int i = 0; i < k; i++) { idxes.put(sc.nextInt() - 1, i); } ArrayList> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { graph.add(new ArrayList<>()); } for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; int c = sc.nextInt(); graph.get(a).add(new Road(b, c, idxes.getOrDefault(i, -1))); graph.get(b).add(new Road(a, c, idxes.getOrDefault(i, -1))); } PriorityQueue queue = new PriorityQueue<>(); queue.add(new Path(0, 0, 0)); int[][] cost = new int[1 << k][n]; for (int[] arr : cost) { Arrays.fill(arr, Integer.MAX_VALUE); } while (queue.size() > 0) { Path p = queue.poll(); if (cost[p.mask][p.idx] <= p.value) { continue; } for (int i = p.mask; i > 0; i = (p.mask & (i - 1))) { cost[i][p.idx] = Math.min(cost[i][p.idx], p.value); } cost[0][p.idx] = Math.min(cost[0][p.idx], p.value); for (Road x : graph.get(p.idx)) { if (x.mask >= 0) { queue.add(new Path(x.idx, p.value + x.cost, p.mask | (1 << x.mask))); } else { queue.add(new Path(x.idx, p.value + x.cost, p.mask)); } } } System.out.println(cost[(1 << k) - 1][n - 1]); } static class Path implements Comparable { int idx; int value; int mask; public Path(int idx, int value, int mask) { this.idx = idx; this.value = value; this.mask = mask; } public int compareTo(Path another) { return value - another.value; } } static class Road { int idx; int cost; int mask; public Road(int idx, int cost, int mask) { this.idx = idx; this.cost = cost; this.mask = mask; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }