N, M, K = map(int, input().split()) data = [list(map(int, input().split())) for _ in range(M)] MOD = 10**9 + 7 dp = [0] + [1]*N for _ in range(K): nex = [0] * (N+1) for li, ri in data: si = dp[ri] - dp[li-1] nex[li] += si nex[li] %= MOD if ri < N: nex[ri+1] -= si nex[ri+1] %= MOD for i in range(1, N+1): nex[i] += nex[i-1] nex[i] %= MOD for i in range(1, N+1): nex[i] += nex[i-1] nex[i] %= MOD dp = nex print(dp[N] - dp[N-1])