#include<bits/stdc++.h>
using namespace std;
int n,m,k;
int ans;
int main(){
	freopen("road.in","r",stdin);
	freopen("road.out","w",stdout);
	cin>>n>>m>>k;
	if(k<=0){
		for(int i=1;i<=m;i++){
		int u,v,w;
		cin>>u>>v>>w;
		
		}	
		cout<<ans;	
	}
	else cout<<0;
	return 0;
} 
