# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);

int V, E, C;
struct edge { LL to, cost; };

typedef pair<LL, LL> P;

LL d[100100]; //?????¢
vector<edge> vec[100100];
set<int>st;

void dijkstra() {
	for (int i = 0; i < 100100; i++)d[i] = HLINF;
	priority_queue<P, std::vector<P>, std::greater<P>> pq;
	d[0] = 0;
	pq.push(make_pair(d[0], 0));//cost,to
	while (!pq.empty()) {
		P p = pq.top();
		pq.pop();
		int i = p.second;
		if (d[i] < p.first)continue;
		for (int k = 0; k < vec[i].size(); k++) {
			edge e = vec[i][k];
			if (d[e.to] <= d[i] + e.cost)continue;
			d[e.to] = d[i] + e.cost;
			pq.push(make_pair(d[e.to], e.to));
		}
	}
}

int main() {
	cin >> V >> E >> C;
	LL sumcost = 0;
	int a, b, c;
	for (int i = 0; i < E; i++) {
		cin >> a >> b >> c;
		a--, b--;
		vec[a].push_back(edge{ b,c });
		vec[b].push_back(edge{ a,c });
		sumcost += c;
	}
	dijkstra();
	LL ans = LINF;
	priority_queue<P, vector<P>, greater<P> > pq;
	for (int i = 0; i < V; i++) {
		pq.push(mp(d[i], i));
	}
	while (!pq.empty()) {
		P p = pq.top();
		pq.pop();
		for (auto v : vec[p.second]) {
			if (st.count(v.to)) {
				sumcost -= v.cost;
			}
		}
		ans = min(ans, p.first*C + sumcost);
		st.insert(p.second);
	}
	cout << ans << endl;
}