#include<iostream>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<vector> 
#include<cstring>
#include<string>
#include<map>
#define mp make_pair
#define scn second
#define frs first
#define pb push_back

#define NAME "run"

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pi;


int a[100000];
int n, k, m;

int main(){
    freopen(NAME ".in", "r", stdin); 
    freopen(NAME ".out", "w", stdout); 
    scanf("%d%d", &n, &m);
    scanf("%d", &k);
    int mn = 10000;
    int mn_a = 0, mn_b = 0, mn_e = 0;
    for (int i = 0; i < m; ++i) {
        int a, b, w;
        scanf("%d%d%d", &a, &b, &w);
        if (mn > w)
            mn = w, mn_a = a, mn_b = b, mn_e = i;
    }
    
    printf("%d\n", mn * (k-1));
    /*int now = mn_a;
    while (k - 1 > 0)  
        printf("%d ", mn_e + 1);  */
    return 0;
}




