#include using namespace std; inline int read() { int x=0,f=1,c=getchar(); while(c<48) c=='-'&&(f=-1),c=getchar(); while(c>47) x=x*10+c-'0',c=getchar(); return x*f; } const int MAXN = 505; const int INF = 0x3f3f3f3f; struct Edge {int to,val;}; std::vector G[MAXN]; int p[MAXN],inq[MAXN],f[MAXN][MAXN<<3]; int n,m,k; queue q; inline void addedge(int u,int v,int w) { G[u].push_back(Edge{v,w}); G[v].push_back(Edge{u,w}); } inline void spfa(int st) { while(!q.empty()) { int x=q.front(); q.pop(); inq[x]=0; for(Edge &e : G[x]) if(f[e.to][st]>f[x][st]+e.val) { f[e.to][st]=f[x][st]+e.val; if(!inq[e.to]) q.push(e.to),inq[e.to]=1; } } } int main(int argc, char const *argv[]) { n=read(),m=read(),k=read(); memset(f,INF,sizeof(f)); for(int i=1,x,y; i<=m; ++i) x=read(),y=read(),addedge(x,y,read()); for(int i=1; i<=k; ++i) f[p[i]=read()][1<<(i-1)]=0; for(int st=0; st<(1<