Darts

Program time limit: 1 second

Program memory limit: 512 MB

Given $n$ non-coinciding dartboards, dartboard $i$ has center $(x_i, y_i)$ and radius $r_i$.

You throw $m$ darts, dart $i$ lands at $(dx_i, dy_i)$.

Calculate the total number of darts that land within at least one dartboard. Darts that land on the edge of a dartboard also counts.

Input

The first line contains two space seperated integers $n$ and $m$, the number of dartboards and darts.

The next $n$ lines each contain three space seperated integers $x_i$, $y_i$, and $r_i$, the center and radius of the $i$th dartboard.

The next $m$ lines each contain two space seperated integers $dx_i$ and $dy_i$, the coordinates of where the ith dart landed.

It is guaranteed that the dartboards don't coincide or fully lie on top of each other.

Constraints

For all test cases:

  • $1 \le n, m \le 200\;000$.
  • $-1\;000\;000\;000\le x_i, y_i, dx_i, dy_i \le 1\;000\;000\;000$.
  • $1 \le r_i \le 1\;000\;000\;000$.

Output

Output a single integer, the total number of darts that land within at least one dartboard.

In Python, you could use the line print(answer).

In C or C++, you could use the line printf("%d\n", answer);.

Sample Input 1

1 2
1 1 1
1 1
1 2

Sample Output 1

2

Explanation 1

There is only one dartboard, with center $(1, 1)$ and radius $1$, and the darts lands exactly at the center and on the edge.

Scoring

Your program will be run on the 1 sample case and multiple secret test cases one after another, and if it produces the correct output for all test cases, it solves the task. Recall that your final score on the task is the score of your highest scoring submission.


Submit

Log in to submit!

Past submissions

You haven't submitted to this task.