#include using namespace std; struct iofast_t { iofast_t() { ios::sync_with_stdio(false); cin.tie(nullptr); } } iofast; struct uns_t {} uns; template auto vec(Element init, Head arg, Args ...args) { if constexpr (sizeof...(Args) == 0) return std::vector(arg, init); else return std::vector(arg, vec(init, args...)); } template auto vec(uns_t, Head arg, Args ...args) { return vec(Element(), arg, args...); } template > T &chmin(T &l, T r, Compare &&f = less()) { return l = min(l, r, f); } template > T &chmax(T &l, T r, Compare &&f = less()) { return l = max(l, r, f); } int main() { constexpr auto inf = INT64_MAX / 2; int n, m, k; cin >> n >> m >> k; auto a = vec(uns, n); for (auto &e : a) cin >> e; auto dist = vec(inf, n, n); for (int i = 0; i < n; ++i) { dist[i][i] = 0; } for (int i = 0; i < m; ++i) { int x, y, z; cin >> x >> y >> z; --x; --y; chmin(dist[x][y], z); chmin(dist[y][x], z); } for (int k = 0; k < n; ++k) { for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { chmin(dist[i][j], dist[i][k] + dist[k][j]); } } } auto c = vec(inf, n, 1 << n); for (int i = 0; i < n; ++i) { for (int j = 0; j < (1 << n); ++j) { if (!(j & (1 << i))) { continue; } if (bitset<32>(j).count() == 1) { c[i][j] = a[i]; continue; } for (int k = 0; k < n; ++k) { if (!(j & (1 << k)) || i == k) { continue; } chmin(c[i][j], dist[i][k] + a[i]); } } } auto dp = vec(inf, 1 << n); dp[0] = 0; for (int i = 1; i < (1 << n); ++i) { for (int j = 0; j < n; ++j) { if (!(i & (1 << j))) { continue; } chmin(dp[i], dp[i ^ (1 << j)] + c[j][i]); } } int64_t ans = inf; for (int i = 0; i < (1 << n); ++i) { if (bitset<32>(i).count() == k) { chmin(ans, dp[i]); } } cout << ans << endl; }