def root(x): p=x l=[p] while r[p]!=p: p=r[p] l+=[p] for p in l: r[p]=l[-1] return r[x] def union(x,y): rx=root(x) ry=root(y) if rx==ry: return if rx>ry: rx,ry=ry,rx r[ry]=rx v[rx]+=v[ry] return h,w,n,d=map(int,input().split()) s=[[0]*w for i in range(h)] r=list(range(h*w)) v=[1]*h*w for i in range(n): x,y=map(int,input().split()) x-=1 y-=1 for dx in range(-d,d+1): for dy in range(-d,d+1): xx,yy=x+dx,y+dy if dx+dy<=d and 0<=xx1 for i in range(h*w)) a=[] for x in range(h): for y in range(w): if s[x][y]: continue p=set() for dx in range(-d,d+1): for dy in range(-d,d+1): xx,yy=x+dx,y+dy if dx+dy<=d and 0<=xx1: p.add(root(xx*w+yy)) c=len(p) a+=[C-c+1 if c>0 else C] p=set() for dx in range(-d,d+1): for dy in range(-d,d+1): xx,yy=x+dx,y+dy if dx+dy<=d and 0<=xx0 and all(i==1 for i in p): a+=[C+1] a2=C+c print(min(a),max(a))