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