#include using namespace std; using ll = long long; const ll MOD = 1e9 + 7; template vector> DotMatrix(const vector>& a, const vector>& b){ vector> ret(a.size(), vector(b[0].size(), 0)); for (size_t i = 0; i < ret.size(); ++i) { for (size_t j = 0; j < ret[i].size(); ++j) { for (size_t k = 0; k < b.size(); ++k) { (ret[i][j] += ((a[i][k] * b[k][j]) % MOD)) %= MOD; } } } return ret; } int main() { int N, M, K; cin >> N >> M >> K; vector> mat(N + 2, vector(N + 2, 0)); for (int i = 0; i < M; ++i) { int l, r; cin >> l >> r; mat[l][l] += 1; mat[l][r + 1] -= 1; mat[r + 1][l] -= 1; mat[r + 1][r + 1] += 1; } for (int j = 0; j < N + 2; ++j) { for (int i = 0; i < N + 1; ++i) { mat[i + 1][j] += mat[i][j]; } } for (int i = 0; i < N + 2; ++i) { for (int j = 0; j < N + 1; ++j) { mat[i][j + 1] += mat[i][j]; } } vector>> table(15, vector>(N + 2, vector(N + 2, 0))); table[0] = mat; for (int i = 1; i < 15; ++i) { table[i] = DotMatrix(table[i - 1], table[i - 1]); } vector res(N + 1, 0); res[1] = 1; vector tmp(N + 1, 0); for (int k = 0; k < 15; ++k) { if ((K>>k & 1) == 0) { continue; } for (int i = 1; i <= N; ++i) { tmp[i] = 0; for (int j = 1; j <= N; ++j) { (tmp[i] += (table[k][i][j] * res[j])) %= MOD; } } res = tmp; } cout << res[N] % MOD << endl; return 0; }