module Graphical
	require 'set'
	def reachable_from(s, max_depth = nil)
		reached = Set[s]
		queue = [s]
		depth = 0
		loop {
			break if max_depth && depth >= max_depth
			next_queue = []
			until queue.empty?
				u = queue.shift
				each_neighbour_of(u){|v|
					next if reached.include?(v)
					reached << v
					next_queue << v
				}
			end
			break if next_queue.empty?
			queue = next_queue
			depth += 1
		}
		return reached
	end
end

loop {
	t, n = gets.split.map &:to_i
	break if t == 0
	g = (0..120).map { [0] * 120 }
	n.times {
		x, y = gets.split.map &:to_i
		g[x+60][y+60] = 1
	}

	g.extend Graphical
	$diff = [[1,0], [1,1], [0,1], [-1,0], [-1,-1], [0,-1]]
	def g.each_neighbour_of(u)
		x1, y1 = u
		$diff.each{|dx, dy|
			x2, y2 = x1+dx, y1+dy
			next if self[x2][y2] == 1
			yield [x2, y2] 
		}
	end

	sx, sy = gets.split.map &:to_i
	p g.reachable_from([sx+60, sy+60], t).size
}