#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
const int INF=1001001001001001;
int N,M,C;//?????´??? N ???????????? M ??¬???????????°???????????´?????????????????¢????????´??°??? C
struct node{
    int to;
    int cost;
};
struct road{
    int d;
    int t1,t2;
};
int m=0;//???????????????????¨??????????
road roads[200002];//???????????±?????????????????????
vector<pair<int,int> > R;//?????????????????????????????????????????????????????????????????¢??¨??????????????????????????????????????¨
vector<node> nodes[100002];//dijkstra??¨
int d[100002];//???????????¢??????
vector<int > ds;//?????¢????????????????????¨
class JOIpark{
    private:
    void dijkstra(int s){
        fill(d,&d[N],INF);
        priority_queue< pair<int,int> , vector< pair<int,int> > ,greater<pair<int,int> > > que;
        que.push( mp(0,s) );
        while(que.size() ){
            pair<int,int> p=que.top(); que.pop();
            int v=p.second;int c=p.first;
            if(d[v]<c)continue;
            d[v]=c;
            ds.push_back(d[v] );//////////
            rep(i,nodes[v].size()){
                int t=nodes[v][i].to;
                if(d[v]+nodes[v][i].cost<d[t]){
                    d[t]=d[v]+nodes[v][i].cost;
                    que.push(mp(d[t],t) );
                }
            }
        }
    }
    public:
    int solve(){
        int ans=INF;
        scanf("%lld %lld %lld",&N,&M,&C);
        
        rep(i,M){
            int a,b,d;
            scanf("%lld %lld %lld",&a,&b,&d);
            m+=d;
            a--;b--;
            roads[i].d=d;roads[i].t1=a;roads[i].t2=b;
            node n;
            n.to=b;n.cost=d;
            nodes[a].push_back(n);
            n.to=a;
            nodes[b].push_back(n);
        }
        dijkstra(0);
        sort(ds.begin(),ds.end() );
        rep(i,M){//??????????????????????????¢???????????????x??\???????????¢???????????¨?????????????¶??????????????????¨?????????x?????????
            int a=roads[i].t1;int b=roads[i].t2;
            int k=max(d[a],d[b]);
            R.push_back( mp(k,roads[i].d) );
        }
        sort(R.begin(),R.end());
        int t=0;//??????????????????????????????
        rep(i,N){
            if(d[i]==d[i+1])continue;//???????????¢???????????????????????????
            int x=ds[i];
            int sans=0;
            sans=C*x;
            for(;R[t].first<=x&&t<R.size();t++){
                m-=R[t].second;//???????¶??????????????????¨?????¨???
            }
            sans+=m;
            ans=min(sans,ans);
        }
        return ans;
    }
};
signed main(void){
    JOIpark ans;
    printf("%lld\n",ans.solve());
}