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 java.util.ArrayList;
  import java.util.Collections;
  import java.util.StringTokenizer;
  import java.io.IOException;
  import java.io.BufferedReader;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  
  public class S2 {
  	
  	public static class Reader {
  		
  		static BufferedReader reader;
  		static StringTokenizer tokenizer;
  		
  		static void init(InputStream input) {
  			reader = new BufferedReader(new InputStreamReader(input));
  			tokenizer = new StringTokenizer("");
  		}
  		
  		static String next() throws IOException {
  			while(!tokenizer.hasMoreTokens()) {
  				tokenizer = new StringTokenizer(reader.readLine());
  			}
  			return tokenizer.nextToken();
  		}
  		
  		static int nextInt() throws IOException {
  			return Integer.parseInt(next());
  		}
  		
  		static long nextLong() throws IOException {
  			return Long.parseLong(next());
  		}
  		
  	}
  	
  	private static long nl, ans;
  	private static long[] cbn;
  	
  	public static void main(String[] args) throws IOException {
  		
  		Reader.init(System.in);
  		
  		PrintWriter out = new PrintWriter(System.out);
  		
  		int tc=1;
  		tc = Reader.nextInt();
  		
  		main_loop:
  			for(int tn=0; tn<tc; tn++) {
  				
  				nl=0;
  				ans=0;
  				
  				nl = Reader.nextLong();
  				int k = Reader.nextInt();
  				int n = (int) nl;
  				
  				cbn = new long[2];
  				
  				if(n%2==0) {
  					cbn[1]=1;
  					cbn[0]=modPow(2, n-1)-1;
  				}
  				else {
  					cbn[1]=0;
  					cbn[0]=modPow(2, n-1)+1;
  				}
  				
  				ans = rec(k);
  				out.print(ans+"\n");
  				
  				
  			}
  		
  		out.flush();
  		out.close();
  	}
  
  	private final static long mod1 = 1000000007;
  
  	private static long modPow(long a, int p){
          // only for positive numbers
  		
          long m = mod1;
          
          if(p==0){
              return 1;
          }
          if(a==1){
              return 1;
          }
          long x = modPow(a, p/2);
          long y = (x*x);
          y%=m;
          if(p%2==1){
              y = (y*a);
          }
          return (y%m);
      }
  
  	private static long rec(int k) {
  		if(k==0) {
  			return 1;
  		}
  		else {
  			long a,b;
  			
  			a = cbn[0]*rec(k-1);
  			a%=mod1;
  			long totalComb = modPow(2, (int) nl);
  			totalComb = modPow(totalComb, k-1);
  			totalComb%=mod1;
  			b = cbn[1]*totalComb;
  			b%=mod1;
  			return (a+b)%mod1;
  		}
  		
  	}
  
  }