#include #include #include #include using namespace std; typedef long long ll; ll n, m, k, l[3010], r[3010], dp[3010][3010]; const ll mod = 1000000007; int main(void) { cin >> n >> m >> k; for (ll i = 0; i < m; i++) { cin >> l[i] >> r[i]; } for (ll i = 1; i <= n; i++) { dp[0][i] = 1; } for (ll i = 1; i <= k; i++) { for (ll j = 0; j < m; j++) { (dp[i][l[j]] += (mod + dp[i - 1][r[j]] - dp[i - 1][l[j] - 1])) %= mod; dp[i][r[j] + 1] += mod; (dp[i][r[j] + 1] -= (mod + dp[i - 1][r[j]] - dp[i - 1][l[j] - 1])) %= mod; } for (ll j = 1; j < n; j++) { (dp[i][j + 1] += dp[i][j]) %= mod; } for (ll j = 1; j < n; j++) { (dp[i][j + 1] += dp[i][j]) %= mod; } } cout << (mod + dp[k][n] - dp[k][n - 1]) % mod << endl; }