#include <bits/stdc++.h>
// #include "ane.cpp"

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 100005;
const int MMAX = 200005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
// #define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
  memset((from), 0, sizeof(from)); } while(0)

#ifdef DEBUG
#define DUMP(x) do{ std::cerr << "(DUMP) " << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> lp;
typedef pair<ll, ll> pll;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  ll to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, _end) do{       \
  printf("%s: ", #v);         \
  for (auto ite = begin(v); ite != (_end); ++ite) \
  {                           \
  cout << *ite << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A[MMAX],B[MMAX],C,D[MMAX],E;
ll d[NMAX] = {};
bool inside[NMAX] = {};
std::vector<edge> G[NMAX];
multimap<ll, int> mp;
ll ans = INFLL;

void solve(){
  // main algorithm
  // dijkstra
  Fill(d, INFLL);
  priority_queue<lp, vector<lp>, greater<lp> > que;
  que.push(lp(0LL, 1));
  while(!que.empty()) {
    ll dd = que.top().first;
    int i = que.top().second;
    que.pop();
    if(d[i] <= dd) continue;
    d[i] = dd;
    for(auto&& e : G[i]) {
      if(d[e.to] > dd + e.cost) que.push(lp(dd + e.cost, e.to));
    }
  }
  // sort by dist
  for (int i = 1; i <= N; ++i)
  {
    mp.insert(make_pair(d[i], i));
  }
  // calc edges inside and minimum
  debug("points:\n");
  const ll sum = accumulate(D, D + M, 0LL);
  ll points = 0;

  for(auto p = mp.begin(); p != mp.end();) {
    ll dd = p->first;

    int cnt = mp.count(dd);
    for(int c = 0; c < cnt; ++c, ++p){
      int i = p->second;
      inside[i] = true;
      for(auto&& e : G[i])
        if(inside[e.to]) points += e.cost;
    }

    debug("%lld : %lld\n", dd, points);
    debug("ans = min(%lld, %lld)\n", ans, C * dd + (sum - points));
    ans = min(ans, C * dd + (sum - points));
  }
}
void debug(){
  // output debug information
  cout << "d:\n";
  for(int i=0; i < N; ++i) {
    cout << i+1 << " : " <<  d[i+1] << "\n";
  }

  cout << "mp:\n";
  for(auto&& p : mp) {
    cout << p.first << " -> " << p.second << endl;
  }

}
void answer(){
  // output answer
  printf("%lld\n", ans);
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  scanf("%lld%lld%lld", &N,&M, &C);
  for (int i = 0; i < M; ++i)
  {
    scanf("%lld%lld%lld", &A[i], &B[i], &D[i]);
    G[A[i]].push_back(edge{B[i], D[i]});
    G[B[i]].push_back(edge{A[i], D[i]});
  }
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

Measured memory_bytes: 28556