n, m, k = map(int, input().split()) info = [list(map(int, input().split())) for i in range(m)] MOD = 10**9 + 7 for i in range(m): info[i][0] = info[i][0] - 1 info[i][1] = info[i][1] - 1 # dp[i][j] := i回乗った時点でj階にいるときの通り数 dp = [[0]*n for _ in range(k+1)] dp_sum = [0]*(n+1) dp[0][0] = 1 for move_times in range(k): for floor in range(n): dp_sum[floor + 1] = dp_sum[floor] + dp[move_times][floor] dp_sum[floor + 1] %= MOD imos = [0]*(n+1) for elev in range(m): imos[info[elev][0]] += dp_sum[info[elev][1] + 1] - dp_sum[info[elev][0]] imos[info[elev][1] + 1] -= dp_sum[info[elev][1] + 1] - dp_sum[info[elev][0]] for floor in range(n): imos[floor + 1] = imos[floor + 1] + imos[floor] imos[floor + 1] %= MOD for floor in range(n): dp[move_times + 1][floor] += imos[floor] dp[move_times + 1][floor] %= MOD print(dp[k][n-1])