#include using namespace std; typedef long long ll; typedef pair l_l; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) const ll mod = 1000000007; ll dp[3005][3005]; ll dpsum[3005][3005]; ll N, M, K; ll L[3005], R[3005]; int main() { //cout.precision(10); cin.tie(0); ios::sync_with_stdio(false); cin >> N >> M >> K; for(int i = 1; i <= M; i++) cin >> L[i] >> R[i]; dp[0][1] = 1; for(int i = 1; i <= N; i++) dpsum[0][i] = 1; for(int day = 1; day <= K; day++) { for(int m = 1; m <= M; m++) { ll before = (dpsum[day-1][R[m]] - dpsum[day-1][L[m]-1] % mod) % mod; dp[day][L[m]] += before; dp[day][R[m]+1] += mod - before; dp[day][L[m]] %= mod; dp[day][R[m]+1] %= mod; } for(int i = 1; i <= N; i++) dp[day][i] = (dp[day][i] + dp[day][i-1]) % mod; for(int i = 1; i <= N; i++) dpsum[day][i] = (dpsum[day][i-1] + dp[day][i]) % mod; } cout << dp[K][N] << endl; return 0; }