import sys input = sys.stdin.readline N,M,K = map(int,input().split()) A = list(map(int,input().split())) inf = 10**18 dist = [[inf]*N for _ in range(N)] for _ in range(M): X,Y,Z = map(int,input().split()) X -= 1 Y -= 1 dist[X][Y] = Z dist[Y][X] = Z for k in range(N): for i in range(N): for j in range(N): dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]) def bit_count(n): c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555) c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333) c = (c & 0x0f0f0f0f0f0f0f0f) + ((c >> 4) & 0x0f0f0f0f0f0f0f0f) c = (c & 0x00ff00ff00ff00ff) + ((c >> 8) & 0x00ff00ff00ff00ff) c = (c & 0x0000ffff0000ffff) + ((c >> 16) & 0x0000ffff0000ffff) c = (c & 0x00000000ffffffff) + ((c >> 32) & 0x00000000ffffffff) return c dp = [inf]*(1<= K: if bc == K: ans = min(ans,d) continue already = [] not_yet = [] for j in range(N): if (i>>j) & 1: already.append(j) else: not_yet.append(j) for j in not_yet: dp[i^(1<