#include #include #define M 100000007 struct mint { int n; mint(int n_ = 0) : n(n_) {} }; mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= M) { a.n -= M; } return a; } mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) { a.n += M; } return a; } mint operator*(mint a, mint b) { return (long long)a.n * b.n % M; } mint &operator-=(mint &a, mint b) { return a = a - b; } mint &operator*=(mint &a, mint b) { return a = a * b; } mint fact[200001] = {1,1}; mint ifact[200001] = {1,1}; mint inv[200001] = {0,1}; void init() { for (int i = 2; i <= 200000; i++) { inv[i] = inv[M % i] * (M - M / i); fact[i] = fact[i - 1] * i; ifact[i] = ifact[i - 1] * inv[i]; } } mint C(int n, int r) { if (n < 0 || r < 0 || n < r) return 0; return fact[n] * ifact[n - r] * ifact[r]; } struct P { int y, x; }; bool operator<(P a, P b) { return a.y + a.x < b.y + b.x; } int H, W, K; P ps[20]; mint ans[1 << 20]; int main() { init(); scanf("%d %d %d", &H, &W, &K); for (int i = 0; i < K; i++) { scanf("%d %d", &ps[i].y, &ps[i].x); } std::sort(ps, ps + K); for (int i = 0; i < 1 << K; i++) { int y = 0; int x = 0; ans[i] = 1; for (int j = 0; j < K; j++) if (i >> j & 1) { int dy = ps[j].y - y; int dx = ps[j].x - x; ans[i] *= C(dy + dx, dx); y = ps[j].y; x = ps[j].x; } int dy = H - y; int dx = W - x; ans[i] *= C(dy + dx, dx); } /* moebius transform */ for (int i = 0; i < K; i++) { for (int j = 0; j < 1 << K; j++) { if (~j & 1 << i) { ans[j | 1 << i] -= ans[j]; } } } for (int i = 0; i < 1 << K; i++) { for (int j = 0; j < K; j++) if (i >> j & 1) ans[i] *= M - 1; printf("%d\n", ans[i].n); } return 0; }