#include #include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) template bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; using mint = atcoder::modint1000000007; int main(){ int n,m,l,s,e; cin>>n>>m>>l>>s>>e; vector>> g(n); rep(i,0,m){ int a,b,t; cin>>a>>b>>t; a--; b--; g.at(a).push_back({b,t}); g.at(b).push_back({a,t}); } vector t(l); rep(i,0,l) cin>>t.at(i),t.at(i)--; vector dist1(n,1e18),dist2(n,1e18); priority_queue,vector>,greater>> pq; { pq.push({0,0}); while(!pq.empty()){ auto[cs,nw]=pq.top(); pq.pop(); if(dist1.at(nw)!=1e18) continue; dist1.at(nw)=cs; for(auto[nx,ad]:g.at(nw)){ if(dist1.at(nx)!=1e18) continue; pq.push({cs+ad,nx}); } } } { pq.push({0,n-1}); while(!pq.empty()){ auto[cs,nw]=pq.top(); pq.pop(); if(dist2.at(nw)!=1e18) continue; dist2.at(nw)=cs; for(auto[nx,ad]:g.at(nw)){ if(dist2.at(nx)!=1e18) continue; pq.push({cs+ad,nx}); } } } ll ans=1e18; rep(i,0,l){ int d=t.at(i); if(dist1.at(d)