fun main(args:Array<String>?): Unit {
    val hex = Array(121){BooleanArray(121){false}}
    while(true){
        val (t, n) = readLine()!!.trim().split(' ').map(String::toInt)
        if (t == 0 && n == 0) return
        hex.forEach { it.fill(false) }
        repeat(n){
            val (x, y) = readLine()!!.trim().split(' ').map(String::toInt)
            hex[y + 60][x + 60] = true
        }
        val (sx, sy) = readLine()!!.trim().split(' ').map{it.toInt() + 60}
        hex[sy][sx] = true
        var current = listOf(HexPoint(sx, sy))
        repeat(t){
            current = current.flatMap {it.neighbors().filterNot{p -> hex[p.y][p.x]}}.distinct()
            current.forEach{hex[it.y][it.x] = true}
        }
        println(hex.sumBy{line -> line.count{it}} - n)
    }
}
data class HexPoint(val x: Int, val y: Int){
    fun neighbors(): Iterable<HexPoint> = listOf(HexPoint(0, 1), HexPoint(1, 1), HexPoint(1, 0), HexPoint(0, -1), HexPoint(-1, -1), HexPoint(-1, 0)).map{it + this}
    private operator fun plus(that: HexPoint): HexPoint = HexPoint(x + that.x, y + that.y)
}
