Number of pairs - 2#5948

Number of pairs - 2

10 seconds
256 megabytes
Easy

You are given points on the plane. Your task is to answer queries about the number of pairs of points that have a specific distance between them.

Input

The first line contains one integer (1 \leq n \leq 10^6) — the number of points. Each of the next lines contains two integers x_i and y_i (0 \leq x_i, y_i < 10^3) — the coordinates of the -th point. It is guaranteed that all points are distinct.

The next line contains one integer (1 \leq q \leq 10^6) — the number of queries. Each of the next lines contains one integer k_i (0 \leq k_i \leq 10^9) — the queried distance value.

Output

For each query, output on a separate line the number of unordered pairs of points with distance exactly equal to k_i.

Examples

Example 1

Loading
Loading