#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 product(vector A, vector B, int n){ vector C(n*n, 0); for(int i=0;i matrix_pow(vector A, ll t, int n) { vector B(n*n, 0); for(int i=0;i>= 1; } return B; } int main() { int n,m,K,l,r; cin >> n >> m >> K; vector A(n*n, 0LL); for(int i=1;i<=m;++i) { cin >> l >> r; --l; --r; for(int j=l;j<=r;++j) { ++A[j*n+l]; if(r+1 < n) --A[j*n+r+1]; } } for(int i=0;i