from numpy import *
n, m, r = map(int, input().strip().split())
net = zeros((n+2r, n+2r), dtype=int)
for i in range(m):
x, y = map(int, input().strip().split())
for j in range(-r, 0):
net[x-1-j:x+2r+j, y-1+r+j] = 1
for j in range(r+1):
net[x-1+j:x+2r-j, y-1+r+j] = 1
subNet = net[r:n+r, r:n+r]
print(subNet)
print(sum(subNet == 1))