#include <queue>
#include <cstdio>
#include <vector>
using namespace std;
struct edge { int to; long long cost; };
bool operator<(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}
int N, M, C, a, b, c; bool vis[100009]; long long d[100009]; vector<edge> G[100009];
int main() {
	scanf("%d%d%d", &N, &M, &C);
	long long sum = 0;
	for (int i = 0; i < M; i++) {
		scanf("%d%d%d", &a, &b, &c); a--, b--;
		G[a].push_back(edge{ b, c });
		G[b].push_back(edge{ a, c });
		sum += c;
	}
	long long ret = sum;
	fill(d + 1, d + N, 1LL << 60);
	priority_queue<edge> que; que.push({ 0, 0 });
	while (!que.empty()) {
		edge u = que.top(); que.pop();
		if (!vis[u.to]) {
			vis[u.to] = true;
			for (edge e : G[u.to]) {
				if (vis[e.to]) sum -= e.cost;
			}
			ret = min(ret, C * d[u.to] + sum);
		}
		for (edge e : G[u.to]) {
			if (d[e.to] > d[u.to] + e.cost) {
				d[e.to] = d[u.to] + e.cost;
				que.push(edge{ e.to, -d[e.to] });
			}
		}
	}
	printf("%lld\n", ret);
	return 0;
}