D = [[-1, -1], [-1, 0], [0, 1], [1, 1], [1, 0], [0, -1]]
loop do
  t, n = gets.split.map(&:to_i)
  break if t == 0
  fld = 61.times.map{ [0] * 61 }
  n.times{ r, c = gets.split.map(&:to_i); fld[r + 30][c + 30] = false }
  ar = []
  ar << [*gets.split.map(&:to_i).map{ |a| a + 30 }, 0]
  until ar.empty?
    y, x, step = ar.shift
    fld[y][x] = 1
    if step < t
      D.each do |my, mx|
        p, q = y + my, x + mx
        if fld[p][q] == 0
          ar << [p, q, step + 1]
        end
      end
    end
  end
  p fld.flatten.count{ |f| f == 1 }
end