#include using namespace std; typedef long long ll; typedef pair P; #define DUMP(x) cout << #x << " = " << (x) << endl; #define FOR(i, m, n) for (ll i = m; i < n; i++) #define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--) #define REP(i, n) FOR(i, 0, n) #define IREP(i, n) IFOR(i, 0, n) #define ALL(v) (v).begin(), (v).end() #define SZ(x) ll(x.size()) const ll INF = 1e18; vector> nxt; // a->bの最短経路復元 // for (ll cur = a; cur != b; cur = nxt[cur][b]) { // // } void warshall_floyd(vector>& d) { ll n = SZ(d); nxt = vector>(n, vector(n)); REP(i, n) REP(j, n) { nxt[i][j] = j; } REP(i, n) REP(j, n) REP(k, n) if (d[j][k] > d[j][i] + d[i][k]) { d[j][k] = d[j][i] + d[i][k]; nxt[j][k] = nxt[j][i]; } } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } int main() { ll n, m, k; cin >> n >> m >> k; vector a(n); REP(i, n) { cin >> a[i]; } vector> d(n, vector(n, INF)); d[0][0] = 0; REP(i, m) { ll x, y, z; cin >> x >> y >> z; x--, y--; d[x][y] = z; d[y][x] = z; } warshall_floyd(d); ll N = 1LL << n; vector dp(N, INF); dp[0] = 0; REP(i, N) { REP(j, n) { if (i & (1LL << j)) { continue; } ll ni = i | (1LL << j); if (i == 0) { chmin(dp[ni], dp[i] + a[j]); } else { ll mini = INF; REP(k, n) { if (i & (1LL << k)) { chmin(mini, d[k][j]); } } chmin(dp[ni], dp[i] + a[j] + mini); } } } ll ans = INF; REP(i, N) { ll p = 0; REP(j, n) { if (i & (1LL << j)) { p++; } } if (p == k) { ans = min(ans, dp[i]); } } cout << ans << endl; }