#include #include using namespace std; using ll = long long; using mint = atcoder::modint1000000007; using vi = vector; #define rep1(a) for(ll i = 0; i < ll(a); i++) #define rep2(i, a) for(ll i = 0; i < ll(a); i++) #define rep3(i, a, b) for(ll i = ll(a); i < ll(b); i++) #define rep4(i, a, b, c) for(ll i = ll(a); i < ll(b); i += ll(c)) #define overload4(a, b, c, d, e, ...) e #define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define all(x) begin(x),end(x) #define rall(x) rbegin(x),rend(x) int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int N, M, K; cin >> N >> M >> K; vector> I(M); rep(i, M) { int l, r; cin >> l >> r; I[i] = {--l, r}; } vector dp(N + 1); dp[0] = 1; rep(i, K) { vector ndp(N + 1); vector pref(N + 2); rep(j, N + 1) pref[j + 1] = pref[j] + dp[j]; rep(j, M) { const auto&[l, r] = I[j]; mint sum = pref[r] - pref[l]; ndp[l] += sum; ndp[r] -= sum; } rep(j, 1, N + 1) ndp[j] += ndp[j - 1]; swap(dp, ndp); } mint ans = dp[N - 1]; cout << ans.val( ) << endl; }