#include <bits/stdc++.h>
using namespace std;
int f[7][7];
int n, m, t;
int re;
int turn[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
void dfs(int x, int y)
{
if (f[y][x] == 2)
{
re++;
return;
}
f[y][x] = 1;
for (int i = 0; i < 4; i++)
{
//判
bool b = 0;
if (y + turn[i][1] >= 1 && y + turn[i][1] <= n)
if (x + turn[i][0] >= 1 && x + turn[i][0] <= m)
if (f[y + turn[i][1]][x + turn[i][0]] != 1)
b = 1;
//递归
if (b)
{
dfs(x + turn[i][0], y + turn[i][1]);
}
}
f[y][x] = 0;//
}
int main()
{
cin >> n >> m >> t;
int stx, sty, enx, eny;
cin >> stx >> sty >> enx >> eny;
f[enx][eny] = 2;
for (int i = 0; i < t; i++)
{
int tx, ty;
cin >> tx >> ty;
f[tx][ty] = 1;
}
f[stx][sty] = 1;
dfs(stx, sty);
cout << re;
return 0;
}