#include #define rep(i,n,m) for(int i = (n); i <(m); i++) #define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--) using namespace std; using ll = long long; const ll MOD = 1000000007; // const int MAX_N = 3003; int main() { ll n, m, k; cin >> n >> m >> k; int elev[n][2]; rep(i, 0, m) { int l, r; cin >> elev[i][0] >> elev[i][1]; --elev[i][0]; } vector cur(n, 0); cur[0] = 1; rep(i, 0, k) { vector csum(n+1, 0); rep(j, 0, n) csum[j+1] += cur[j] + csum[j]; vector next(n+1, 0); rep(j, 0, m) { ll add = csum[elev[j][1]] - csum[elev[j][0]]; next[elev[j][0]] += add; next[elev[j][1]] -= add; next[elev[j][0]] %= MOD; next[elev[j][1]] %= MOD; // cout << i << ' ' << j << ' ' << add << ' ' << next[0] << ' ' << elev[j][1] << endl; } rep(j, 0, n) next[j+1] += next[j], next[j+1] %= MOD; swap(next, cur); } if (cur[n-1] < 0 ) cur[n-1] += MOD, cur[n-1] %= MOD; cout << cur[n-1] << endl; return 0; }