#include <queue>
#include <tuple>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>

#pragma warning(disable : 4996)

using namespace std;

int N, M, C, A, B, E; long long sum;

vector<long long> P;

vector<tuple<int, int, int> > edges;

vector<vector<pair<int, int> > > G;

int main()
{
	scanf("%d", &N);
	scanf("%d", &M);
	scanf("%d", &C);

	G.resize(N);

	for (int i = 0; i < M; i++)
	{
		scanf("%d", &A);
		scanf("%d", &B);
		scanf("%d", &E);

		sum += E;

		G[A - 1].push_back(make_pair(B - 1, E));
		G[B - 1].push_back(make_pair(A - 1, E));

		edges.push_back(make_tuple(A - 1, B - 1, E));
	}

	vector<long long> D(N, 999999999999999999LL); D[0] = 0;

	priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > que;

	que.push(make_pair(0LL, 0));

	while (!que.empty())
	{
		pair<long long, int> p1 = que.top(); que.pop();

		long long dist = p1.first;

		int node = p1.second;

		for (int i = 0; i < G[node].size(); i++)
		{
			if (D[G[node][i].first] > D[node] + G[node][i].second)
			{
				D[G[node][i].first] = D[node] + G[node][i].second;

				que.push(make_pair(D[G[node][i].first], G[node][i].first));
			}
		}
	}

	vector<pair<long long, int> > I;

	for (int i = 0; i < M; i++)
	{
		I.push_back(make_pair(max(D[get<0>(edges[i])], D[get<1>(edges[i])]), get<2>(edges[i])));
	}

	sort(I.begin(), I.end());

	vector<long long> J; for (int i = 0; i < M; i++) J.push_back(I[i].first);

	vector<long long> K = { 0 }; for (int i = 0; i < M; i++) K.push_back(K[i] + I[i].second);

	long long ret = 999999999999999999LL;

	for (int i = 0; i < N; i++)
	{
		int ptr = upper_bound(J.begin(), J.end(), D[i]) - J.begin();

		ret = min(ret, C * D[i] + sum - K[ptr]);
	}

	printf("%lld\n", ret);

	return 0;
}