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

using namespace std;

typedef long long ll;

#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 Would

#define you

#define please





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);



	

	//順列生成なんてライブラリがあるんですね版

	int N, M, R;

	cin >> N >> M >> R;

	int r[8];

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

	sort(r, r + R);



	int D[201][201];

	rep1(i, 200) {

		rep1(ii, 200) {

			D[i][ii] = 30000000;

		}

	}



	rep(i, M) {

		int A, B, C;

		cin >> A >> B >> C;

		D[A][B] = C;

		D[B][A] = C;

	}



	rep1(k, N) {

		rep1(i, N) {

			rep1(j, N) {

				if (D[i][j] > D[i][k] + D[k][j]) D[i][j] = D[i][k] + D[k][j];

			}

		}

	}



	int kumiawase = 1;

	rep1(i, R) kumiawase *= i;



	int saishou = 1e9;

	rep(i, kumiawase) {

		int goukei = 0;

		rep(i, R - 1) goukei += D[r[i]][r[i + 1]];

		saishou = min(saishou, goukei);



		next_permutation(r, r + R);

	}



	co(saishou);



	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: