#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const int MAXN=200;
const int INF=0x3f3f3f3f;
int n,m,r;
int q[MAXN+10];
int G[MAXN+10][MAXN+10];
int main()
{
	scanf("%d%d%d",&n,&m,&r);
	for(int i=1;i<=r;++i)scanf("%d",q+i);
	for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)G[i][j]=((i==j)?0:INF);
	for(int i=1,a,b,c;i<=m;++i)scanf("%d%d%d",&a,&b,&c),G[a][b]=G[b][a]=min(G[a][b],c);
	for(int k=1;k<=n;++k)
		for(int i=1;i<=n;++i)
			for(int j=1;j<=n;++j)
				G[i][j]=min(G[i][j],G[i][k]+G[k][j]);
	sort(q+1,q+1+r);
	int ans=INF;
	do{
		int res=0;
		for(int i=1;i<r;++i)res+=G[q[i]][q[i+1]];
		ans=min(ans,res);
	}while(next_permutation(q+1,q+1+r));
	printf("%d",ans);
	return 0;
}