#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 vector get(vector>> &G, int s){ int N = G.size(); vector d(N,Inf64); d[s] = 0; priority_queue,vector>,greater>> pq; pq.push({0,s}); while(!pq.empty()){ auto [c,v] = pq.top(); pq.pop(); if(d[v] < c) continue; for(auto [u,w] : G[v]){ if(d[u] > d[v] + w){ d[u] = d[v] + w; pq.push({d[u],u}); } } } return d; } int main(){ int N,M,L,S,E; cin>>N>>M>>L>>S>>E; vector>> G(N); rep(i,M){ int a,b; long long c; cin>>a>>b>>c; a--,b--; G[a].push_back({b,c}); G[b].push_back({a,c}); } auto dx = get(G,0), dy = get(G,N-1); long long ans = Inf64; E += S; rep(i,L){ long long t; cin>>t; t--; long long d0 = dx[t]; if(d0 >= E)continue; if(dy[t]==Inf64)continue; d0 = max(d0,(long long)S); ans = min(ans,d0+1+dy[t]); } if(ans==Inf64)ans = -1; cout<