#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; const ll MOD = 1000000007LL; ll dp[3005][3005]; ll sum[3005]; ll nxt[3005]; int main(){ int N, M, K; cin >> N >> M >> K; vector> v; rep(i,M){ int l, r; cin >> l >> r; v.push_back({l,r}); } dp[0][1] = 1; rep(i,K){ sum[0] = 0; REP(j,1,3005) sum[j] = sum[j-1] + dp[i][j]; rep(j,3005) nxt[j] = 0; rep(j,v.size()){ ll s = sum[v[j][1]] - sum[v[j][0]-1]; nxt[v[j][0]] += s; nxt[v[j][1]+1] -= s; } ll base = 0; rep(j,3005){ base += nxt[j]; dp[i+1][j] = base % MOD; } } cout << dp[K][N] << endl; return 0; }