#include #include using namespace std; typedef long long ll; typedef vector> vvl; ll mod = 1000000007; vvl mul(const vvl &a,const vvl &b){ int i,j,k,n = a.size(); vvl c(n,vector(n,0)); for(i=0;i mul2(vvl &a,vector b){ int i,j,n = a.size(); vector c(n); for(i=0;i(n,0)); for(i=0;i> k >> m >> n; for(i=0;i> p >> q >> r; p--; q--; r--; ok[p][q][r] = true; } int sz = k*k*k; vvl mat(sz); for(i=0;i v(sz); for(i=0;i<1;i++){ for(j=0;j