#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned int ui; const ll mod = 1000000007; typedef long double ld; const ld INF = (ld)10000000000000; typedef pair P; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i=0;i--) #define Rep(i,sta,n) for(int i=sta;i=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef complex Point; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair LDP; typedef pair LP; ll dp[3000]; ll cop[3001]; int main() { dp[0] = 1; int n, m, k; cin >> n >> m >> k; vector l(m), r(m); rep(i, m) { cin >> l[i] >> r[i]; l[i]--; r[i]--; } rep(i, k) { fill(cop, cop + n, 0); rep(j, n) { rep(i2, m) { if (j < l[i2] || r[i2] < j)continue; (cop[l[i2]] += dp[j]) %= mod; (cop[r[i2] + 1] += mod - dp[j]) %= mod; } } rep(j, n) { (cop[j + 1] += cop[j]) %= mod; } rep(j, n)dp[j] = cop[j]; } cout << dp[n - 1] << endl; //stop return 0; }