#include<bits/stdc++.h>
int N,M,R,r[8],A,B,C,d[201][201],i,j,k;
int main(){
	scanf("%d%d%d",&N,&M,&R);
	for(i=0;i<R;++i)scanf("%d",r+i);
	std::sort(r,r+R);
	for(;~scanf("%d%d%d",&A,&B,&C);)d[A][B]=d[B][A]=C;
	for(k=0;k++<N;)for(i=0;i++<N;)for(j=0;j++<N;){
		if(!d[i][j])d[i][j]=1e9;
		d[i][j]=std::min(d[i][j],d[i][k]+d[k][j]);
	}
	int x=1e9;
	do{
		int y=0;
		for(i=0;i+1<R;++i)y+=d[r[i]][r[i+1]];
		x=std::min(x,y);
	}while(std::next_permutation(r,r+R));
	printf("%d",x);
}
