import sys input=sys.stdin.readline def main2(n,m,k,lr): mod=10**9+7 dp=[0]*(n+1) dp[1]=1 now=0 cnt_ary=[0]*(n+1) for l,r in lr: cnt_ary[l]+=1 if r!=n:cnt_ary[r+1]-=1 for i in range(n):cnt_ary[i+1]+=cnt_ary[i] for _ in range(k): ndp=[0]*(n+1) sdp=[0] for x in dp:sdp.append((sdp[-1]+x)%mod) mat0=[0]*(n+1) mat1=[0]*(n+1) for l,r in lr: mat0[r]+=sdp[r+1]-sdp[l] mat1[l]+=sdp[r+1]-sdp[l] # 下からの遷移。同じ階の移動も含む for j in range(1,n+1): # j階への遷移 now+=cnt_ary[j]*dp[j] now%=mod ndp[j]+=now ndp[j]%=mod now-=mat0[j] now%=mod # 上からの遷移。同じ階の移動は含まない for j in reversed(range(1,n+1)): # j階への遷移 ndp[j]+=now ndp[j]%=mod now+=cnt_ary[j]*dp[j] now-=mat1[j] now%=mod dp=ndp return dp[n] if __name__=='__main__': n,m,k=map(int,input().split()) lr=[list(map(int,input().split())) for _ in range(m)] ret2=main2(n,m,k,lr) print(ret2)