#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define all(c) c.begin(), c.end() #define rall(c) c.rbegin(), c.rend() #define debug(x) cerr << #x << ": " << x << endl using namespace std; typedef long long ll; typedef pair Pll; typedef pair Pii; const ll MOD = 1000000007; vector< vector > product(vector< vector > A, vector< vector > B){ int height = A.size(), width = B[0].size(), n = B.size(); vector< vector > C(height, vector(width, 0)); for(int i=0;i > matrix_pow(vector< vector > A, ll t) { int n = A.size(); vector< vector > B(n, vector(n, 0)); for(int i=0;i>= 1; } return B; } int main() { int n,m,K,l,r; cin >> n >> m >> K; vector< vector > A(n, vector(n, 0LL)); for(int i=1;i<=m;++i) { cin >> l >> r; --l; --r; for(int j=l;j<=r;++j) { ++A[j][l]; if(r+1 < n) --A[j][r+1]; } } for(int i=0;i