#include using namespace std; using ll=long long; #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} const ll INF=1LL<<60; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N,M,L; ll S,E; cin>>N>>M>>L>>S>>E; vector>>G(N); for(int i=0;i>a>>b>>t; a--; b--; G[a].push_back(make_pair(b,t)); G[b].push_back(make_pair(a,t)); } vectorT(L); for(int i=0;i>T[i]; T[i]--; } auto f=[&](int s)-> vector { priority_queue,vector>,greater>>pq; pq.push(make_pair(0,s)); vectordist(N,INF); dist[s]=0; while(pq.size()){ auto[c,x]=pq.top(); pq.pop(); if(dist[x]ds=f(0),dt=f(N-1); if(ds[N-1]==INF){ cout<<-1<<"\n"; }else{ ll ans=INF; for(int i=0;i