#include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "string" #include "map" #include "unordered_map" #include "unordered_set" #include "iomanip" #include "cmath" #include "random" #include "bitset" #include "cstdio" #include "numeric" #include "cassert" using namespace std; //const long long int MOD = 1000000007; const int MOD = 998244353; //long long int N, M, K, H, W, L, R; int N, M, K, H, W, L, R; void Solve(vector>&box, int num, vector&st) { auto by = box; bool flag = true; for (int i = 0; i < 12; i++) { if ((num >> i) & 1) { if (flag) { by = box; } else { auto bag = by; for (int j = 0; j < N; j++) { for (int k = 0; k < N; k++) { by[j][k] = 0; for (int l = 0; l < N; l++) { by[j][k] = ((long long int)bag[j][l] * box[l][k] + by[j][k]) % MOD; } } } } } auto bag = box; for (int j = 0; j < N; j++) { for (int k = 0; k < N; k++) { box[j][k] = 0; for (int l = 0; l < N; l++) { box[j][k] = ((long long int)bag[j][l] * bag[l][k] + box[j][k]) % MOD; } } } } auto bag = st; for (int j = 0; j < N; j++) { for (int k = 0; k < N; k++) { st[j] = ((long long int)bag[k] * by[j][k] + st[j]) % MOD; } } } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> N >> M >> K; vector>v(M); for (auto &i : v) { cin >> i.first >> i.second; i.first--; i.second--; } vectorst(N); st[0] = 1; vector>box(N, vector(N)); for (int i = 0; i < N; i++) { for (auto j : v) { if (j.first > i || j.second < i)continue; box[j.first][i]++; if (j.second + 1 != N)box[j.second + 1][i]--; } } for (int i = 0; i < N; i++) { for (int j = 1; j < N; j++) { box[j][i] += box[j - 1][i]; } } Solve(box, K, st); cout << st.back() << endl; return 0; }