#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 205
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//------------------------------------
ll n,m,r,ar[N]; vector< pair<ll,ll> > vc[N];
ll findans(ll x){
	priority_queue< pair<ll,ll> ,vector< pair<ll,ll> > ,greater< pair<ll,ll> > > pq;
	pq.push({x,0}); ll dt[N];
	for(ll i=1;i<=n;i++) dt[i]=1e18;
	dt[x]=0;
	while(pq.size()>0){
		pair<ll,ll> p=pq.top();
		pq.pop();
		for(auto it:vc[p.fs]){
			if(dt[it.fs]>dt[p.fs]+it.sc){
				dt[it.fs]=dt[p.fs]+it.sc;
				pq.push({it.fs,dt[it.fs]});
			}
		}
	}
	ll i,an=0;
	//cout<<x<<"   ";
	for(i=1;i<=r;i++){
	//	cout<<dt[ar[i]]<<" ";
		an+=dt[ar[i]];
	}//cout<<endl;
	return an;
}
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l;
	cin>>n>>m>>r;

	for(i=1;i<=r;i++){
		cin>>ar[i];
	}
	ll a,b,c;
	for(i=1;i<=m;i++){
		cin>>a>>b>>c;
		vc[a].ps({b,c});
		vc[b].ps({a,c});
	}
		
	ll mn=1e18;
	for(i=1;i<=r;i++){
		k=findans(ar[i]);
		mn=min(mn,k);
	}
	cout<<mn;
	return 0;
}