a^b^c#9627

a^b^c

1 second
128 megabytes
Easy

Find the value of

a^{b^c} \pmod{10^9 + 7}

Input

The first line contains the number of test cases . Each of the next lines contains three numbers a, b, c~(a, b, c \le 10^9).

Output

For each test case print in a separate line the value of a^{b^c} \pmod{10^9 + 7}.

Examples

Example 1

Loading
Loading