#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;
typedef long long int ll;

struct Edge{
	int to; ll dist;
	Edge(){}
	Edge(int to,ll dist):to(to),dist(dist){}
};

template <class E>
using Graph = vector<vector<E>>;
 
template<class D, D INF>
struct Dijkstra {
    vector<D> res; //res[i] = sからiまでの最短距離
    
    template<class E>
    Dijkstra(const Graph<E> &g, int s) {
        int V = (int)g.size();
        res = vector<D>(V, INF);
        
        using P = pair<D, int>;
        priority_queue<P, vector<P>, greater<P>> q;
        q.push(P(0, s));
        res[s] = 0;
        while (!q.empty()) {
            P p = q.top(); q.pop();
            if (res[p.second] < p.first) continue;
            for (E e: g[p.second]) {
                if (p.first+e.dist < res[e.to]) {
                    res[e.to] = p.first+e.dist;
                    q.push(P(res[e.to], e.to));
                }
            }
        }
    }
};
int a[200100],b[200100],d[200100];
ll sum[100100];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m; cin >> n >> m;
	Graph<Edge> g(n);
	ll c; cin >> c;
	for(int i=0;i<m;i++){
		cin >> a[i] >> b[i] >> d[i];
		a[i]--; b[i]--;
		g[a[i]].push_back(Edge(b[i],d[i]));
		g[b[i]].push_back(Edge(a[i],d[i]));
	}
	Dijkstra<ll,(ll)1e15> di(g,0);
	for(int i=0;i<m;i++){
		if(di.res[a[i]]<di.res[b[i]])sum[b[i]]+=d[i];
		else sum[a[i]]+=d[i];
	}
	vector<pair<ll,int>> v;
	for(int i=0;i<n;i++){
		v.push_back({di.res[i],i});
	}
	sort(v.rbegin(),v.rend());
	ll ans=1e15;
	ll cnt=0;
	for(int i=0;i<n;i++){
		ans=min(ans,cnt+v[i].first*c);
		cnt+=sum[v[i].second];
	}
	ans=min(ans,cnt);
	cout << ans << endl;
}

