#include using namespace std; using int64 = long long; template< int mod > struct Combination { vector< int64_t > mfact, rfact; Combination(int sz) : mfact(sz + 1), rfact(sz + 1) { mfact[0] = 1; for(int i = 1; i < mfact.size(); i++) { mfact[i] = mfact[i - 1] * i % mod; } rfact[sz] = inv(mfact[sz]); for(int i = sz - 1; i >= 0; i--) { rfact[i] = rfact[i + 1] * (i + 1) % mod; } } int64_t fact(int k) const { return (mfact[k]); } int64_t pow(int64_t x, int64_t n) const { int64_t ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= mod; (x *= x) %= mod; n >>= 1; } return (ret); } int64_t inv(int64_t x) const { return (pow(x, mod - 2)); } int64_t P(int n, int r) const { if(r < 0 || n < r) return (0); return (mfact[n] * rfact[n - r] % mod); } int64_t C(int p, int q) const { if(q < 0 || p < q) return (0); return (mfact[p] * rfact[q] % mod * rfact[p - q] % mod); } int64_t H(int n, int r) const { if(n < 0 || r < 0) return (0); return (r == 0 ? 1 : C(n + r - 1, r)); } }; const int mod = 1e8 + 7; int main() { int H, W, K; int A[20], B[20]; scanf("%d %d %d", &H, &W, &K); vector< int > ord(K); for(int i = 0; i < K; i++) { scanf("%d %d", &A[i], &B[i]); ord[i] = i; } sort(begin(ord), end(ord), [&](int a, int b) { return make_pair(A[a], B[a]) < make_pair(A[b], B[b]); }); Combination< mod > latte(H + W + 2); vector< int64 > dp(1 << K); pair< int, int > xs[22]; for(int i = 0; i < (1 << K); i++) { int ptr = 0; xs[ptr++] = {0, 0}; for(int j : ord) { if((i >> j) & 1) xs[ptr++] = {A[j], B[j]}; } xs[ptr++] = {H, W}; int64 mul = 1; for(int j = 1; j < ptr; j++) { int dy = xs[j].first - xs[j - 1].first; int dx = xs[j].second - xs[j - 1].second; (mul *= latte.C(dy + dx, dy)) %= mod; } if(__builtin_parity(i)) dp[i] = (mod - mul) % mod; else dp[i] = mul; } for(int i = 0; i < K; i++) { for(int j = 0; j < (1 << K); j++) { if(j & (1 << i)) (dp[j] += dp[j ^ (1 << i)]) %= mod; } } for(int i = 0; i < (1 << K); i++) { printf("%lld\n", dp[i]); } }