#include<stdio.h>
#include<string.h>
#include<stdbool.h>
#define N 1010
#define M 21010
#define INF 0x3f3f3f3f
int n, m, s;
int p, q, t, w;
int dist[N];
int que[N];
bool inQue[N];
int head, tail;
int h[N], cnt;
int start;
struct edge{
int to;
int next;
int weight;
}E[M];
void add(int v, int w, int weight){
E[++cnt].next = h[v];
E[cnt].to = w;
E[cnt].weight = weight;
h[v] = cnt;
}
int spfa(int x){
memset(dist, 0x3f, sizeof dist);
memset(inQue, false, sizeof inQue);
head = 0, tail = 0;
dist[x] = 0;
que[++tail] = x, inQue[x] = true;
while(head != tail){
int t = que[++head];
head %= N;
inQue[t] = false;
for(int i = h[t]; i != -1; i = E[i].next){
int u = E[i].to;
if(dist[u] > dist[t] + E[i].weight){
dist[u] = dist[t] + E[i].weight;
if(!inQue[u]){
que[++tail] = u;
tail %= N;
inQue[u] = true;
}
}
}
}
if(dist[s] == INF) return -1;
else return dist[s];
}
int main(){
while(scanf("%d %d %d", &n, &m, &s) != EOF){
memset(h, -1, sizeof h);
cnt = 0;
for(int i = 1; i <= m; i++){
scanf("%d %d %d", &p, &q, &t);
add(p, q, t);
}
scanf("%d", &w);
for(int i = 1; i <= w; i++){
scanf("%d", &start);
add(0, start, 0);
}
printf("%d\n", spfa(0));
}
return 0;
}