#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 0, 1 },{ -1 ,1 },{ -1, 0 },
	{ -1 ,-1 },{ 0,-1 },{ 1 ,-1 },
	{ 1,0 },{ 1 ,1 }
};

class Graph {
public:
	int vn;
	int sumcost = 0;
	vector<vector<pii>> g;

	Graph(int n) {
		vn = n;
		g.resize(n);
	}
	virtual void con(int a, int b, int w) = 0;
	int getWeight(int f, int t) {
		auto itr = lower_bound(ALL(g[f]), make_pair(t, INT_MIN));
		if (itr != g[f].end())
			return itr->second;
		return INT_MIN;
	}
	int Costsum() {
		return sumcost;
	}
};

class BiDGraph : public Graph {//??????
public:
	BiDGraph(int n) : Graph(n) {}

	void con(int a, int b, int w = 1) {
		g[a].push_back({ b,w });
		g[b].push_back({ a, w });
		sumcost++;
	}
};

template<class T>
vector<ll> Dijkstra(T g, int st) {
	priority_queue<pll, vector<pll>, greater<pll>> que;

	que.push({0, st});
	int kk = 0;
	vector<ll> res(g.vn,-1);
	while (kk < g.vn && que.size()) {
		pll cur = que.top();
		que.pop();
		if (res[cur.second] != -1)
			continue;
		res[cur.second] = cur.first;
		kk++;
		for (auto itr : g.g[cur.second]) {
			if(res[itr.first] == -1)
				que.push({ cur.first + itr.second,itr.first });
		}
	}
	return res;
}

signed main() {
	int n, m, c;
	scnaf("%d %d %d", &n, &m, &c);
	BiDGraph g(n);
	vector<pair<pii,int>> edges(m);
	REP(i, m) {
		int f, t, cost;
		scanf("%d %d %d", &f, &t, &cost);
		g.con(f-1, t-1, cost);
		edges[i] = { {f-1,t-1},cost };
	}
	vector<ll> cost(Dijkstra(g, 0));
	vector<pll>tui;
	REP(i, cost.size()) {
		tui.push_back({cost[i],0});
	}
	sort(ALL(tui));
	REP(i,m){
		if (cost[edges[i].first.first] > cost[edges[i].first.second]) {
			pll cur = { cost[edges[i].first.first],edges[i].second };
			auto itr = lower_bound(ALL(tui), (pll)MP( cur.first,0 ));
			itr->second += cur.second;
		}
		else {
			pll cur = { cost[edges[i].first.second],edges[i].second };
			auto itr = lower_bound(ALL(tui), (pll) MP(cur.first, 0));
			itr->second += cur.second;
		}
	}
	sort(ALL(tui));
	REP(i, n-1) {
		tui[i+1].second += tui[i].second;
	}
	ll sum = tui[n - 1].second;
	ll ans = LLONG_MAX;
	rep(i, 0, n) {
		ans = min(ans, tui[i].first*c + sum - tui[i].second);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 22824