// yukicoder: No.801 エレベーター // 2019.7.17 bal4u #include #include #if 1 #define gc() getchar_unlocked() #else #define gc() getchar() #endif int in() { // 非負整数の入力 int n = 0, c = gc(); do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0'); return n; } typedef long long ll; #define MOD 1000000007 int L[3003], R[3003]; ll dp[2][3003], *cur, *nxt, *t; int main() { int i, j, N, M, K, N1, ans; N = in(), M = in(), K = in(), N1 = N+1; for (i = 0; i < M; i++) L[i] = in(), R[i] = in(); dp[0][1] = 1, cur = dp[0], nxt = dp[1]; for (i = 0; i < K; i++) { for (j = 1; j <= N1; j++) cur[j] += cur[j-1]; for (j = 0; j < M; j++) { ll t = cur[R[j]] - cur[L[j]-1]; nxt[L[j]] += t, nxt[R[j]+1] -= t; } for (j = 1; j <= N1; j++) nxt[j] = (nxt[j] + nxt[j-1]) % MOD; t = cur, cur = nxt, nxt = t; memset(nxt, 0, sizeof(dp[0])); } ans = cur[N]; if (ans < 0) ans += MOD; printf("%d\n", ans); return 0; }