#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 50;
const int maxm = 1e6 + 50;
const double eps = 1e-10;
const int max_index = 62;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
const double PI = acos(-1);
inline int read() {
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x;
}
int head[maxn], cnt;
int nxt[maxm], pnt[maxm], cost[maxm];
long long dis[maxn], vis[maxn];
void add_edge(int u, int v, int w) {
  nxt[cnt] = head[u];
  pnt[cnt] = v;
  cost[cnt] = w;
  head[u] = cnt++;
}
int main() {
  int n = read(), m = read(), k = read();
  memset(head, -1, sizeof head);
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read(), w = read();
    add_edge(u, v, w);
    add_edge(v, u, w);
  }
  memset(dis, 0x3f, sizeof dis);
  queue<int> q;
  for (int i = 1; i <= k; i++) {
    int x = read();
    dis[x] = 0;
    q.push(x);
  }
  long long ans = inf;
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; ~i; i = nxt[i]) {
      int v = pnt[i];
      if (dis[v] <= dis[u] + cost[i]) continue;
      dis[v] = dis[u] + cost[i];
      ans = min(dis[v], ans);
      if (vis[v]) continue;
      vis[v] = 1;
      q.push(v);
    }
  }
  if (ans == inf) ans = -1;
  cout << ans << endl;
  return 0;
}
