#!/usr/bin/env python3.8 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np MOD = 10 ** 9 + 7 # %% N, M, K = map(int, readline().split()) LR = np.array(read().split(), np.int32) L = LR[::2] R = LR[1::2] L.flags.writeable = False R.flags.writeable = False # %% dp = np.zeros(N + 2, np.int64) dp[1] = 1 for _ in range(K): newdp = np.zeros_like(dp) np.cumsum(dp, out=dp) dp %= MOD x = dp[R] - dp[L - 1] np.add.at(newdp, L, x) np.add.at(newdp, R + 1, -x) np.cumsum(newdp, out=newdp) newdp %= MOD dp = newdp # %% print(dp[N])