#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int d[200][200];
int R[200];
signed main() {
	int n,m,r;scanf("%d%d%d",&n,&m,&r);
	memset(d,0x3f,sizeof(d));
	rep(i,n)d[i][i]=0;
	rep(i,r){
		scanf("%d",&R[i]);R[i]--;
	}
	rep(i,m){
		int a,b,c;scanf("%d%d%d",&a,&b,&c);a--;b--;
		d[a][b]=d[b][a]=c;
	}
	rep(k,n)rep(i,n)rep(j,n)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	vector<int>v(r);rep(i,r)v[i]=i;
	int Min=INT_MAX;
	do{
		int cnt=0;
		rep(i,v.size()-1)cnt+=d[R[v[i]]][R[v[i+1]]];
		Min=min(Min,cnt);
	}while(next_permutation(v.begin(),v.end()));
	cout<<Min<<endl;
}
