#include<bits/stdc++.h>
using namespace std;

//#define DEBUG
#define int long long
#define INF 1000000000
#define REP(i,n) for(int i=1;i<=n;i++)
typedef pair<int,int> P;
struct E {int to,cost;};
int n,m,c;
vector<E> G[100002];
int D[100002];
vector<P> V;

signed main(){
  cin>>n>>m>>c;
  int dsum=0;
  REP(i,m){
    int a,b,d;
    cin>>a>>b>>d;
    G[a].push_back({b,d});
    G[b].push_back({a,d});
    dsum+=d;
  }
  REP(i,n)D[i]=INF;
  queue<int> que;
  que.push(1);
  D[1]=0;
  while(!que.empty()){
    int h=que.front();que.pop();
    for(E e : G[h]){
      if(D[e.to]>D[h]+e.cost){
        D[e.to]=D[h]+e.cost;
        que.push(e.to);
      }
    }
  }
  REP(i,n){
    V.push_back(P(D[i],i));
  }
  sort(V.begin(),V.end());
  int x=0;
  int ans=dsum;
  int sub=0;
  REP(i,n-1){
    if(x!=V[i].first){
      ans=min(ans,c*x+dsum-sub/2);
      x=V[i].first;
    }
    for(E e : G[V[i].second]){
      if(D[e.to]<x){
        dsum-=e.cost;
      }else if(D[e.to]==x){
        sub+=e.cost;
      }
    }
    #ifdef DEBUG
    cout<<"x:"<<x<<" v1:"<<V[i].first;
    cout<<" dsum: "<<dsum<<endl;
    #endif
  }
  ans=min(ans,c*x);
  cout<<ans<<endl;
  #ifdef DEBUG
  REP(i,n)cout<<D[i]<<" ";
  cout<<endl;
  for(P p : V){
    cout<<p.first<<" "<<p.second<<endl;
  }
  #endif
  return 0;
}