#include using namespace std; #define mod 1000000007 int main(void) { int N, M, K; cin >> N >> M >> K; vector L(M), R(M); for (int i = 0; i < M; i++) { cin >> L[i] >> R[i]; L[i]--; R[i]--; } vector > dp(K + 1, vector(N, 0)); dp[0][0] = 1; for (int i = 1; i <= K; i++) { for (int k = 0; k < M; k++) { long long sum = 0; for (int l = L[k]; l <= R[k]; l++) { sum += dp[i - 1][l] % mod; } sum %= mod; for (int l = L[k]; l <= R[k]; l++) { dp[i][l] = (dp[i][l] + sum) % mod; } } } cout << dp[K][N - 1] << endl; return 0; }