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 = 128.times.map{ [0] * 128 }
  n.times{ c, r = gets.split.map(&:to_i); fld[r + 64][c + 64] = false }
  sx, sy = gets.split.map(&:to_i).map{ |a| a + 64 }
  pts = 2.times.map{ [] }
  pts[0] << [sy, sx]
  fld[sy][sx] = 1
  t.times do
    pts[0].each do |y, x|
      D.each do |mx, my|
        p, q = y + my, x + mx
        if fld[p][q] == 0
          pts[1] << [p, q]
          fld[p][q] = 1
        end
      end
    end
    pts[0], pts[1] = pts[1], []
  end
  p fld.flatten.count{ |f| f == 1 }
end