#include #include #include #include #include #include #include #include #include #include using namespace std; #define int long long int MOD = 1000000007; signed main() { cin.tie(0); ios::sync_with_stdio(false); int N, M, K; cin >> N >> M >> K; vector L(M); vector R(M); for (int i = 0; i < M; i++) { cin >> L[i] >> R[i]; } vector dp(N + 2, 0); dp[1] = 1; for (int i = 0; i < K; i++) { for (int j = 1; j <= N + 1; j++) { dp[j] = (dp[j] + dp[j - 1]) % MOD; } vector ndp(N + 2, 0); for (int j = 0; j < M; j++) { int sum = dp[R[j]] - dp[L[j] - 1]; ndp[L[j]] = (ndp[L[j]] + sum) % MOD; ndp[R[j] + 1] -= sum; if (ndp[R[j] + 1] < 0)ndp[R[j] + 1] += MOD; } for (int j = 1; j <= N + 1; j++) { ndp[j] = (ndp[j] + ndp[j - 1]) % MOD; } swap(dp, ndp); } cout << dp[N] << endl; }