// NOTE: it is recommended to use this even if you don't understand the following code.

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

#define MAXM 200000

int       K, M, N, i;
int       C[MAXM], U[MAXM], V[MAXM];
long long ans;

int main() {
    // uncomment the two following lines if you want to read/write from files
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    assert(3 == scanf("%d%d%d", &N, &M, &K));

    for (i = 0; i < M; ++i)
        assert(3 == scanf("%d%d%d", &U[i], &V[i], &C[i]));

    ans = 0;


    // INSERT YOUR CODE HERE


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

    return 0;
}
