import sys input=lambda: sys.stdin.readline().rstrip() n,m,k=map(int,input().split()) LR=[tuple(int(i) for i in input().split()) for _ in range(m)] E=[[0]*n for _ in range(n)] for l,r in LR: E[l-1][l-1]+=1 if r0: if x&1==1: b=mul(a,b) a=mul(a,a) x>>=1 return b EK=matrix_pow(E,k) print(EK[0][n-1])