#include using namespace std; using ll=long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const long long mod=998244353; const long long mod100=1000000007; int main(){ cin.tie(0)->sync_with_stdio(0); cout.tie(0); int N,M; ll C; cin>>N>>M>>C; vector>G[N+1]; int u[M+1],v[M+1]; ll w[M+1]; for(int i=1;i<=M;i++){ cin>>u[i]>>v[i]>>w[i]; G[u[i]].push_back({w[i]+C,v[i]}); G[v[i]].push_back({w[i]+C,u[i]}); } bool already[N*2+1]; ll dist1[N+1]; for(int i=1;i<=N;i++){ already[i]=0; dist1[i]=2e18; } priority_queue,vector>,greater>>PQ; PQ.push({0,1}); dist1[1]=0; while(!PQ.empty()){ int pos=PQ.top().second; ll cost=PQ.top().first; PQ.pop(); if(already[pos]) continue; already[pos]=1; for(int i=0;inext_cost){ dist1[nex]=next_cost; PQ.push({next_cost,nex}); } } } ll dist2[N*2+1]; for(int i=1;i<=N*2;i++){ dist2[i]=2e18; already[i]=0; } PQ.push({0,N}); dist2[N]=0; while(!PQ.empty()){ int pos=PQ.top().second; ll cost=PQ.top().first; PQ.pop(); if(already[pos]) continue; already[pos]=1; if(pos<=N){ for(int i=0;inext_cost){ dist2[nex]=next_cost; PQ.push({next_cost,nex}); } if(already[nex+N]==0 && dist2[nex+N]>cost+C){ dist2[nex+N]=cost+C; PQ.push({cost+C,nex+N}); } } } else{ pos-=N; for(int i=0;inext_cost){ dist2[nex+N]=next_cost; PQ.push({next_cost,nex+N}); } } } } for(int i=2;i<=N;i++){ ll ans=min(dist1[N],dist1[i]+dist2[i+N]); cout<