#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; typedef long long int ll; typedef pair P; const ll MOD=924844033; vector> matrixmul(int l, int m, int n, vector> a, vector> b){ vector> c(l, vector(n)); for(int i=0; i> matrixpow(int n, vector> a, ll k){ vector> ap=a, ans(n, vector(n)); for(int i=0; i>=1; } return ans; } int main() { int n, m; ll t; cin>>n>>m>>t; vector> mat(n, vector(n)); for(int i=0; i>a>>b; mat[a][b]++; } auto matp=matrixpow(n, mat, t); int ans=0; for(int i=0; i