Color Counting
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Given three integers n, m, and k, you need to color each lattice point in the set S=\{(x,y)\mid1\le x\le n,1\le y\le m,x,y\in \mathbb{Z}\} on the 2D Cartesian coordinate system using one of k colors. Calculate the number of valid coloring methods. Two methods are considered different if and only if there exists one point in set S with a different color between them.

This problem seems too simple, so Sauden adds a constraint: for any integers x\in[1,n-1] and y\in[1,m-1], if the points (x,y) and (x+1,y) have the same color, the points (x,y+1) and (x+1,y+1) must also have the same color. Determine the number of valid coloring methods modulo 10^9+7.

输入描述:

The first line contains an integer T (1 \le T \le 10^5), the number of test cases. 

Each test case consists of one line with three integers n, m, and k (1 \le k \le 10^9, 2 \le n,m \le 10^9), as described in the problem.

输出描述:

For each test case, output a single integer on a line, representing the answer modulo 10^9+7.
示例1

输入

复制
2
2 3 3
4 4 3

输出

复制
405
2413071