### constant

MAX_CRD = 10000
NUM_DIV = 100

DXYS = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]

### subroutines

def close?(x0, y0, x1, y1, d)
  ((x1 - x0) ** 2 + (y1 - y0) ** 2 <= d * d)
end

def cross_cr_sq?(cx, cy, cr, rx0, ry0, rx1, ry1)
  # center of circle is inside of square
  return true if cx >= rx0 && cx <= rx1 && cy >= ry0 && cy <= ry1

  # one of corners of square is inside of circle
  return true if
    close?(rx0, ry0, cx, cy, cr) ||
    close?(rx0, ry1, cx, cy, cr) ||
    close?(rx1, ry0, cx, cy, cr) ||
    close?(rx1, ry1, cx, cy, cr)

  # one of edges of square intersects with circle
  return true if
    (cx >= rx0 && cx <= rx1 &&
     ((cy - ry0).abs <= cr || (ry1 - cy).abs <= cr)) ||
    (cy >= ry0 && cy <= ry1 &&
     ((cx - rx0).abs <= cr || (rx1 - cx).abs <= cr))

  false
end

### main

sql = MAX_CRD / NUM_DIV

loop do
  an, bn, r = gets.split.map(&:to_i)
  break if (an | bn | r) == 0

  rr = r * r
  r4 = r * 4
  rr4 = r4 * r4

  ars = NUM_DIV.times.map{NUM_DIV.times.map{[]}}

  an.times do
    ax, ay = gets.split.map(&:to_i)

    xi = ax / sql
    yi = ay / sql

    ars[yi][xi] << [ax, ay]

    for dxy in DXYS
      xi0 = xi + dxy[0]
      yi0 = yi + dxy[1]
      if xi0 >= 0 && xi < NUM_DIV && yi >= 0 && yi < NUM_DIV
        rx0 = xi0 * sql
        ry0 = yi0 * sql
        if cross_cr_sq?(ax, ay, r4, rx0, ry0, rx0 + sql, ry0 + sql)
          ars[yi0][xi0] << [ax, ay]
        end
      end
    end
  end
  #p ars

  power = 0

  bn.times do
    bx, by = gets.split.map(&:to_i)

    xi = bx / sql
    yi = by / sql

    for axy in ars[yi][xi]
      if close?(bx, by, axy[0], axy[1], r4)
        power += 1
      end
    end
  end

  puts power
end