import sys from collections import deque readline=sys.stdin.readline N,K,P=map(int,readline().split()) inf=1<<30 A=[[inf]*(i+1) for i in range(N)] queue=deque([]) for _ in range(K): x,y=map(int,readline().split()) x-=1;y-=1 queue.append((x,y)) A[x][y]=0 while queue: x,y=queue.popleft() if 0<=y-1<=x-1=P: ans+=N-prev[j][0]+1 print(ans)