/**
* author: mamion
* created: Sunday 2024-10-27
**/
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include<cpp-dump-main/cpp-dump.hpp>
#define debug(...) cpp_dump(__VA_ARGS__)
CPP_DUMP_SET_OPTION_GLOBAL(max_line_width, 100);
CPP_DUMP_SET_OPTION_GLOBAL(log_label_func, cpp_dump::log_label::filename());
CPP_DUMP_SET_OPTION_GLOBAL(enable_asterisk, true);
#else
#define debug(...)
#endif // LOCAL
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1e9 + 7;
template<class T> bool ckmin(T &a, T b) {return a < b ? 1 : a = b, 0;}
template<class T> bool ckmax(T &a, T b) {return a > b ? 1 : a = b, 0;}
template<class T> void add(T &a, T b, T m = mod) {a = (a + b) % m;};
template<class T> void mul(T &a, T b, T m = mod) {a = a * b % m;}
const ll inf = 1e18;
const int N = 1e5 + 10;
int n, m, k, bank[20];
vector<pair<int, int>> adj[N];
ll d[20][N], dp[1 << 20];
void dijkstra(int i, int src) {
memset(d[i], 0x3f, sizeof d[i]); d[i][src] = 0;
priority_queue<pair<ll, int>> pq; pq.push({0, src});
while (pq.size()) {
int u = pq.top().second; ll dist = -pq.top().first; pq.pop();
if (d[i][u] != dist) continue;
for (auto p : adj[u]) {
int v = p.first, w = p.second;
if (d[i][v] > d[i][u] + w) {
d[i][v] = d[i][u] + w;
pq.push({-d[i][v], v});
}
}
}
}
void solve() {
cin >> n >> m >> k;
for (int i = 0; i < k; i++) cin >> bank[i];
for (int i = 0; i < m; i++) {
int u, v, w; cin >> u >> v >> w;
adj[u].push_back({v, w});
adj[v].push_back({u, w});
}
for (int i = 0; i < k; i++) dijkstra(i, bank[i]);
memset(dp, 0x3f, sizeof dp);
for (int i = 0; i < k; i++) dp[1 << i] = 0;
for (int mask = 1; mask < (1 << k); mask++) {
for (int i = 0; i < k; i++) if (mask >> i & 1) {
for (int j = 0; j < k; j++) if ((mask >> j & 1) == 0) {
ckmin(dp[mask | (1 << j)], dp[mask] + d[i][bank[j]]);
}
}
}
cout << dp[(1 << k) - 1];
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef LOCAL
freopen("main.inp", "r", stdin);
freopen("main.out", "w", stdout);
#else
#define file "name"
if (fopen(file".inp", "r")) {
freopen(file".inp", "r", stdin);
freopen(file".out", "w", stdout);
}
#endif // LOCAL
int T; T = 1; if (0) cin >> T;
for (int i = 1; i <= T; i++)
{
solve();
}
}
LyoqCiAqICAgIGF1dGhvcjogIG1hbWlvbgogKiAgICBjcmVhdGVkOiBTdW5kYXkgMjAyNC0xMC0yNwoqKi8KCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojaWZkZWYgTE9DQUwKI2luY2x1ZGU8Y3BwLWR1bXAtbWFpbi9jcHAtZHVtcC5ocHA+CiNkZWZpbmUgZGVidWcoLi4uKSBjcHBfZHVtcChfX1ZBX0FSR1NfXykKQ1BQX0RVTVBfU0VUX09QVElPTl9HTE9CQUwobWF4X2xpbmVfd2lkdGgsIDEwMCk7CkNQUF9EVU1QX1NFVF9PUFRJT05fR0xPQkFMKGxvZ19sYWJlbF9mdW5jLCBjcHBfZHVtcDo6bG9nX2xhYmVsOjpmaWxlbmFtZSgpKTsKQ1BQX0RVTVBfU0VUX09QVElPTl9HTE9CQUwoZW5hYmxlX2FzdGVyaXNrLCB0cnVlKTsKI2Vsc2UKI2RlZmluZSBkZWJ1ZyguLi4pCiNlbmRpZiAvLyBMT0NBTAoKdHlwZWRlZiBsb25nIGxvbmcgbGw7CnR5cGVkZWYgdW5zaWduZWQgbG9uZyBsb25nIHVsbDsKdHlwZWRlZiBsb25nIGRvdWJsZSBsZDsKCmNvbnN0IGxsIG1vZCA9IDFlOSArIDc7CnRlbXBsYXRlPGNsYXNzIFQ+IGJvb2wgY2ttaW4oVCAmYSwgVCBiKSB7cmV0dXJuIGEgPCBiID8gMSA6IGEgPSBiLCAwO30KdGVtc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