P9855 [HackerEarth] special paths
普及
题目描述

You are given a rectangular grid with n rows and m columns. The rows are numbered 1 to n, from bottom to top, and the columns are numbered 1 to m, from left to right.

You are also given k special fields in the form (row, column). For each i, where 0 ≤ i ≤ k, count the number of different paths from (1, 1) to (n, m) that contains exactly n special fields.

There is one rule you must follow. You are only allowed to make moves that are straight up or to the right. In other words, from each field (row, column), you can only move to field (row+1, column) or field (row, column+1).

Output an array of k + 1 elements. The i-th element (0-indexed) must be the number of different paths that contain exactly i special fields. Since, the answer can be too big, output it modulo 1000007.

Input:
First line contains three space separated integers, n, m and k.
Next k lines, each contain two space separated integers, the coordinates of a special field.

Output:
k + 1 space separated integers, the answer to the question.

Constraints:
1 ≤ n, m, k ≤ 100
For all coordinates (r, c) - 1 ≤ r ≤ n, 1 ≤ c ≤ m
All coordinates are valid and different.

SAMPLE INPUT
3 3 2
2 2
3 2

SAMPLE OUTPUT
1 3 2

Explanation

0 special cell -
(1, 1) -> (1, 2) -> (1, 3) -> (2, 3) -> (3, 3)

1 special cell -
(1, 1) -> (2, 1) -> (2, 2) -> (2, 3) -> (3, 3)
(1, 1) -> (2, 1) -> (3, 1) -> (3, 2) -> (3, 3)
(1, 1) -> (1, 2) -> (2, 2) -> (2, 3) -> (3, 3)

2 special cells -
(1, 1) -> (2, 1) -> (2, 2) -> (3, 2) -> (3, 3)
(1, 1) -> (1, 2) -> (2, 2) -> (3, 2) -> (3, 3)

输入格式

见题面

输出格式

见题面

样例输入
3 3 2 2 2 3 2 SAMPLE
样例输出
1 3 2