#include using namespace std; int main() { int N, M, K; cin>> N >> M >> K; vector L(M), R(M); vector> dp(3001, vector(3002, 0)); for (int i = 0; i < M; i++) cin >> L[i] >> R[i]; dp[K][N] = 1; dp[K][N+1] = 0; for (int i = 0; i < N; i++) dp[K][i] = 0; for (int k = K - 1; k >= 0; k--) { for (int i = 1; i <= N; i++) dp[k+1][i] += dp[k+1][i - 1]; for (int i = 0; i < M; i++) { long long val = dp[k + 1][R[i]] - dp[k + 1][L[i] - 1]; dp[k][L[i]] += val; dp[k][R[i] + 1] -= val; } for (int i = 1; i <= N; i++) dp[k][i] += dp[k][i - 1]; } auto solve = [&](auto f, int k, int n) { if (dp[k][n] >= 0) return dp[k][n]; int r = 0; for (int i = 0; i < M; i++) if (n >= L[i] && n <= R[i]) for (int j = L[i]; j <= R[i]; j++) r = (r + f(f, k + 1, j)) % 1000000007; dp[k][n] = r; return r; }; int r = 0; cout << dp[0][1] % 1000000007 << endl; return 0; }