# 行列の乗算(mod) from regex import R def mat_mul(a, b): I, K, J = len(a), len(b), len(b[0]) c = [[0 for j in range(J)] for i in range(I)] for i in range(I): for k in range(K): for j in range(J): c[i][j] += a[i][k] * b[k][j] c[i][j] %= mod return c # 行列の累乗(mod) def mat_pow(a, n): b = [[0 for j in range(len(a))] for i in range(len(a))] for i in range(len(a)): b[i][i] = 1 while n > 0: if n & 1: b = mat_mul(b, a) a = mat_mul(a, a) n >>= 1 return b class Bit: def __init__(self, n): self.size = n self.tree = [0] * (n + 1) def sum(self, i): s = 0 while i > 0: s += self.tree[i] i -= i & -i return s def add(self, i, x): while i <= self.size: self.tree[i] += x i += i & -i mod = 10**9+7 n,m,k = map(int,input().split()) st = [[0]*n for i in range(n)] lr = [[int(i) for i in input().split()] for j in range(m)] for i in range(1,n+1): ki = Bit(n+1) for j in range(m): l,r = lr[j] if l <= i <= r: #print(i,j,2) ki.add(l,1) ki.add(r+1,-1) for j in range(1,n+1): st[i-1][j-1] = ki.tree[j] #print(st) #print(ki) #exit() A = mat_pow(st,k) print(A[0][n-1]%mod)