Under construction

Still being built. Things may change

Siru's Walk

Time limit1sMemory limit1024 MB

Summary
Given pillars on a plane and circular smell zones from other dogs, count the most pillars Siru can mark with its own smell of radius R0.
Level

Medium5 of 10

Topics
Geometry, Brute force
Solved
No attempts yet

Problem

Marking is the act of a dog marking its territory with urine.

Siru, a cute dog, walks on a two-dimensional plane. While walking, Siru marks the pillars it passes. Because Siru is afraid of other dogs, it does not mark a pillar where the smell of another dog's urine is present.

Specifically, there are NN pillars along the walking path, and other dogs have already made MM marks. The ii-th mark (1≤i≤M1 \leq i \leq M) is on pillar PiP_i, and its smell spreads up to a distance of RiR_i from that pillar.

Siru marks a pillar that has no smell of another dog, and its smell spreads up to a distance of R0R_0 from that pillar. If Siru's smell covers a pillar that had another dog's smell, Siru can mark that pillar.

Find the maximum number of pillars Siru can mark.

The distance between two pillars (Xi,Yi)(X_i, Y_i) and (Xj,Yj)(X_j, Y_j) is defined as (Xi−Xj)2+(Yi−Yj)2\sqrt{(X_i-X_j)^2 + (Y_i-Y_j)^2}.

Input

The first line contains NN and MM, separated by a space.

From line 2 to line N+1N+1, line i+1i+1 contains the coordinates Xi,YiX_i, Y_i of pillar ii, separated by a space.

Line N+2N+2 contains P1,P2,⋯ ,PMP_1, P_2, \cdots, P_M, separated by spaces.

Line N+3N+3 contains R0,R1,R2,⋯ ,RMR_0, R_1, R_2, \cdots, R_M, separated by spaces.

Output

Print the number of pillars Siru can mark.

Constraints

  • 1≤N≤3 0001 \leq N \leq 3\,000
  • 1≤M≤3 0001 \leq M \leq 3\,000
  • 1≤Pi≤N1 \leq P_i \leq N
  • 1≤Xi,Yi,Ri≤30 0001 \leq X_i,Y_i,R_i \leq 30\,000, and all XiX_i, YiY_i, RiR_i are integers

Examples1

  1. Example 1

    Input
    3 1
    1 1
    4 1
    4 5
    3
    3 4
    
    Expected output
    2