SX = 100
SY = 100
dx = [-1, -1, 0, 0, 1, 1]
dy = [-1, 0, -1, 1, 0, 1]

loop do
  t, n = gets.chomp.split.map(&:to_i)

  if t | n == 0
    break
  end

  visited = Array.new(200) {
    Array.new(200, 0)
  }

  field = Array.new(200) {
    Array.new(200, 0)
  }
  
  n.times do
    x, y = gets.chomp.split.map(&:to_i)
    field[y + SY][x + SX] = 1
  end

  sx, sy = gets.chomp.split.map(&:to_i)
  sx += SX
  sy += SY

  queue = [[sx, sy, 0]]
  visited[sy][sx] = 1

  while !queue.empty? do
    tmp = queue.shift

    if tmp[2] + 1 > t
      next
    end
    
    6.times do |i|
      nx = tmp[0] + dx[i]
      ny = tmp[1] + dy[i]
      
      if field[ny][nx] == 1 || visited[ny][nx] == 1
        next
      end

      visited[ny][nx] = 1
      queue.push([nx, ny, tmp[2] + 1])
    end
  end

  ans = 0;
  200.times do |i|
    200.times do |j|
      if visited[i][j] == 1
        ans += 1
      end
    end
  end
                          
  puts ans
end