#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>

#define INF (int)1e09

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::min;
using std::max;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;

template <typename T> using Vec = vector<T>; // c++11
typedef pair<int, int> PII;
typedef pair<int, pair<int, int> > PIII;

struct Coord {
    int y;
    int x;

    Coord() {}
    Coord(int y0, int x0) {
        y = y0;
        x = x0;
    }
};

int dx[6] = {-1, -1, 0, 0, 1, 1};
int dy[6] = {-1, 0, -1, 1, 0, 1};

void dump (Vec<Vec<int> > &table, int t) {
    for (int i = 0; i < 2 * t + 3; i++) {
        for (int j = 0; j < 2 * t + 3; j++) {
            cout << table[i][j] << " ";
        }
        cout << endl;
    }
    return;
}

void bfs (Vec<Vec<int> > &table, int t) {
    queue<pair<int, Coord> > que;
    Coord start(t + 1, t + 1);
    que.push(make_pair(0, start));

    while (!que.empty()) {
        int dist = que.front().first;
        Coord coord = que.front().second;
        que.pop();

        for (int i = 0; i < 6; i++) {
            Coord new_coord(coord.y + dy[i], coord.x + dx[i]);
            if (table[new_coord.y][new_coord.x] == -1) {
                que.push(make_pair(dist + 1, new_coord));
                table[new_coord.y][new_coord.x] = dist + 1;
            }
        }
    }
    return;
}

int check (Vec<Vec<int> > &table, int t) {
    int count = 0;
    for (int i = 1; i < 2 * t + 2; i++) {
        for (int j = 1; j < 2 * t + 2; j++) {
            if (table[i][j] >= 0 && table[i][j] <= t) {
                count++;
            }
        }
    }
    return count;
}

int main(void) {
    while (1) {
        int t;
        int n;
        cin >> t >> n;
        if (t == 0 && n == 0) {
            break;
        }
        Vec<Vec<int> > table(2 * t + 3, Vec<int>(2 * t + 3, INF));
        for (int i = 1; i < 2 * t + 2; i++) {
            for (int j = 1; j < 2 * t + 2; j++) {
                table[i][j] = -1;
            }
        }

        Vec<Coord> temp(n);
        for (int i = 0; i < n; i++) {
            cin >> temp[i].x >> temp[i].y;
        }

        Coord start;
        cin >> start.x >> start.y;
        table[t + 1][t + 1] = 0;

        for (int i = 0; i < n; i++) {
            if (abs(temp[i].y -start.y) > t || abs(temp[i].x -start.x) > t) {
                //cout << "HEREIF" << endl;
                //cout << temp[i].x << " " << temp[i].y << endl;
                continue;
            }
            //cout << "HERE" << endl;
            //cout << temp[i].x << " " << temp[i].y << endl;
            table[temp[i].y - start.y + t + 1][temp[i].x - start.x + t + 1] = INF;
        }

        //dump(table, t);
        bfs(table, t);
        //dump(table, t);
        cout << check(table, t) << endl;

    }
    return 0;
}

Measured memory_bytes: 3088