#include using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) struct matrix{ int A[100][100]={}; }; void matrix_multiply(const matrix& l,const matrix& r,matrix& dest){ static matrix buf; rep(i,100) rep(j,100){ buf.A[i][j]=0; rep(k,100) buf.A[i][j]|=(l.A[i][k]&r.A[k][j]); } dest = buf; } int N,V; ULL T; matrix G; matrix P[64]; matrix dp; int main(){ scanf("%d%d%llu",&N,&V,&T); rep(i,V){ int u,v; scanf("%d%d",&u,&v); G.A[u][v]=1; } P[0]=G; rep(i,63) matrix_multiply(P[i],P[i],P[i+1]); dp.A[0][0]=1; rep(i,64) if(T&(1ull<