#include<bits/stdc++.h>
using namespace std;
int n,m,t,sx,sy,fx,fy,ans=0;
int a[6][6];
bool vis[6][6];
struct pos{
int x,y;
pos(int ax,int ay){
ax=x; ay=y;
}
};
int main(){
cin>>n>>m>>t;
cin>>sx>>sy>>fx>>fy;
for(int i=1;i<=t;i++){
int x,y;
cin>>x>>y;
a[x][y]=2;
}
queue <pos> q;
q.push(pos(sx,sy));
while(!q.empty()){
pos now=q.front();
q.pop();
int x=now.x,y=now.y;
if(x==fx&&y==fy) ans++;
if(x<1||x>n) continue;
if(y<1||y>m) continue;
if(a[x][y]==2) continue;
if(vis[x][y]) continue;
vis[x][y]=1;
q.push(pos(x+1,y));
q.push(pos(x-1,y));
q.push(pos(x,y+1));
q.push(pos(x,y-1));
}
cout<<ans;
return 0;
}