#include<bits/stdc++.h>
#define INF 0x3f3f3f3f3f3f3f3f
#define rep(i,n)for(ll i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll>P;

vector<P>E[100000];
ll d[100000];

struct st {
	ll a, b, d;
};
st v[200000];
int main() {
	ll n, m, c; scanf("%lld%lld%lld", &n, &m, &c);
	rep(i, m) {
		ll a, b, d; scanf("%lld%lld%lld", &a, &b, &d); a--; b--;
		E[a].push_back(P(d, b)); E[b].push_back(P(d, a));
		v[i] = { a,b,d };
	}
	memset(d, 0x3f, sizeof(d));
	priority_queue<P, vector<P>, greater<P>>que;
	d[0] = 0;
	que.push(P(0, 0));
	while (!que.empty()) {
		P p = que.top(); que.pop();
		if (p.first != d[p.second])continue;
		for (P v : E[p.second]) {
			if (d[v.second] > p.first + v.first) {
				d[v.second] = p.first + v.first;
				que.push(P(d[v.second], v.second));
			}
		}
	}
	sort(v, v + m, [&](st a, st b) {return max(d[a.a], d[a.b]) < max(d[b.a], d[b.b]); });
	ll sum = 0; rep(i, m)sum += v[i].d;
	ll Min = sum;
	rep(i, m) {
		sum -= v[i].d;
		Min = min(Min, sum + max(d[v[i].a], d[v[i].b])*c);
	}
	printf("%lld\n", Min);
}