#include using namespace std; typedef long long ll; typedef pair pll; int main(){ ll inf=1000000000000000000; ll n,m,l;cin>>n>>m>>l; l--; ll cn=0; ll t[n]; for(ll i=0;i>t[i]; if(t[i]>0)cn++; } if(cn==1){ cout<<0< v[n]; ll cost[n][n]; for(ll i=0;i>a>>b>>c; a--;b--; v[a].push_back(b); v[b].push_back(a); cost[a][b]=min(cost[a][b],c); cost[b][a]=min(cost[a][b],c); } for(ll i=0;i,greater >q; q.push(make_pair((ll)0,i)); d[i][i]=0; bool used[n];fill(used,used+n,false); while(q.size()>0){ pll p=q.top();q.pop(); ll pf=p.first,ps=p.second; //cout<pf+cost[ps][now]){ d[i][now]=pf+cost[ps][now]; q.push(make_pair(d[i][now],now)); } } } } ll ans=inf; for(ll i=0;i