#include using namespace std; #define int long long // aaaaaaaaaaaaaaaaaa #define rep(i,a,n) for (int i=a;i=a;i--) #define pb push_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(),(x).rend() #define in(s,x) s.find(x) != s.end() #define fi first #define se second #define SZ(x) ((int)(x).size()) #define SIZE(buff) (sizeof(buff)/sizeof(buff[0])) typedef vector VI; typedef vector > VVI; typedef long long ll; typedef pair PII; typedef vector> VPII; const ll mod=1000000007; ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;} void chmin(int64_t& a, int64_t b){ a = min(a, b); } template ostream &operator<<(ostream &o,const vector&v) {o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<ostream& operator << (ostream& os, pair& pair_var) {os << "(" << pair_var.first << ", " << pair_var.second << ")";return os;} // head int m,n,k,res,tmp,tmp2,tmp3,h,w,ans; int a[3200][2] = {}; int b[8000100] = {}; int r[100001][25]; deque que; string s; map kukan; vector g[3000]; //int dp[200000]; int flag; //VPII g2[200000]; int cost[200005]; ll dp[5000][5100] = {}; //VVI g(200005); signed main() { cin.tie(0); ios::sync_with_stdio(false); cin>>n>>m>>k; rep(i,0,m){ cin>>a[i][0]>>a[i][1]; } dp[0][1] = 1; rep(i,0,k){ int rui[n+6]= {}; rep(j,0,n+2){ rui[j+1]=rui[j]+dp[i][j]; rui[j+1] %= mod; } rep(j,0,m){ tmp = rui[a[j][1]+1]+mod - rui[a[j][0]]; tmp %= mod; dp[i+1][a[j][0]]+= tmp; dp[i+1][a[j][1]+1]-= tmp; dp[i+1][a[j][1]+1]+= mod; } rep(j,0,n+1){ dp[i+1][j+1] = dp[i+1][j+1]+dp[i+1][j]; dp[i+1][j+1] %=mod; } } cout<