#include <cstdio>
#include <algorithm>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)

using namespace std;

typedef pair<long long, int> P;

struct E{
	int b, d;
};

int n, m, c;
vector<E> g[(int)1e5];
long long h[(int)1e5];
long long t[(int)1e5];

int main(){
	scanf("%d%d%d", &n, &m, &c);

	rep(i, m){
		int a, b, d;
		scanf("%d%d%d", &a, &b, &d);
		--a;
		--b;
		g[a].push_back(E{b, d});
		g[b].push_back(E{a, d});
	}

	fill(h, h + n, 3e10);

	priority_queue<P, vector<P>, greater<P>> q;
	h[0] = 0;
	q.push(P(0, 0));
	while(!q.empty()){
		auto v = q.top();
		q.pop();
		if(v.first > h[v.second]){
			continue;
		}
		for(auto& x: g[v.second]){
			if(h[v.second] + x.d < h[x.b]){
				h[x.b] = h[v.second] + x.d;
				q.push(P(h[x.b], x.b));
			}
		}
	}

	long long s = 0;
	rep(i, n){
		for(auto& x: g[i]){
			if(i < x.b){
				if(h[i] >= h[x.b]){
					t[i] += x.d;
				}
				else{
					t[x.b] += x.d;
				}
				s += x.d;
			}
		}
	}

	std::vector<pair<long long, long long>> v;
	rep(i, n){
		v.push_back({h[i], t[i]});
	}
	stable_sort(v.begin(), v.end());

	rep(i, n){
		if(i != 0){
			v[i].second += v[i - 1].second;
		}
	}

	long long result;
	rep(i, n){
		if(i == 0 || result > v[i].first * c + s - v[i].second){
			result = v[i].first * c + s - v[i].second;
		}
	}
	printf("%lld\n", result);
	return 0;
}