import java.io.*; import java.util.*; import java.util.function.*; 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 i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int a = 0; a < n; a++) { distances[j][a] = Math.min(distances[j][a], distances[j][i] + distances[i][a]); } } } long[] dp = new long[1 << n]; long ans = Long.MAX_VALUE; for (int i = 1; i < (1 << n); i++) { int pop = getPop(i); if (pop > k) { continue; } 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; } for (int j = 0; j < n; j++) { if ((i & (1 << j)) == 0) { continue; } long current = 0; for (int a = 0; a < n; a++) { if (j == a || (i & (1 << a)) == 0) { continue; } current += distances[j][a]; } ans = Math.min(ans, dp[i] + current); } } System.out.println(ans); } static int getPop(int x) { int pop = 0; while (x > 0) { pop += x % 2; x >>= 1; } return pop; } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }