#include typedef long long ll; using namespace std; int n; vector > mul(vector > a, vector > b){ vector > ret(n, vector (n, 0)); for(int i=0;i > pow(vector > a, ll t){ vector > ret(n, vector (n, 0)); for(int i=0;i 0){ if(t & 1) ret = mul(ret, a); a = mul(a, a); t >>= 1; } return ret; } int main() { ll m, t; cin >> n >> m >> t; vector > G(n, vector (n, 0)); int a, b; bool check = false; if(n <= 0 || n > 100 || m < 0 || m > 10000 || t < 0 || t > 1000000000000000000) check = true; for(int i=0;i> a >> b; G[b][a] = 1; if(a < 0 || b < 0 || a >= n || b >= n) check = true; } G = pow(G, t); int ans = 0; for(int i=0;i