| Swiss Subregional 2025-2026 |
|---|
| Закончено |
You have a transparent band of length N units and width M units. It's split into $$$N \times M$$$ unit squares.
You take two sides of the band (the ones with length M units), rotate one of them by 180 degrees, and connect them, getting a Möbius band of length N and width M. Then you paint each square on the band in one of $$$K$$$ colors.
Two painted Möbius bands of the same size are considered to have the same coloring if you can move one of them in such a way that it becomes indistinguishable from the other one. Otherwise, they have different colorings.
Find the number of colorings of the given Möbius band in K colors, modulo $$$10^9+7$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1\le t \le 100$$$). The description of the test cases follows.
Each test case contains 3 integers $$$N,M,K$$$ on a single line. $$$1 \le N \le 10^9$$$. $$$1 \le M,K \le 10^{18}$$$.
For every test case, output a single integer on a separate line — the number of colorings, modulo $$$10^9+7$$$.
62 2 23 5 21 3 23 1 240 6 3100 200 1
63100649079603431
The picture below shows 4 instances of the same coloring for $$$N=40, M=6, K=2$$$.
| Название |
|---|


