#include "bits/stdc++.h" using namespace std; template struct Modint { int value; Modint() : value(0) {} Modint(long x) : value(x >= 0 ? x % p : (p + x % p) % p) {} inline Modint &operator+=(const Modint &b) { if ((this->value += b.value) >= p) this->value -= p; return (*this); } inline Modint &operator-=(const Modint &b) { if ((this->value += p - b.value) >= p) this->value -= p; return (*this); } inline Modint &operator*=(const Modint &b) { this->value = (int)((1LL * this->value * b.value) % p); return (*this); } inline Modint &operator/=(const Modint &b) { (*this) *= b.inverse(); return (*this); } Modint operator+(const Modint &b) const { return Modint(*this) += b; } Modint operator-(const Modint &b) const { return Modint(*this) -= b; } Modint operator*(const Modint &b) const { return Modint(*this) *= b; } Modint operator/(const Modint &b) const { return Modint(*this) /= b; } inline Modint &operator++(int) { return (*this) += 1; } inline Modint &operator--(int) { return (*this) -= 1; } inline bool operator==(const Modint &b) const { return this->value == b.value; } inline bool operator!=(const Modint &b) const { return this->value != b.value; } inline bool operator<(const Modint &b) const { return this->value < b.value; } inline bool operator<=(const Modint &b) const { return this->value <= b.value; } inline bool operator>(const Modint &b) const { return this->value > b.value; } inline bool operator>=(const Modint &b) const { return this->value >= b.value; } //requires that "this->value and p are co-prime" // a_i * v + a_(i+1) * p = r_i // r_i = r_(i+1) * q_(i+1) * r_(i+2) // q == 1 (i > 1) // reference: https://atcoder.jp/contests/agc026/submissions/2845729 (line:93) inline Modint inverse() const { assert(this->value != 0); int r0 = p, r1 = this->value, a0 = 0, a1 = 1; while (r1) { int q = r0 / r1; r0 -= q * r1; swap(r0, r1); a0 -= q * a1; swap(a0, a1); } return Modint(a0); } friend istream &operator>>(istream &is, Modint

&a) { long t; is >> t; a = Modint

(t); return is; } friend ostream &operator<<(ostream &os, const Modint

&a) { return os << a.value; } }; const int MOD = 1e9 + 7; using Int = Modint; void solve() { int n, m, k; cin >> n >> m >> k; //L -> R vector> imos(n+2, vector(n+2)); while(m--) { int l, r; cin >> l >> r; r++; imos[l][l]++; imos[l][r]--; imos[r][l]--; imos[r][r]++; } for (int i = 0; i <= n; i++) { for (int j = 0; j <= n+1; j++) { imos[i+1][j] += imos[i][j]; } } for (int i = 0; i <= n+1; i++) { for (int j = 0; j <= n; j++) { imos[i][j+1] += imos[i][j]; } } vector dp(n); dp[0] = 1; while(k--) { vector nx(n); for (int l = 0; l < n; l++) { Int d = imos[l+1][l+1]; nx[l] += dp[l]*d; //cout << l << ' ' << d << endl; for (int r = l+1; r < n; r++) { Int dd = imos[l+1][r+1]; nx[r] += dp[l] * dd; nx[l] += dp[r] * dd; //cout << l << ' ' << r << ' ' << dd << endl; } } swap(dp, nx); } cout << dp.back() << endl; } int main(void) { solve(); //cout << "yui(*-v・)yui" << endl; return 0; }