#include using namespace std; typedef long long signed int LL; typedef long long unsigned int LU; #define incID(i, l, r) for(int i = (l) ; i < (r); i++) #define incII(i, l, r) for(int i = (l) ; i <= (r); i++) #define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--) #define decII(i, l, r) for(int i = (r) ; i >= (l); i--) #define inc(i, n) incID(i, 0, n) #define inc1(i, n) incII(i, 1, n) #define dec(i, n) decID(i, 0, n) #define dec1(i, n) decII(i, 1, n) #define inII(v, l, r) ((l) <= (v) && (v) <= (r)) #define inID(v, l, r) ((l) <= (v) && (v) < (r)) #define PB push_back #define EB emplace_back #define MP make_pair #define FI first #define SE second #define PQ priority_queue #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define FOR(it, v) for(auto it = v.begin(); it != v.end(); ++it) #define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it) template bool setmin(T & a, T b) { if(b < a) { a = b; return true; } else { return false; } } template bool setmax(T & a, T b) { if(b > a) { a = b; return true; } else { return false; } } template bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } } template bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } } template T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); } template T lcm(T a, T b) { return a / gcd(a, b) * b; } // ---- ---- #define bit(b, i) (((b) >> (i)) & 1) #define bc __builtin_popcountll const int M = 200000; int h, w, k, x[20], y[20]; LL f[M + 1], fi[M + 1], s[1 << 20], MOD = 1e8 + 7; int main() { cin >> h >> w >> k; inc(i, k) { cin >> x[i] >> y[i]; } f[0] = 1; inc1(i, M) { f[i] = f[i - 1] * i % MOD; } fi[M] = 56264037; dec(i, M) { fi[i] = fi[i + 1] * (i + 1) % MOD; } inc(b, 1 << k) { vector> v; v.EB(0, 0); v.EB(h, w); inc(i, k) { if(bit(b, i)) { v.EB(x[i], y[i]); } } sort(ALL(v)); s[b] = (bc(b) % 2 == 0 ? +1 : MOD - 1); inc(i, v.size() - 1) { int X = v[i + 1].FI - v[i].FI; int Y = v[i + 1].SE - v[i].SE; (s[b] *= (Y < 0 ? 0 : fi[X] * fi[Y] % MOD * f[X + Y] % MOD)) %= MOD; } } inc(i, k) { inc(b, 1 << k) { if(bit(b, i)) { s[b] += s[b ^ (1 << i)]; } } } inc(b, 1 << k) { cout << s[b] % MOD << "\n"; } return 0; }