human
Moamen and Ezzat are playing a game. They create an array a of n non-negative integers where every element is less than 2^k.

Moamen wins if a_1  \&  a_2  \&  a_3  \&  …  \&  a_n ≥ a_1 ⊕ a_2 ⊕ a_3 ⊕ … ⊕ a_n.

Here \& denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND), and ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).

Please calculate the number of winning for Moamen arrays a.

As the result may be very large, print the value modulo 1 000 000 007 (10^9 + 7).

Input

The first line contains a single integer t (1 ≤ t ≤ 5)— the number of test cases. 

Each test case consists of one line containing two integers n and k (1 ≤ n≤ 2⋅ 10^5, 0 ≤ k ≤ 2⋅ 10^5).

Output

For each test case, print a single value — the number of different arrays that Moamen wins with.

Print the result modulo 1 000 000 007 (10^9 + 7).

Example

Input

3
3 1
2 1
4 0

Output

5
2
1

Note

In the first example, n = 3, k = 1. As a result, all the possible arrays are [0,0,0], [0,0,1], [0,1,0], [1,0,0], [1,1,0], [0,1,1], [1,0,1], and [1,1,1].

Moamen wins in only 5 of them: [0,0,0], [1,1,0], [0,1,1], [1,0,1], and [1,1,1].
Using python3 can you solve the prior task?

=====
Can you provide a Python program to print the result modulo 1 000 000 007 (10^9 + 7)?
assistant
#Here is Python program to print the result modulo 1 000 000 007 (10^9 + 7).

def powmod(b,e,n):
    """powmod(b,e,n) computes the eth power of b mod n.  
    (Actually, this is not needed, as pow(b,e,n) does the same thing for positive integers.
    This will be useful in future for non-integers or inverses."""
    accum = 1; i = 0; bpow2 = b
    while ((e>>i)>0):
        if((e>>i) & 1):
            accum = (accum*bpow2) % n
        bpow2 = (bpow2*bpow2) % n
        i+=1
    return accum

def memoize(function):
    cache = {}
    def decorated_function(*args):
        try:
            return cache[args]
        except KeyError:
            val = function(*args)
            cache[args] = val
            return val
    return decorated_function

@memoize
def inverseMod(n, mod):
    if 1 == n: return 1

    return ((mod - mod//n) * inverseMod(mod % n, mod)) % mod

M = 10**9 + 7

F = [1, 1]
for n in range(2, 2*10**5 + 1):
    F.append((F[-1] * n) % M)

RF = [1, 1]
for n in range(2, 2*10**5 + 1):
    RF.append((RF[-1] * inverseMod(n, M)) % M)

def C(n, k):
    return (F[n] * ((RF[n - k] * RF[k]) % M)) % M

def count(n, k):
    if k == 0:
        return 1
    if n == 1:
        return powmod(2, k, M)

#    r0 = 0
#    for i in range(0, n, 2):
#        r0 += C(n, i)
#        r0 %= M
    r0 = powmod(2, n - 1, M) + (1 if n % 2 == 1 else 0) - 1

    r = 1 + r0

    b = powmod(2, n, M)
    bn = b
    for e in range(2, k + 1):
        if n % 2 == 0:
#            r = ((r0 * r) % M) + powmod(2, (e - 1)*n, M)
            r = ((r0 * r) % M) + bn
            bn = (bn * b) % M
        else:
            r = r + (r0 * r) % M
        r %= M

    return r % M

T = int(input())
for _ in range(T):
    n, k = map(int, input().split(' '))
    print(count(n, k))