#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>

using namespace std;

#define INF (1LL << 60)

typedef long long Int;
typedef pair<Int, Int> P;

priority_queue<P, vector<P>, greater<P> > qp;

Int n,m,c,dist[100001];
vector<P> edge[100001];
P node,tmp;

void dijkstra(Int start){
    Int from,to,i,d;
    fill(dist,dist+n+1,INF);
    node.first = 0LL;
    node.second = start;
    qp.push(node);
    while(!qp.empty()){
        node = qp.top();
        qp.pop();
        from = node.second;
        d = node.first;
        if(d>dist[from]){
            continue;
        }
        dist[from] = d;
        for(i=(edge[from].size())-1; i>=0; i--){
            tmp = edge[from][i];
            to = tmp.first;
            d = tmp.second;
            if(dist[to]>dist[from]+d){
                dist[to] = dist[from]+d;
                tmp.first = dist[to];
                tmp.second = to;
                qp.push(tmp);
            }
        }
    }
}

int main(void){
    Int i,a,b,d,ans=INF,now,sum=0LL;
    scanf("%lld%lld%lld",&n,&m,&c);
    for(i=0LL; i<m; i++){
        scanf("%lld%lld%lld",&a,&b,&d);
        tmp.second=d;
        tmp.first=b;
        edge[a].push_back(tmp);
        tmp.first=a;
        edge[b].push_back(tmp);
        sum+=d;
    }
    dijkstra(1LL);
    for(i=1LL; i<=n; i++){
        tmp.first = dist[i];
        tmp.second = i;
        qp.push(tmp);
    }
    while(!qp.empty()){
        node = qp.top();
        qp.pop();
        now = node.second;
        for(i=(edge[now].size())-1; i>=0; i--){
            tmp = edge[now][i];
            if(dist[tmp.first]==-1){
                sum -= tmp.second;
            }
        }
        ans = min(ans,dist[now]*c+sum);
        dist[now]=-1;
    }
    printf("%lld\n",ans);
    return 0;
}