#include using namespace std; typedef long long ll; #define int long long #define mk make_pair #define pb push_back #define pf push_front typedef pair pii; #define INF (1 << 30) #define INFL (1ll << 60ll); #define mod 1000000007 #define se second #define fi first int N, M, K; int L[3030], R[3030]; int dp[3030][3030]; int dfs(int t, int x) { if(t == K){ if(x == N){ return 1ll; } else { return 0; } } if(~dp[t][x]){ return dp[t][x]; } int res = 0; for(int i = 0; i < M; i++){ if(L[i] <= x && x <= R[i]){ for(int j = L[i]; j <= R[i]; j++){ res += dfs(t + 1, j); res %= mod; } } } return dp[t][x] = res; } signed main() { cin >> N >> M >> K; for(int i = 0; i < M; i++){ cin >> L[i] >> R[i]; } memset(dp, -1ll, sizeof(dp)); cout << dfs(0, 1) << endl; return 0; } /* */