#P2074. 危险区域

危险区域

Description

In a city there are N×MN \times M blocks, each described by coordinates, as shown below:

11 22 33 \cdots MM
11 (1,1)(1,1) (1,2)(1,2) (1,3)(1,3) \cdots (1,M)(1,M)
22 (2,1)(2,1) (2,2)(2,2) (2,3)(2,3) (2,M)(2,M)
33 (3,1)(3,1) (3,2)(3,2) (3,3)(3,3) (3,M)(3,M)
\vdots \ddots
NN (N,1)(N,1) (N,2)(N,2) (N,3)(N,3) \cdots (N,M)(N,M)

It is known that a terrorist organization has planted a time bomb in one of the blocks, with power tt, meaning all blocks whose straight-line (Euclidean) distance to that block is less than or equal to tt will be threatened. There are kk possible bomb locations. The chief wants to know, in the worst case, how many blocks will be threatened.

Input Format

The first line contains four positive integers n,m,k,tn, m, k, t.

The next kk lines each contain two positive integers xi,yix_i, y_i, describing each possible block where the bomb may be placed.

Output Format

Output a single positive integer: the number of blocks that will be threatened in the worst case.

4 5 3 2
1 2
3 4
4 5

11

Hint

Constraints

For 20%20\% of the testdata, k=1k = 1.

For 50%50\% of the testdata, 1n,m10001 \le n, m \le 1000, 1k201 \le k \le 20, 1t1001 \le t \le 100.

For 100%100\% of the testdata, 1n,m1051 \le n, m \le 10^5, 1k501 \le k \le 50, t300t \le 300.

fixed by @Cppsteve\color{#5EB95E}{\textsf{Cppsteve}}

Translated by ChatGPT 5