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 HashMap<>()); } HashMap compress = new HashMap<>(); int[] lefts = new int[k]; int[] rights = new int[k]; int[] values = new int[k]; for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; int c = sc.nextInt(); if (idxes.containsKey(i)) { int x = idxes.get(i); lefts[x] = a; rights[x] = b; values[x] = c; compress.put(a, null); compress.put(b, null); } else { graph.get(a).put(b, c); graph.get(b).put(a, c); } } compress.put(0, null); compress.put(n - 1, null); int count = 0; int[] cities = new int[compress.size()]; for (int x : compress.keySet()) { cities[count] = x; compress.put(x, count++); } PriorityQueue queue = new PriorityQueue<>(); int[][] cost = new int[count][n]; for (int i = 0; i < count; i++) { Arrays.fill(cost[i], Integer.MAX_VALUE); queue.add(new Path(cities[i], 0)); while (queue.size() > 0) { Path p = queue.poll(); if (cost[i][p.idx] <= p.value) { continue; } cost[i][p.idx] = p.value; for (int x : graph.get(p.idx).keySet()) { queue.add(new Path(x, p.value + graph.get(p.idx).get(x))); } } } ArrayList> small = new ArrayList<>(); for (int i = 0; i < count; i++) { small.add(new ArrayList<>()); } for (int i = 0; i < count; i++) { for (int j = 0; j < count; j++) { if (i == j) { continue; } small.get(i).add(new Road(j, cost[i][cities[j]], -1)); } } for (int i = 0; i < k; i++) { small.get(compress.get(lefts[i])).add(new Road(compress.get(rights[i]), values[i], i)); small.get(compress.get(rights[i])).add(new Road(compress.get(lefts[i]), values[i], i)); } long[][] ans = new long[1 << k][count]; for (long[] arr : ans) { Arrays.fill(arr, Long.MAX_VALUE); } PriorityQueue roads = new PriorityQueue<>(); roads.add(new Road(compress.get(0), 0, 0)); while (roads.size() > 0) { Road r = roads.poll(); if (ans[r.mask][r.idx] <= r.value) { continue; } for (int i = r.mask; i > 0; i = (r.mask & (i - 1))) { ans[i][r.idx] = Math.min(ans[i][r.idx], r.value); } ans[0][r.idx] = Math.min(ans[0][r.idx], r.value); for (Road x : small.get(r.idx)) { if (x.mask >= 0) { roads.add(new Road(x.idx, r.value + x.value, r.mask | (1 << x.mask))); } else { roads.add(new Road(x.idx, r.value + x.value, r.mask)); } } } System.out.println(ans[(1 << k) - 1][compress.get(n - 1)]); } static class Path implements Comparable { int idx; int value; public Path(int idx, int value) { this.idx = idx; this.value = value; } public int compareTo(Path another) { return value - another.value; } } static class Road implements Comparable { int idx; long value; int mask; public Road(int idx, long value, int mask) { this.idx = idx; this.value = value; this.mask = mask; } public int compareTo(Road another) { if (value == another.value) { return 0; } else if (value < another.value) { return -1; } else { return 1; } } } } 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(); } }