from collections import defaultdict,deque class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = self.find(x) y = self.find(y) if x == y: return if self.parents[x] > self.parents[y]: x, y = y, x self.parents[x] += self.parents[y] self.parents[y] = x def size(self, x): return -self.parents[self.find(x)] def same(self, x, y): return self.find(x) == self.find(y) def members(self, x): root = self.find(x) return [i for i in range(self.n) if self.find(i) == root] def roots(self): return [i for i, x in enumerate(self.parents) if x < 0] def group_count(self): return len(self.roots()) def all_group_members(self): group_members = defaultdict(list) for member in range(self.n): group_members[self.find(member)].append(member) return group_members H,W,N,D=map(int,input().split()) XY=[tuple(map(int,input().split())) for _ in range(N)] mp=[[N for _ in range(W+1)] for _ in range(H+1)] for (i,(x,y)) in enumerate(XY):mp[x][y]=i dist=defaultdict(int) dist[(0,0)]=0 Q=deque() Q.append((0,0)) while len(Q): i,j=Q.popleft() if dist[(i,j)]==D:continue for (di,dj) in [(1,0),(-1,0),(0,1),(0,-1)]: ni=i+di nj=j+dj if dist.get((ni,nj)) is None or dist[(i,j)]+10 and sign_cand_cnt[x][y]==0:inc+=1 elif star_cand_cnt[x][y]==0 and sign_cand_cnt[x][y]>0:dec=max(dec,sign_cand_cnt[x][y]) mx=sign_num mn=sign_num if inc>0:mx+=1 if dec>0:mn-=dec-1 print(mn,mx)