#include<bits/stdc++.h>
using namespace std;
int ans=0,n,m,t,sx,sy,fx,fy,ifx[4]={0,0,-1,1},ify[4]={-1,1,0,0};
bool b[15][15],txy[15][15];
void dfs(int x,int y){
if(x==fx&&y==fy)
ans++;
else{
for(int i=0;i<=3;i++){
int xx=x+ifx[i],yy=y+ify[i];
if((xx>=1&&xx<=fx) and (yy>=1&&yy<=fy) and b[xx][yy]==0 and txy[xx][yy]==0){
b[xx][yx]=1;
dfs(xx,yy);
b[xx][yy]=0;
}
}
}
}
int main(){
cin>>n>>m>>t;
cin>>sx>>sy>>fx>>fy;
int tx,ty;
for(int i=1;i<=t;i++){
for(int j=1;j<=t;j++){
cin>>tx>>ty;
txy[tx][ty]=1;
}
}
b[sx][sy]=1;
dfs(sx,sy);
cout<<ans;
return 0;
}