#include using namespace std; #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() using ll=long long int; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; templateinline bool chmax(T& a,T b){if(ainline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} ll dp[1<<18]; int main(){ int n,m,k; cin>>n>>m>>k; vector a(n); rep(i,0,n)cin>>a[i]; ll d[20][20]; rep(i,0,n)rep(j,0,n)d[i][j]=INF; rep(i,0,n)d[i][i]=0; rep(_,0,m){ int u,v,w; cin>>u>>v>>w; u--; v--; d[u][v]=d[v][u]=w; } rep(k,0,n)rep(i,0,n)rep(j,0,n)chmin(d[i][j],d[i][k]+d[k][j]); rep(mask,0,1<>to&1)){ ll add=INF; rep(from,0,n)if(mask>>from&1){ chmin(add,d[from][to]); } if(mask==0)add=0; chmin(dp[mask|(1<