import java.io.*; import java.util.*; import java.util.stream.*; 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(); int[] values = new int[n]; for (int i = 0; i < n; i++) { values[i] = sc.nextInt(); } long[][] distances = new long[n][n]; for (int i = 0; i < n; i++) { Arrays.fill(distances[i], Long.MAX_VALUE / 2); distances[i][i] = 0; } for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; int c = sc.nextInt(); distances[a][b] = c; distances[b][a] = c; } for (int a = 0; a < n; a++) { for (int b = 0; b < n; b++) { for (int c = 0; c < n; c++) { distances[b][c] = Math.min(distances[b][c], distances[b][a] + distances[a][c]); } } } ArrayList bridges = new ArrayList<>(); for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { bridges.add(new Bridge(i, j, distances[i][j])); } } Collections.sort(bridges); long ans = Long.MAX_VALUE; UnionFindTree uft = new UnionFindTree(n); long[] dp = new long[1 << n]; for (int i = 1; i < (1 << n); i++) { int pop = getPop(i); for (int j = 0; j < n; j++) { if ((i & (1 << j)) == 0) { continue; } dp[i] = dp[i ^ (1 << j)] + values[j]; break; } if (pop != k) { continue; } long current = dp[i]; uft.clear(); for (Bridge x : bridges) { if (x.matches(i) && !uft.same(x)) { uft.unite(x); current += x.value; } } ans = Math.min(ans, current); } System.out.println(ans); } static int getPop(int x) { int pop = 0; while (x > 0) { pop += x % 2; x >>= 1; } return pop; } static class UnionFindTree { int[] parents; public UnionFindTree(int size) { parents = new int[size]; } public void clear() { for (int i = 0; i < parents.length; i++) { parents[i] = i; } } public int find(int x) { if (x == parents[x]) { return x; } else { return parents[x] = find(parents[x]); } } public boolean same(int x, int y) { return find(x) == find(y); } public boolean same(Bridge x) { return same(x.left, x.right); } public void unite(int x, int y) { if (!same(x, y)) { parents[find(x)] = find(y); } } public void unite(Bridge x) { unite(x.left, x.right); } } static class Bridge implements Comparable { int left; int right; long value; public Bridge(int left, int right, long value) { this.left = left; this.right = right; this.value = value; } public int compareTo(Bridge another) { if (value == another.value) { return 0; } else if (value < another.value) { return -1; } else { return 1; } } public boolean matches(int mask) { return ((mask & (1 << left)) > 0) && ((mask & (1 << right)) > 0); } } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); 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 int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }