#include <bits/stdc++.h>
using namespace std;
#define int long long
inline int read() {
int x = 0, f = 0; char c = 0;
while (!isdigit(c)) f |= c == '-', c = getchar();
while (isdigit(c)) x = (x << 3) + (x << 1) + (c & 15), c = getchar();
return f ? -x : x;
}
#define N 400010
#define INF (1e17)
#define PII pair<int, int>
int n, m, p, a[N], hd[N], cnt = 1, dis[N], from[N], res[N], vis[N];
struct node {
int y, v, to;
node(int _y = 0, int _v = 0, int _to = 0) {
y = _y, v = _v, to = _to;
}
}e[N];
void addE(int x, int y, int v) {
e[++ cnt] = node(y, v, hd[x]), hd[x] = cnt;
}
void Dij() {
priority_queue<PII, vector<PII>, greater<PII> > pr;
for (int i = 1; i <= n; i ++) dis[i] = INF;
for (int i = 1; i <= p; i ++) {
dis[a[i]] = 0, from[a[i]] = a[i];
pr.push(make_pair(0, a[i]));
}
while (!pr.empty()) {
int x = pr.top().second; pr.pop();
if (vis[x]) continue; else vis[x] = 1;
for (int i = hd[x]; i; i = e[i].to) {
int y = e[i].y, v = e[i].v;
if (dis[x] + v < dis[y]) {
dis[y] = dis[x] + v;
from[y] = from[x];
pr.push(make_pair(dis[y], y));
}
}
}
}
signed main() {
n = read(), m = read(), p = read();
for (int i = 1; i <= p; i ++) {
a[i] = read();
}
for (int i = 1; i <= m; i ++) {
int x = read(), y = read(), v = read();
addE(x, y, v), addE(y, x, v);
}
Dij();
for (int i = 1; i <= n; i ++) res[i] = INF;
for (int i = 0; i <= cnt; i += 2) {
int x = e[i ^ 1].y, y = e[i].y, v = e[i].v;
if (from[x] == from[y]) continue;
res[from[x]] = min(res[from[x]], dis[x] + dis[y] + v);
res[from[y]] = min(res[from[y]], dis[x] + dis[y] + v);
}
for (int i = 1; i <= p; i ++) {
printf("%lld ", res[a[i]]);
}
puts("");
return 0;
}