| Winter Cup 5.0 Online Mirror Contest |
|---|
| Finished |
Rami has started to learn $$$2$$$ dimensional discrete geometry.
Given an infinite grid $$$G$$$, he will apply a linear transformation $$$T$$$ to each point $$$(i,j)$$$.
A linear transformation $$$T$$$ is a function that sends $$$(i,j)\rightarrow (i',j')$$$ with: $$$$$$ \begin{cases} i'=ai+bj\\ j'=ci+dj \end{cases} $$$$$$ With $$$a,b,c,d\in\mathbb{Z}$$$ its parameters which do not depend on $$$(i,j).$$$
Also he divided the grid into square blocks each with dimensions $$$m\times m$$$, with the $$$(i,j)^\text{th}$$$ block defined as: $$$$$$ B_{i,j}\quad \text{is the set}\quad \left\{ (i\cdot m+u,j\cdot m+v),\quad u,v\in\{0,\dots,m-1\}\right\} $$$$$$ Furthermore, he defined the $$$(u,v)^\text{th}$$$ point of a block $$$B_{i,j}$$$ as the point $$$(i\cdot m+u,j\cdot m+v)$$$
The $$$m$$$-score $$$\chi_m(T)$$$ of a linear transformation $$$T$$$ is defined as the number of pairs $$$(u,v)$$$ such that:
Now, Rami is interested on a family of linear transformations that he called $$$m$$$-good transformations.
In fact, an $$$m$$$-good transformation is defined as a linear transformation $$$T$$$ that:
Rami wants to count the number of $$$m$$$-good transformations for a given $$$m$$$ modulo $$$M=10^9+7$$$.
Please help him.
For each test case, output the number of $$$m$$$-good transformations modulo $$$M=10^9+7$$$
5 2 3 10 25 100
6 48 2880 300000 28800000
This is a visualisation of a linear transformation $$$T$$$ for $$$m=2.$$$ Each block has its own colour. Also the points generated by this linear transformation are shown.
This is another visualisation of a linear transformation $$$T$$$ for $$$m=3.$$$
| Name |
|---|


