#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

ll dist[300][300];
void WarshallFloyd(ll n){
    rep(k,0,n){
        rep(i,0,n){
            if(i==k) continue;
            rep(j,0,n){
                dist[i][j] = min2(dist[i][j],dist[i][k]+dist[k][j]);
            }
        }
    }
}

/*階乗 a!*/
ll factorial(ll a){return a==0?1:a*factorial(a-1);}
ll permutation(ll n, ll a[n], ll p){
    rrep(i,n-1,1){
        // rep(j,0,n) printf("%lld ",a[j]);
        // printf("%lld ",p);
        // PN;
        if(p/factorial(i)==0){
            continue;
        }
        swap( &a[n-i-1] , &a[ (n-i-1) + p/factorial(i) ]);
        ll b[i];
        p%=factorial(i);
        rep(j,0,i){
            b[j] =  a[n-i+j];
        }
        sortup(b,i);
        rep(j,0,i){
            a[n-i+j] = b[j];
        }
    }
    ll ans=0;
    rep(i,0,n){
        ans+=a[i]*POW(10,n-1-i);
    }
    return ans;
}

/*nをa進数にしたときの、i桁目の数*/
ll a_base2(ll n, ll a, ll i){return i==1?n%a:a_base2(n/a,a,i-1);}

int main(void){
    // char ;
    ll n,r,m,ans=INF;
    scanf("%lld%lld%lld",&n,&m,&r);
    ll town[r],a[m],b[m],c[m];

    rep(i,0,n) dist[i][i]=0;
    rep(i,0,n){
        rep(j,0,n){
            if(i!=j) dist[i][j]=INF;
        }
    }

    rep(i,0,r){
        scanf("%lld",&town[i]);
    }
    rep(i,0,m){
        scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);
        dist[a[i]-1][b[i]-1]=c[i];
        dist[b[i]-1][a[i]-1]=c[i];
    }

    WarshallFloyd(n);
    // PN;
    // rep(i,0,n){
    //     rep(j,0,n){
    //         printf("%lld ",dist[i][j]);
    //     }
    //     PN;
    // }
    // PN;

    ll num[r];

    rep(i,0,factorial(r)){
        rep(j,0,r) num[j]=j+1;
        ll order=permutation(r,num,i),distsum=0;
        // printf("%lld\n",order);
        rep(j,0,r-1){
            // printf("%lld ",a_base2(order,10,r-j)-1);
            distsum+=dist[ town[ a_base2(order,10,r-j)-1 ]-1 ][ town[ a_base2(order,10,r-j-1)-1 ]-1 ];
            // printf("%lld ",dist[ town[ a_base2(order,10,r-j)-1 ] ][ town[ a_base2(order,10,r-j-1)-1 ] ]);
        }
        // printf("%lld\n",distsum);
        ans= min2(ans,distsum);
    }



    
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1152