// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll; 

#define PT pair<int, int>

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



int N, M, R;

int E[201][201];

int D[8][201];

int r[8];

int kotae;

int ima;

bool v[8];

void sagasu(int n, int prev) {

	if (n == R) kotae = min(kotae, ima);

	else {

		rep(i, R) {

			if (!v[i]) {

				v[i] = 1;

				if (prev >= 0) ima += D[prev][r[i]];

				sagasu(n + 1, i);

				if (prev >= 0) ima -= D[prev][r[i]];

				v[i] = 0;

			}

		}

	}

}



int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);





	cin >> N >> M >> R;

	rep(i, R) cin >> r[i];



	rep1(i, N) {

		rep1(j, N) E[i][j] = 1e9;

		E[i][i] = 0;

	}

	rep(i, M) {

		int a, b, c;

		cin >> a >> b >> c;

		E[a][b] = c;

		E[b][a] = c;

	}



	rep(i, R) rep1(j, N) D[i][j] = 1e9;

	rep(i, R) D[i][r[i]] = 0;



	priority_queue<PT, vector<PT>, greater<PT>> que;



	rep(k, R) {

		que.push(mp(0, r[k]));

		while (que.size()) {

			PT p = que.top();

			que.pop();

			int i = p.second;

			if (D[k][i] != p.first) continue;

			rep1(j, N) {

				ll d = D[k][i] + E[i][j];

				if (D[k][j] > d) {

					D[k][j] = d;

					que.push(mp(d, j));

				}

			}

		}

	}



	kotae = 1e9;

	sagasu(0, -1);



	co(kotae);



	Would you please return 0;

}

// Optimized solution to the same problem (faster):
//#include<bits/stdc++.h>

#include<cstdio>

#include<queue>

#include<algorithm>



using namespace std;

typedef long long ll; 

#define PT pair<int, int>

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



int N, M, R;

int E[201][201];

int D[8][201];

int r[8];

int kotae;

int ima;

bool v[8];

void sagasu(int n, int prev) {

	if (n == R) kotae = min(kotae, ima);

	else {

		rep(i, R) {

			if (!v[i]) {

				v[i] = 1;

				if (prev >= 0) ima += D[prev][r[i]];

				sagasu(n + 1, i);

				if (prev >= 0) ima -= D[prev][r[i]];

				v[i] = 0;

			}

		}

	}

}



const int cm = 1 << 17;

char cn[cm], * ci = cn + cm, ct;

inline char getcha() {

	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }

	return *ci++;

}

inline int getint() {

	int A = 0;

	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';

	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';

	return A;

}



int main() {

	//cin.tie(0);

	//ios::sync_with_stdio(false);





	N = getint();

	M = getint();

	R = getint();

	rep(i, R) r[i] = getint();



	rep1(i, N) {

		rep1(j, N) E[i][j] = 1e9;

		E[i][i] = 0;

	}

	rep(i, M) {

		int a = getint(), b = getint(), c = getint();

		E[a][b] = c;

		E[b][a] = c;

	}



	rep(i, R) rep1(j, N) D[i][j] = 1e9;

	rep(i, R) D[i][r[i]] = 0;



	priority_queue<PT, vector<PT>, greater<PT>> que;



	rep(k, R) {

		que.push(mp(0, r[k]));

		while (que.size()) {

			PT p = que.top();

			que.pop();

			int i = p.second;

			if (D[k][i] != p.first) continue;

			rep1(j, N) {

				ll d = D[k][i] + E[i][j];

				if (D[k][j] > d) {

					D[k][j] = d;

					que.push(mp(d, j));

				}

			}

		}

	}



	kotae = 1e9;

	sagasu(0, -1);



	printf("%d", kotae);



	Would you please return 0;

}

// Fastest known solution for this problem: