#include<stdio.h>

int visited[8][8], m, n, ans = 0;
const int directions[8][2] = {{1,  2},
    {2,  1},
    {-1, 2},
    {-2, 1},
    {1,  -2},
    {2,  -1},
    {-1, -2},
    {-2, -1}
};

void dfs(int x, int y, int count) {
    if (count == m * n) {
        ans++;
        return;
    }
    for (int i = 0; i < 8; i++) {
        int nx = x + directions[i][0], ny = y + directions[i][1];
        if (nx >= 0 && nx < m && ny >= 0 && ny < n && !visited[nx][ny]) {
            visited[nx][ny] = 1;
            dfs(nx, ny, count + 1);
            visited[nx][ny] = 0;
        }
    }
}

int main() {
    int a, b, t;
    scanf("%d%d%d%d%d", &m, &n, &a, &b, &t);
    for (int i = 0; i < t; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        if (x == a && y == b) {
            printf("0");
            return 0;
        }
        visited[x - 1][y - 1] = 1;
    }
    visited[a - 1][b - 1] = 1;
    dfs(a - 1, b - 1, 1 + t);
    printf("%d\n", ans);
    return 0;
}