# include <iostream>
# include <algorithm>
using namespace std;
const int N=206,M=11;
int a[N][N],b[M];
int n,m,p,s;
void work (void)
{
	int i,j,k,t;
	for (i=1;i<=n;i++)
	for (j=1;j<=n;j++)
	if (j!=i)
	for (k=1;k<=n;k++)
	if (k!=i&&k!=j)
	{
		t=a[j][i]+a[i][k];
		if (t<a[j][k])
		a[j][k]=t;
	}
	for (i=1;i<p;i++)
	s+=a[b[i]][b[i+1]];
	while (next_permutation (b+1,b+p+1)==1)
	{
		t=0;
		for (i=1;i<p;i++)
		t+=a[b[i]][b[i+1]];
		if (t<s)
		s=t;
	}
	cout<<s;
}
int main (void)
{
	int i,j,k,u;
	cin>>n>>m>>p;
	for (i=1;i<=n;i++)
	for (j=1;j<=n;j++)
	if (j!=i)
	a[i][j]=1000000000;
	for (i=1;i<=p;i++)
	cin>>b[i];
	for (i=1;i<=m;i++)
	{
		cin>>j>>k>>u;
		a[j][k]=u;
		a[k][j]=u;
	}
	sort (b+1,b+p+1);
	work ();
	return 0;
}
