#include #include #include #include using namespace std; typedef long long ll; typedef pair Pa; struct edge{ ll to,dist; }; ll N,M,P,Q,T; ll inf = 1e18; vector> v(2010); void Dijkstra(int s,vector& dp){ priority_queue Q; dp[s] = 0; Q.push({0,s}); while(!Q.empty()){ Pa p = Q.top(); Q.pop(); if(dp[p.second]p.first+x.dist){ dp[x.to] = p.first+x.dist; Q.push({dp[x.to],x.to}); } } } } int main(){ cin >> N >> M >> P >> Q >> T; ll a,b,c; for(int i=0;i dp1(N+1,inf),dp2(N+1,inf),dp3(N+1,inf); Dijkstra(1,dp1); Dijkstra(P,dp2); Dijkstra(Q,dp3); ll ans = -1; for(int i=1;i