rt
#include<bits/stdc++.h>
using namespace std;
int n,m,t,sx,sy,ex,ey,ans;
bool a[1145][1145];
int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};
void bfs(int x,int y)
{
for(int i=0;i<4;i++)
{
int nx=x+dx[i];
int ny=y+dy[i];
if(x==ex&&y==ey)
{
ans++;
return;
}
if(nx<=n&&nx>0&&ny<=m&&ny>0&&a[nx][ny]==0)
{
a[nx][ny]=1;
bfs(nx,ny);
a[nx][ny]=0;
}
}
}
int main()
{
cin>>n>>m>>t>>sx>>sy>>ex>>ey;
for(int i=1;i<=t;i++)
{
int nx,ny;
cin>>nx>>ny;
a[nx][ny]=1;
}
bfs(sx,sy);
cout<<ans;
return 0;
}