#include <iostream>
using namespace std;
bool map[6][6];
int m, n, t;
unsigned long long ans = 0;
short dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
void dfs(int x, int y){
if(x == n && y == n){
ans++;
return;
}
if(x < 1 || y < 1) return;
if(x > n || y > n) return;
if(map[x][y] == false) return;
ans++;
map[x][y] = false;
for(int i=0; i<4; i++)
dfs(x+dx[i], y+dy[i]);
map[x][y] = true;
}
int main(){
cin >> m >> n >> t;
for(int i=1; i<=n; i++)
for(int j=1; j<=m; j++)
map[i][j] = true;
int x1, y1;
while(t--){
cin >> x1 >> y1;
map[x1][y1] = false;
}
dfs(1, 1);
cout << ans << endl;
return 0;
}