/*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
*       Example:-   $ g++ -std=c++11 c++Template.cpp
*
* Author : Akshay Pratap Singh
* Handle: code_crack_01
*
*/
 
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
// #include <unordered_map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <climits>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for(int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for(int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
typedef long long int ll;
typedef unsigned long long int  ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vi> vvi;
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

#define MAX_V 100005

struct edge{
    int to;
    long long cost;
    edge(int i, long long j) {to = i, cost = j; };
};
typedef pair<long long, int> P; // firstは最短距離、secondは頂点の番号

int V;
vector<edge> G[MAX_V];
long long d[MAX_V];
int pv[MAX_V];

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V, LLONG_MAX);
    fill(pv, pv + V, -1);
    d[s] = 0;
    que.push(P(0,s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first ) continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost ) {
                d[e.to] = d[v] + e.cost;
                pv[e.to] = v;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

vector<int> get_path(int t){
    vector<int> path;
    for(; t != -1; t = pv[t]) path.push_back(t);
    reverse(path.begin(), path.end());
    return path;
}

int N, M, R;
vvi am(10, vi(10, INF));

int solve (int bit, int from, int dist) {

/*
	REP(i, R) {
        if (bit >> i & 1) cout << 1 << " ";
		else cout << 0 << " ";
	}
	cout << dist << endl;
*/

    if (bit == (1 << (R)) - 1) {
		// cout << "returned" << endl;
		return dist;
	}

    int res = INF;

    REP(i, R) {
        if (bit >> i & 1) continue;

        res = min(res, solve(bit + (1 << i), i, dist + am[from][i]));
    }

    return res;

}

int main() {

    cin >> N >> M >> R;
	V = N;

    vi r(R);
    REP(i, R) {
		cin >> r[i];
		r[i]--;
	}

	int a, b, c;
    REP(i, M){
        cin >> a >> b >> c;
        a--, b--;

        G[a].push_back(edge(b, c));
        G[b].push_back(edge(a, c));
    }


    REP(i, R){
        dijkstra(r[i]);
        REP(j, R){
            am[i][j] = d[r[j]];
			// cout << i << " " << j << " " << d[j] << endl;
        }
    }

    int res = INF;

    REP(i, R){
        res = min(res, solve( (1 << i), i, 0 ));
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3456