/* -*- coding: utf-8 -*- * * 801.cc: No.801 エレベーター - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 3000; const int MAX_M = 3000; const int MAX_K = 3000; const int MOD = 1000000007; /* typedef */ /* global variables */ int ls[MAX_M], rs[MAX_M]; int dp[MAX_K + 1][MAX_N + 1], dsums[MAX_N + 1]; /* subroutines */ inline void addmod(int &a, int b) { a = (a + b) % MOD; } /* main */ int main() { int n, m, k; scanf("%d%d%d", &n, &m, &k); for (int i = 0; i < m; i++) scanf("%d%d", ls + i, rs + i), ls[i]--; dp[0][0] = 1; for (int i = 0; i < k; i++) { for (int j = 0; j < n; j++) dsums[j + 1] = (dsums[j] + dp[i][j]) % MOD; for (int j = 0; j < m; j++) { int d = (dsums[rs[j]] + MOD - dsums[ls[j]]) % MOD; addmod(dp[i + 1][ls[j]], d); addmod(dp[i + 1][rs[j]], MOD - d); } for (int j = 0; j < n; j++) addmod(dp[i + 1][j + 1], dp[i + 1][j]); } printf("%d\n", dp[k][n - 1]); return 0; }