#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef pair pint; typedef pair pli; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; using G=vector>>; int main(){ int n,m,p,q,t; cin>>n>>m>>p>>q>>t; --p;--q; G v(n); rep(i,m){ int a,b,c; cin>>a>>b>>c; --a;--b; v[a].emplace_back(c,b); v[b].emplace_back(c,a); } ll dist[n][n]; rep(i,n)rep(j,n)dist[i][j]=longinf; rep(i,n){ dist[i][i]=0; priority_queue> que; que.emplace(0,i); while(que.size()){ ll d=-que.top().first; int cur=que.top().second; que.pop(); if(d>dist[i][cur])continue; for(auto e : v[cur]){ if(dist[i][e.second]>d+e.first){ dist[i][e.second]=d+e.first; que.emplace(-dist[i][e.second],e.second); } } } } ll ans=-1; ll ret=dist[0][p]+dist[p][q]+dist[q][0]; if(ret<=t){ cout<