#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <set>
#include <queue>

using namespace std;

#define INF (100000000000000000LL)

typedef pair<long long,int> P; // cost , park

int main() {
    int N,M,C;
    cin >> N >> M >> C;

    vector<P> to[N];
    long long total=0;
    for(int i=0; i<M; ++i) {
        int A,B;
        long long D;
        cin >> A >> B >> D;
        to[A-1].push_back(P(D,B-1));
        to[B-1].push_back(P(D,A-1));
        total+=D;
    }

    unordered_set<int> visit;
    priority_queue<P,vector<P>,greater<P> > q; // cost, park

    vector<P> dist(N);
    for(int i=0; i<N; ++i) dist[i]=make_pair(INF,i);

    q.push(P(0,0));
    while(visit.size()!=N) {
        P p=q.top(); q.pop();
        if(visit.count(p.second)!=0) continue;
        visit.insert(p.second);
        dist[p.second].first=p.first;
        for(auto x : to[p.second]) {
            if(visit.count(x.second)!=0 || dist[x.second].first<p.first+x.first) continue;
            dist[x.second].first=p.first+x.first;
            q.push(P(dist[x.second].first,x.second));
        }
    }

    sort(dist.begin(),dist.end());
    vector<long long> distsum(N);
    visit.clear();
    distsum[0]=0;
    visit.insert(0);
    for(int i=1; i<N; ++i) {
        distsum[i]=distsum[i-1];
        visit.insert(dist[i].second);
        for(auto x : to[dist[i].second]) {
            if(visit.count(x.second)!=0) distsum[i]+=x.first;
        }
    }

    long long ans=total;

    for(int i=1; i<N; ++i) {
        ans=min(ans,C*dist[i].first+total-distsum[i]);
    }

    cout << ans << endl;

    return 0;
}
