#include "bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)

using V = vector<int>;
using P = pair<int, int>;
struct edge {
	int to, d, i;
};
signed main() {
	int N, M, C; cin >> N >> M >> C;
	vector<vector<edge>> g(N);
	int sum = 0;
	rep(i, M) {
		int a, b, d; cin >> a >> b >> d;
		a--; b--;
		g[a].push_back({ b,d,i });
		g[b].push_back({ a,d,i });
		sum += d;
	}

	int ans = sum;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, 0));
	V dists(N, 1 << 29);
	dists[0] = 0;
	V used(M);
	while (!que.empty()) {
		int pd, pv;
		tie(pd, pv) = que.top(); que.pop();
		for (auto e : g[pv]) {
			if (dists[e.to] <= pd && !used[e.i]) {
				used[e.i] = true;
				sum -= e.d;
				ans = min(ans, C * pd + sum);
			}
			int nd = pd + e.d;
			if (dists[e.to] <= nd) continue;
			dists[e.to] = nd;
			que.push(P(nd, e.to));
		}
	}
	cout << ans << endl;
}