INF=float("inf") n,m,k=map(int,input().split()) q=[-1]*m for i,r in enumerate(list(map(lambda x: int(x)-1,input().split()))): q[r]=i wf=[[INF]*n for i in range(n)] e=[334]*k for i in range(m): a,b,c=map(int,input().split()) a,b=a-1,b-1 wf[a][b]=wf[b][a]=c if q[i]!=-1: e[q[i]]=(a,b,c) for p in range(n): wf[p][p]=0 for i in range(n): for j in range(n): wf[i][j]=min(wf[i][j],wf[i][p]+wf[p][j]) dp=[[INF]*n for i in range(2**k)] dp[0][0]=0 for bit in range(2**k): for i in range(n): for j in range(n): dp[bit][j]=min(dp[bit][j],dp[bit][i]+wf[i][j]) for i,(a,b,c) in enumerate(e): dp[1<