#include<bits/stdc++.h>
using namespace std;
#define s second
#define f first
int n,m,t,ans;
pair<int,int> x,y,a;
int d[4][2]= {{-1,0},{0,-1},{0,1},{1,0}};
int kkk[6][6];
bool cff_0102[6][6];
void dfs(int w,int z)
{
if (w==y.f&&z==y.s)
{
ans++;
return;
}
else
for (int i=0; i<4; i++)
{
int ccf=w+d[i][0],cff=z+d[i][1];
if (kkk[ccf][cff]==0&&(!cff_0102[ccf][cff]))
{
cff_0102[ccf][cff]=true;
dfs(ccf,cff);
cff_0102[ccf][cff]=false;
}
}
}
int main()
{
cin>>n>>m>>t>>x.f>>x.s>>y.f>>y.s;
for (int i=1; i<=n; i++)
for (int j=1; j<=m; j++)
kkk[i][j]=0;
for (int i=0; i<t; i++)
{
cin>>a.f>>a.s;
kkk[a.f][a.s]=1;
}
dfs(x.f,x.s);
cout<<ans;
return 0;
}
求大佬指教!!!