#include<bits/stdc++.h>
using namespace std;
long long n,m,stx,sty,ex,ey,t;
long long mp[100][100];
long long ans;
void dfs(long long x,long long y){
if(x == ex and y == ey){
ans++;
return;
}
if(x - 1 >= 1 and mp[x - 1][y] != -1){
mp[x][y] = -1;
dfs(x - 1,y);
mp[x - 1][y] = 0;
}
if(x + 1 <= n and mp[x + 1][y] != -1){
mp[x][y] = -1;
dfs(x + 1,y);
mp[x + 1][y] = 0;
}
if(y + 1 <= m and mp[x][y + 1] != -1){
mp[x][y] = -1;
dfs(x,y + 1);
mp[x][y + 1] = 0;
}
if(y - 1 >= 1 and mp[x][y - 1] != -1){
mp[x][y] = -1;
dfs(x,y - 1);
mp[x][y - 1] = 0;
}
return;
}
int main(){
cin>>n>>m>>t;
cin>>stx>>sty>>ex>>ey;
long long x,y;
while(t--){
cin>>x>>y;
mp[x][y] = -1;
}
dfs(stx,sty);
cout<<ans;
return 0;
}
可以参考一下