description: 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].
solution: import sys
  import math
  from collections import deque,Counter
  from sys import stdin
  
  #sys.setrecursionlimit(10**7)
  int1=lambda x: int(x)-1
  
  inp=lambda :int(input())
  mi=lambda :map(int,input().split())
  li=lambda :list(mi())
  mi1=lambda :map(int1,input().split())
  li1=lambda :list(mi1())
  mis=lambda :map(str,input().split())
  lis=lambda :list(mis())
  
  stinput=lambda :stdin.readline()[:-1]
  stinp=lambda :int(stinput())
  stmi=lambda :map(int, stdin.readline().split())
  stli=lambda :list(stmi())
  stmi1=lambda :map(int1, stdin.readline().split())
  stli1=lambda :list(stmi1())
  stmis=lambda :stdin.readline()[:-1]
  
  pr=print
  
  from collections import defaultdict
  """
  #初期値 0
  d=defaultdict(int)
  
  #初期値 1
  d=defaultdict(lambda:1)
  """
  
  mod=10**9+7
  Mod=998244353
  INF=10**18
  ans=0
  
  #nCr mod p
  #mod の設定
  pmod = mod
  bignum = (10**5)*2 +5 
  fac = [1]*bignum
  ninv = [1]*bignum
  finv = [1]*bignum
  for i in range(2,bignum):
      fac[i] = fac[i-1]*i%pmod
      ninv[i] = (-(pmod//i)*ninv[pmod%i])%pmod
      finv[i] = finv[i-1]*ninv[i]%pmod
  
  def comb(n,k):
    if k>n:
      return 0
    return (fac[n]*finv[k]%pmod)*finv[n-k]%pmod
  
  b=[1]*bignum
  for i in range(1,bignum):
    b[i]=b[i-1]*2%mod
  t=inp()
  for _ in range(t):
    n,k=mi()
    if n%2==1:
      num=1
      for i in range(0,n,2):
        num+=comb(n,i)
        num%=mod
      print(pow(num,k,mod))
    else:
      num=0
      for i in range(0,n,2):
        num+=comb(n,i)
        num%=mod
      ans=0
      a=[1]*(k+1)
      for i in range(1,k+1):
        a[i]=a[i-1]*num%mod
      for i in range(k):
        if i==0:
          x=b[k-1]
          ans+=pow(x,n,mod)
        else:
          x=a[i]
          y=b[k-i-1]
          ans+=x*pow(y,n,mod)
          ans%=mod
      ans+=a[k]
      print(ans%mod)