#include #include #include using namespace std; using ll = long long; #include int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n,m,l; cin>>n>>m>>l; vector t(n); for(int i = 0;i>t[i]; { int cnt = 0; for(int i = 0;i>> g(n); for(int i = 0;i>u>>v>>c; u--;v--; g[u].push_back(make_pair(v,c)); g[v].push_back(make_pair(u,c)); } ll ans = 1e18; l--; vector> dis(n,vector(n,1e18)); for(int i = 0;i; priority_queue,greater> que; que.push({0,i}); while(que.size()){ auto now = que.top(); que.pop(); int ni = now.second; if(dis[i][ni]!=now.first) continue; for(auto itr:g[ni]){ int to = itr.first; ll cost = dis[i][ni] + itr.second; if(dis[i][to]<=cost) continue; dis[i][to] = cost; que.push(make_pair(cost,to)); } } } for(int i = 0;i