#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,int> P;
typedef pair<LL,P> PP;
const LL INF=1LL<<60;
vector<P> G[100000];
vector<PP> E;
LL dist[100000];
map<LL,LL> m;
int main() {
    int N,M;
    LL C;
    scanf("%d %d %lld",&N,&M,&C);
    for(int i=0;i<M;i++) {
        int A,B;
        LL D;
        scanf("%d %d %lld",&A,&B,&D); A--;B--;
        G[A].push_back(P(B,D));
        G[B].push_back(P(A,D));
        E.push_back(PP(D,P(A,B)));
    }
    priority_queue<P,vector<P>,greater<P> > Q;
    fill((LL*)dist,(LL*)(dist+100000),INF);
    Q.push(P(0,0));
    dist[0]=0;
    while(!Q.empty()) {
        P p=Q.top();Q.pop();
        int x=p.second;
        LL d=p.first;
        if(dist[x]<d) continue;
        for(int i=0;i<G[x].size();i++) {
            int to=G[x][i].first;
            LL cost=G[x][i].second;
            if(dist[x]+cost<dist[to]) {
                dist[to]=dist[x]+cost;
                Q.push(P(dist[to],to));
            }
        }
    }
    LL sum=0;
    for(int i=0;i<E.size();i++) {
        LL d=E[i].first;
        int a=E[i].second.first;
        int b=E[i].second.second;
        if(dist[a]>dist[b]) swap(a,b);
        m[dist[b]]+=d;
        sum+=d;
    }
    vector<LL> V;
    for(int i=0;i<N;i++) {
        V.push_back(dist[i]);
    }
    sort(V.begin(),V.end());
    V.erase(unique(V.begin(),V.end()),V.end());
    LL ans=sum;
    for(int i=0;i<V.size();i++) {
        sum-=m[V[i]];
        ans=min(ans,sum+C*V[i]);
    } 
    printf("%lld\n",ans);  
}