#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<functional>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int N, M, C;
vector<vector<P>> edge;
ll ans = 222222222222;
ll edgect = 0;

void djk() {
	ll d[100000];
	bool memo[100000] = {};
	for (int i = 0; i < N; i++)d[i] = 100000000007;
	d[0] = 0;
	memo[0] = true;
	priority_queue<P, vector<P>, greater<P>> pq;
	pq.push(P(0, 0));
	while (pq.size()) {
		auto tmp = pq.top(); pq.pop();
		memo[tmp.second] = true;

		if (tmp.first > d[tmp.second])continue;
		
		//cout << d[1] << endl;

		for (int i = 0; i < edge[tmp.second].size(); i++) {
			auto to = edge[tmp.second][i];
			if (memo[to.first]) {
				edgect -= to.second;
			}
		}

		ans = min(ans, d[tmp.second] * C + edgect);

		for (int i = 0; i < edge[tmp.second].size(); i++) {
			auto to = edge[tmp.second][i];
			if (d[to.first] > d[tmp.second] + to.second) {
				d[to.first] = d[tmp.second] + to.second;
				pq.push(P(d[to.first], to.first));
			}
		}

	}
}

int main() {
	cin >> N >> M >> C;
	edge.resize(N);
	for (int i = 0; i < M; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		edge[a].push_back(P(b, c));
		edge[b].push_back(P(a, c));
		edgect += c;
	}
	
	djk();
	cout << ans << endl;
	return 0;
}