#include #include #include #include #include using ll = long long; #define MOD 1000000007 using namespace std; int main(){ int N, M, K; cin >> N >> M >> K; vector L(M), R(M); vector> dp(K+1,vector(N+1,0)); dp[0][1] = 1; for(int i = 0; i < M; i++) { cin >> L[i] >> R[i]; } for(int count = 0; count < K; count++) { for(int height = 1; height < N+1; height++) { for(int i = 0; i < M; i++) { if (L[i] <= height && R[i] >= height) { for(int j = L[i]; j <= R[i]; j++) { dp[count + 1][j] += dp[count][height] % MOD; dp[count + 1][j] %= MOD; } } } } } cout << dp[K][N] << endl; return 0; }