#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
#define INF 200000000000000
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
#define int ll
#define P pair<int,int>
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}
int lcm(int a,int b){if(a==0){return b;} return a/gcd(a,b)*b;}

#define MAX 100005
int m,n,c;
vector<P> G[MAX];
int sum=0;
int distances[MAX];
int r[MAX];
int road[MAX];

signed main(){
	cin>>n>>m>>c;
	for(int i=0; i<m; i++){
		int a,b,c; cin>>a>>b>>c;
		G[a].push_back(mk(b,c));
		G[b].push_back(mk(a,c));
		sum+=c;
	}
	for(int i=0; i<=n; i++){
		distances[i]=INF;
	}
	
	priority_queue<P,vector<P>, greater<P> > que;
	que.push(mk(0,1));
	distances[1]=0;
	while(!que.empty()){
		int now=que.top().second, dis=que.top().first; que.pop();
		if(distances[now]<dis) continue;
		for(int i=0; i<G[now].size(); i++){
			int d=G[now][i].second, to=G[now][i].first;
			if(dis+d<distances[to]){
				distances[to]=dis+d;
				que.push(mk(distances[to], to));
			}
		}
	}
	
	vector<P> rank;
	for(int i=1; i<=n; i++){
		rank.push_back(mk(distances[i],i));
	}
	sort(rank.begin(), rank.end());
	P a; a.first=0,a.second=0;
	for(int i=0; i<rank.size(); i++){
//		if(rank[i].first>a.second) a.first++;
		r[rank[i].second]=i;		
//		a.second=rank[i].first;
	}
	
	for(int i=1; i<=n; i++){
		for(int j=0; j<G[i].size(); j++){
			int to=G[i][j].first,dis=G[i][j].second;
			if(r[i]>r[to]) road[i]+=dis;
		}
	}
	
	int ans=INF;
	int s=0;
	int l=0;
	for(int i=0; i<rank.size(); i++){
		int v=rank[i].second, x=rank[i].first;
//		if(l<x)
		s+=road[v];
		ans=min(ans, c*x+sum-s);
//		l=x;
	}
	cout<<ans<<en;
}



