#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;

vector<int> dijk(int s, int v, vector<vector<pair<int, int> > > adjlist){
    priority_queue <pair<int, int> > wait;
    vector<int> result(v, INF);

    result[s] = 0;
    wait.push(make_pair(0, s));

    while(!wait.empty()){
        int nowpoint = wait.top().second;
        int nowcost = -wait.top().first;
        wait.pop();

        if(result[nowpoint] < nowcost) continue;

        for(int i = 0; i < adjlist[nowpoint].size(); i++){
            int nextpoint = adjlist[nowpoint][i].second;
            int nextcost = nowcost + adjlist[nowpoint][i].first;
            
            if(result[nextpoint] > nextcost){
                result[nextpoint] = nextcost;
                wait.push(make_pair(-nextcost, nextpoint));
            }
        }
    }

    return result;
}

int n, m, C;
int f(int x, vector<int> &result, vector<vector<pair<int, int> > > &g){
    if(x < 0) return INF;
    int ret = x * C;
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < (int)g[i].size(); j++){
            int u = g[i][j].second;
            int v = i;
            int cost = g[i][j].first;
            if(u < v) continue;

            if(result[u] > x || result[v] > x){
                ret += cost;
            }
        }
    }

    return ret;

}

signed main(){
    cin >> n >> m >> C;
    vector<vector<pair<int, int> > > g(n);
    int sum = 0;
    for(int i = 0; i < m; i++){
        int a, b, c; cin >> a >> b >> c;
        a--;
        b--;
        g[a].push_back({c, b});
        g[b].push_back({c, a});
        sum += c;
    }

    vector<int> result = dijk(0, n, g);
    
    vector<pair<int, int> > p(n);
    for(int i = 0; i < n; i++){
        p[i].first = result[i];
        p[i].second = i;
    }
    //cerr << "ss" << endl;
    sort(p.begin(), p.end());
    int ans = sum;
    int tmp = sum;
    /*for(int i = 1; i < n; i++){
        // 頂点 v_i
        int nowcost = p[i].first;
        tmp -= C * p[i-1].first;
        while(i < n-1 && p[i+1].first == nowcost)i++;
        tmp += C * nowcost;
        assert(p[i].second < n);
        for(auto e : g[p[i].second]){
            assert(e.second < n);
            if(result[e.second] <= nowcost){
                tmp -= e.first;
            }
        }
        ans = min(tmp, ans);
    }*/

    vector<int> used(n, false);
    used[0] = true;
    for(int i = 1; i < n; i++){
        int x = p[i].first;
        int node = p[i].second;
        for(int j = 0; j < (int)g[node].size(); j++){
            int nxt = g[node][j].second;
            int cost = g[node][j].first;
            if(used[nxt]) tmp -= cost;
        }

        used[node] = true;
        ans = min(ans, tmp + x * C);
    }
    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 26696