#include using namespace std; #include //using namespace atcoder; using ll = long long; using ull = unsigned long long; using i128 = __int128_t; using u128 = unsigned __int128_t; using mint = atcoder::static_modint<1000000007>; const int mod = 998244353; #include mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count()); int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}; int dy[8] = {0, 0, -1, 1, -1, 1, -1, 1}; template bool chmin(T& a, const T& b){ if (b < a){ a = b; return true; } else { return false; } } template bool chmax(T& a, const T& b){ if (a < b){ a = b; return true; } else { return false; } } void solve(){ int n, m, k; cin >> n >> m >> k; vector> p; for (int i = 0; i < m; i++){ int l, r; cin >> l >> r; l--; r--; p.push_back({l, r}); } vector dp(n + 1); dp[0] = 1; for (int i = 0; i < k; i++){ vector cnt(n + 1); for (int j = 0; j < n; j++){ cnt[j + 1] = cnt[j] + dp[j]; } vector imos(n + 1); for (int j = 0; j < m; j++){ int l = p[j].first, r = p[j].second; imos[l] += cnt[r + 1] - cnt[l]; imos[r + 1] -= cnt[r + 1] - cnt[l]; } for (int j = 0; j <= n; j++){ imos[j + 1] += imos[j]; } swap(dp, imos); } cout << dp[n - 1].val() << '\n'; }; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; while(t--){ cout << fixed << setprecision(15); solve(); } }