N,M,K = map(int, input().split()) LR = [ list(map(int, input().split())) for _ in range(M)] mod = 10**9+7 dp = [0] * (N+1) dp[1] = 1 for i in range(1, K+1): imos = [0] * (N+2) ruiseki = [0] for d in dp[1:]: ruiseki.append( ruiseki[-1] + d ) # print("ruiseki: ", ruiseki) for j in range(M): # エレベータ全部 l,r = LR[j] _sum = ruiseki[r] - ruiseki[l-1] imos[l] += _sum imos[r+1] -= _sum # print("imos: ", imos) ndp = [0] * (N+1) for i in range(1,N+1): ndp[i] = (ndp[i-1] + imos[i]) % mod # print("i: ",i ,"ndp: ", ndp) dp = ndp print(dp[N] % mod)