CSES - Exponentiation II
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Your task is to efficiently calculate values abca^{b^c} modulo 109+710^9+7.

Note that in this task we assume that 00=10^0=1.

Input

The first input line has an integer nn: the number of calculations.

After this, there are nn lines, each containing three integers aa, bb and cc.

Output

Print each value abca^{b^c} modulo 109+710^9+7.

Constraints

  • 1n1051 \le n \le 10^5
  • 0a,b,c1090 \le a,b,c \le 10^9

Example

Input:

3
3 7 1
15 2 2
3 4 5

Output:

2187
50625
763327764