#include using namespace std; using ll = long long; struct Graph { static constexpr ll INF = 1LL << 60; struct Edge { int d, i; }; Graph(int n) : e(n), d(n, vector(n, INF)), n(n) { for (int i = 0; i < n; i++) d[i][i] = 0; } void add_edge(int i, int j, int l) { e[i].push_back({ l, j }); d[i][j] = l;//多重辺はないとする } void warshall_floyd() { for (int k = 0; k < n; k++) for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]); } vector> e; vector> d; int n; }; ll dp[19][1 << 18]; int main() { int n, m, K; cin >> n >> m >> K; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } Graph g(n); for (int j = 0; j < m; j++) { int x, y, z; cin >> x >> y >> z; x--; y--; g.add_edge(x, y, z); g.add_edge(y, x, z); } g.warshall_floyd(); ll r = 1LL << 60; for (int i = 0; i < n; i++) { for (int k = 0; k < 1 << n; k++) { dp[i][k] = 1LL << 60; } dp[i][1 << i] = a[i]; if (1 == K) r = min(r, dp[i][1 << i]); } for (int k = 0; k < 1 << n; k++) { int c = __builtin_popcount(k); if (c == 1 || c > K) continue; for (int i = 0; i < n; i++) { if (k & 1 << i) { int l = k ^ 1 << i; ll t = 1LL << 60; for (int j = 0; j < n; j++) { if (l & 1 << j) { t = min(t, dp[j][l]); } } ll s = 1LL << 60; for (int j = 0; j < n; j++) { if (l & 1 << j) { s = min(s, g.d[i][j]); } } dp[i][k] = t + a[i] + s; if (c == K) r = min(r, dp[i][k]); } } } cout << r << endl; return 0; }