#include #include using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; using vi = vector; using vvi = vector; using vvvi = vector; using vll = vector; using vvll = vector; using vvvll = vector; using vmi = vector; using vvmi = vector; using vvvmi = vector; #define all(a) (a).begin(), (a).end() #define rep2(i, m, n) for (int i = (m); i < (n); ++i) #define rep(i, n) rep2(i, 0, n) #define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i) #define drep(i, n) drep2(i, n, 0) ll inf = 2e18; void solve(){ } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, k; cin >> n >> m >> k; vll a(n); rep(i, n)cin >> a[i]; vvll d(n, vll(n, inf)); rep(i, m){ int x, y; ll z; cin >> x >> y >> z; x--; y--; d[x][y] = d[y][x] = z; } rep(k, n){ rep(i, n)rep(j, n){ if(d[i][j] > d[i][k] + d[k][j]){ d[i][j] = d[i][k] + d[k][j]; } } } vll dp(1< bs(i); if(bs.count() == 1){ int j = 0; while(!bs[j])j++; dp[i] = a[j]; continue; } if(bs.count() > k)continue; ll tmp = inf; rep(j, n){ if(!bs[j])continue; bs.reset(j); ll dt = inf; rep(k, n){ if(!bs[k])continue; dt = min(dt, d[j][k]); } tmp = min(tmp, a[j] + dp[bs.to_ulong()] + dt); bs.set(j); } dp[i] = tmp; } ll ans = inf; rep2(i, 1, 1< bs(i); if(bs.count() != k)continue; ans = min(ans, dp[bs.to_ulong()]); }cout << ans << endl; return 0; }