Problem F. Fireflies
时间限制 2500 ms
内存限制 256 MB
Randal is a master of high-dimensional space. All the species living in his space are regarded as fireflies for him. One day he came up with a problem but failed to solve it. Are you the one who can solve that?
There is one $n$-dimensional hypercubic subspace that he wants to cover by the minimal number of fireflies. The side lengths of the space are $p_1, p_2, \cdots, p_n$, which means this space can be formed into $\prod_{i = 1}^{n}{p_i}$ hypercubic units.
One unit is considered as covered if there exists a firefly that has visited it. Each firefly is able to cover several units through its own traveling. Assuming a firefly is located at the coordinate $(x_1, x_2, \cdots, x_n)$ with $1 \leq x_i \leq p_i$ $(i = 1, 2, \cdots, n)$, it can move to another coordinate $(y_1, y_2, \cdots, y_n)$ if $1 \leq x_i \leq y_i \leq p_i$ $(i = 1, 2, \cdots, n)$ and $\sum_{i = 1}^{n}{|x_i - y_i|} = 1$. In addition, The travel of one firefly can start or end at any location and might have any times of moves but one firefly could only travel once.
Your task is to determine the minimum number of fireflies that should be involved and print the answer in modulo $(10^9 + 7)$.
输入数据
输出数据
For each test case, print the answer modulo $(10^9 + 7)$ in one line.
样例输入
样例输出
样例说明
For the first sample, one firefly could cover all the units. For the second sample, one possible best way is that each firefly covers all the units with the same second coordinate, which involves three fireflies.
$ Mathjax font initiator $