#include <bits/stdc++.h>
using namespace std;

typedef long long lint;
typedef pair<lint, int> Pr;

const lint INF = 1ll << 56;

int n, m, c;
vector<Pr> g[100000];
lint dsum = 0ll;

lint solve()
{
	lint res = INF;
	
	vector<lint> dist(n, INF);
	dist[0] = 0ll;
	vector<bool> vis(n, false);
	
	priority_queue<Pr, vector<Pr>, greater<Pr>> pq;
	pq.push(Pr(0ll, 0));
	while (pq.size()){
		int pos = pq.top().second;
		lint sum = pq.top().first;
		pq.pop();
		if (dist[pos] < sum) continue;
		vis[pos] = true;
		
		for (Pr &e : g[pos]){
			int to = e.second;
			lint cost = e.first;
			if (dist[to] > sum + cost){
				dist[to] = sum + cost;
				pq.push(Pr(sum + cost, to));
			}
			if (vis[to]){
				dsum -= cost;
			}
		}
		
		res = min(res, dist[pos] * c + dsum);
	}
	
	return res;
}

int main()
{
	scanf("%d %d %d", &n, &m, &c);
	for (int i = 0; i < m; i++){
		int a, b, d;
		scanf("%d %d %d", &a, &b, &d);
		g[--a].push_back(Pr(d, --b));
		g[b].push_back(Pr(d, a));
		dsum += d;
	}
	
	cout << solve() << endl;
	
	return 0;
}