#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi pair<ll,ll>
#define pii pair<pi,ll>
#define f first
#define s second
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
const int mod = 1e9+7;
int N,M;
void recH(int R,int C,int logM,vector<vector<int > >&H,vector<int >&dp) {
int cur = R*(M+1)+C;
for(int j=0;j<=logM;j++) {
if(j==0) {
if(C&(1<<j)) H[cur][j] = dp[cur]+dp[R*(M+1)+(C^(1<<j))];
else H[cur][j] = dp[cur];
if(H[cur][j]>=mod) H[cur][j]-=mod;
continue;
}
if(C&(1<<j)) {
H[cur][j] = H[R*(M+1)+(C^(1<<j))][j-1] + H[cur][j-1];
if(H[cur][j]>=mod) H[cur][j]-=mod;
}
else{
H[cur][j] = H[cur][j-1];
}
}
}
void recV(int R,int C,int logN,vector<vector<int > >&V,vector<int >&dp) {
int cur = R*(M+1)+C;
for(int j=0;j<=logN;j++) {
if(j==0) {
if(R&(1<<j)) V[cur][j] = dp[cur]+dp[(R^(1<<j))*(M+1)+ C];
else V[cur][j] = dp[cur];
if(V[cur][j]>=mod) V[cur][j]-=mod;
continue;
}
if(R&(1<<j)) {
V[cur][j] = V[(R^(1<<j))*(M+1)+C][j-1] + V[cur][j-1];
if(V[cur][j]>=mod) V[cur][j]-=mod;
}
else{
V[cur][j] = V[cur][j-1];
}
}
}
int main() {
cin >> N >> M;
bool flag = 0;
if(N>M) {
swap(N,M);
flag = 1;
}
int logN = log2(N);
int logM = log2(M);
int Q;
cin >> Q;
int x,y;
vector<vector<int> >V((N+1)*(M+1),vector<int>(logN+1,-1));
vector<vector<int> >H((N+1)*(M+1),vector<int>(logM+1,-1));
vector<int>dp((N+1)*(M+1),0);
while(Q--) {
cin >> x >> y;
if(flag) {
swap(x,y);
}
dp[x*(M+1)+y] = -1;
}
dp[0] = 1;
recH(0,0,logM,H,dp);
recV(0,0,logN,V,dp);
rep(i,N+1) {
rep(j,M+1) {
if(i==0 and j==0) continue;
if(dp[i*(M+1)+j]==-1) {
dp[i*(M+1)+j] = 0;
recH(i,j,logM,H,dp);
recV(i,j,logN,V,dp);
continue;
}
int cur = i*(M+1)+j;
recH(i,j,logM,H,dp);
recV(i,j,logN,V,dp);
dp[cur] = H[cur][logM]+V[cur][logN];
if(dp[cur]>=mod) dp[cur]-=mod;
recH(i,j,logM,H,dp);
recV(i,j,logN,V,dp);
}
}
cout << dp[N*(M+1)+M]%mod;
}
CgogICAgI2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KICAgIHVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAgICAjZGVmaW5lIGxsIGxvbmcgbG9uZyBpbnQKICAgICNkZWZpbmUgcGkgcGFpcjxsbCxsbD4KICAgICNkZWZpbmUgcGlpIHBhaXI8cGksbGw+CiAgICAjZGVmaW5lIGYgZmlyc3QKICAgICNkZWZpbmUgcyBzZWNvbmQKICAgICNkZWZpbmUgcmVwKGksbikgZm9yKGludCBpPTA7aTxuO2krKykKICAgICNkZWZpbmUgcGIgcHVzaF9iYWNrCiAgICBjb25zdCBpbnQgbW9kID0gMWU5Kzc7CiAgICBpbnQgTixNOwogICAgdm9pZCByZWNIKGludCBSLGludCBDLGludCBsb2dNLHZlY3Rvcjx2ZWN0b3I8aW50ID4gPiZILHZlY3RvcjxpbnQgPiZkcCkgewogICAgICAgICAgIGludCBjdXIgPSBSKihNKzEpK0M7CiAgICAgICAgZm9yKGludCBqPTA7ajw9bG9nTTtqKyspIHsKICAgICAgICAgICAgaWYoaj09MCkgewogICAgICAgICAgICAgICAgaWYoQyYoMTw8aikpIEhbY3VyXVtqXSA9IGRwW2N1cl0rZHBbUiooTSsxKSsoQ14oMTw8aikpXTsKICAgICAgICAgICAgICAgIGVsc2UgSFtjdXJdW2pdID0gZHBbY3VyXTsKICAgICAgICAgICAgICAgIGlmKEhbY3VyXVtqXT49bW9kKSBIW2N1cl1bal0tPW1vZDsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmKEMmKDE8PGopKSB7CiAgICAgICAgICAgICAgICBIW2N1cl1bal0gPSBIW1IqKE0rMSkrKENeKDE8PGopKV1bai0xXSArIEhbY3VyXVtqLTFdOwogICAgICAgICAgICAgICAgaWYoSFtjdXJdW2pdPj1tb2QpIEhbY3VyXVtqXS09bW9kOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2V7CiAgICAgICAgICAgICAgICBIW2N1cl1bal0gPSBIW2N1cl1bai0xXTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHZvaWQgcmVjVihpbnQgUixpbnQgQyxpbnQgbG9nTix2ZWN0b3I8dmVjdG9yPGludCA+ID4mVix2ZWN0b3I8aW50ID4mZHApIHsKICAgICAgICBpbnQgY3VyID0gUiooTSsxKStDOwogICAgICAgIGZvcihpbnQgaj0wO2o8PWxvZ047aisrKSB7CiAgICAgICAgICAgIGlmKGo9PTApIHsKICAgICAgICAgICAgICAgIGlmKFImKDE8PGopKSBWW2N1cl1bal0gPSBkcFtjdXJdK2RwWyhSXigxPDxqKSkqKE0rMSkrICBDXTsKICAgICAgICAgICAgICAgIGVsc2UgVltjdXJdW2pdID0gZHBbY3VyXTsKICAgICAgICAgICAgICAgIGlmKFZbY3VyXVtqXT49bW9kKSBWW2N1cl1bal0tPW1vZDsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmKFImKDE8PGopKSB7CiAgICAgICAgICAgICAgICBWW2N1cl1bal0gPSBWWyhSXigxPDxqKSkqKE0rMSkrQ11bai0xXSArIFZbY3VyXVtqLTFdOwogICAgICAgICAgICAgICAgaWYoVltjdXJdW2pdPj1tb2QpIFZbY3VyXVtqXS09bW9kOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2V7CiAgICAgICAgICAgICAgICBWW2N1cl1bal0gPSBWW2N1cl1bai0xXTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIGludCBtYWluKCkgewogICAgICAgIGNpbiA+PiBOID4+IE07CiAgICAgICAgYm9vbCBmbGFnID0gMDsKICAgICAgICBpZihOPk0pIHsKICAgICAgICAJc3dhcChOLE0pOwogICAgICAgIAlmbGFnID0gMTsKICAgICAgICB9CiAgICAgICAgaW50IGxvZ04gPSBsb2cyKE4pOwogICAgICAgIGludCBsb2dNID0gbG9nMihNKTsKICAgICAgICBpbnQgUTsKICAgICAgICBjaW4gPj4gUTsKICAgICAgICBpbnQgeCx5OwogICAgICAgIHZlY3Rvcjx2ZWN0b3I8aW50PiA+VigoTisxKSooTSsxKSx2ZWN0b3I8aW50Pihsb2dOKzEsLTEpKTsKICAgICAgICB2ZWN0b3I8dmVjdG9yPGludD4gPkgoKE4rMSkqKE0rMSksdmVjdG9yPGludD4obG9nTSsxLC0xKSk7CiAgICAgICAgdmVjdG9yPGludD5kcCgoTisxKSooTSsxKSwwKTsKICAgICAgICB3aGlsZShRLS0pIHsKICAgICAgICAgICAgY2luID4+IHggPj4geTsKICAgICAgICAgICAgaWYoZmxhZykgewogICAgICAgICAgICAJc3dhcCh4LHkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGRwW3gqKE0rMSkreV0gPSAtMTsKICAgICAgICB9CiAgICAgICAgZHBbMF0gPSAxOwogICAgICAgIHJlY0goMCwwLGxvZ00sSCxkcCk7CiAgICAgICAgcmVjVigwLDAsbG9nTixWLGRwKTsKICAgICAgICByZXAoaSxOKzEpIHsKICAgICAgICAgICAgcmVwKGosTSsxKSB7CiAgICAgICAgICAgICAgICBpZihpPT0wIGFuZCBqPT0wKSBjb250aW51ZTsKICAgICAgICAgICAgICAgIGlmKGRwW2kqKE0rMSkral09PS0xKSB7CiAgICAgICAgICAgICAgICAgICAgZHBbaSooTSsxKStqXSA9IDA7CiAgICAgICAgICAgICAgICAgICAgcmVjSChpLGosbG9nTSxILGRwKTsKICAgICAgICAgICAgICAgICAgICByZWNWKGksaixsb2dOLFYsZHApOwogICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaW50IGN1ciA9IGkqKE0rMSkrajsKICAgICAgICAgICAgICAgIHJlY0goaSxqLGxvZ00sSCxkcCk7CiAgICAgICAgICAgICAgICByZWNWKGksaixsb2dOLFYsZHApOwogICAgICAgICAgICAgICAgZHBbY3VyXSA9IEhbY3VyXVtsb2dNXStWW2N1cl1bbG9nTl07CiAgICAgICAgICAgICAgICBpZihkcFtjdXJdPj1tb2QpIGRwW2N1cl0tPW1vZDsKICAgICAgICAgICAgICAgIHJlY0goaSxqLGxvZ00sSCxkcCk7CiAgICAgICAgICAgICAgICByZWNWKGksaixsb2dOLFYsZHApOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgZHBbTiooTSsxKStNXSVtb2Q7CiAgICB9Cgo=