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.io.OutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.PrintWriter;
  import java.util.Arrays;
  import java.util.StringTokenizer;
  import java.io.IOException;
  import java.io.BufferedReader;
  import java.io.FileReader;
  import java.io.InputStreamReader;
  import java.io.InputStream;
  
  /**
   * Built using CHelper plug-in
   * Actual solution is at the top
   *
   * @author Khater
   */
  public class Main {
      public static void main(String[] args) {
          InputStream inputStream = System.in;
          OutputStream outputStream = System.out;
          Scanner in = new Scanner(inputStream);
          PrintWriter out = new PrintWriter(outputStream);
          CMoamenAndXOR solver = new CMoamenAndXOR();
          solver.solve(1, in, out);
          out.close();
      }
  
      static class CMoamenAndXOR {
          long mod;
          long[] fac;
          int n;
          int k;
          long pren;
          long[] dp;
          long[] pow;
  
          long power(long x, long y, long p) {
              long res = 1;
  
              x = x % p;
  
              while (y > 0) {
                  if (y % 2 == 1)
                      res = (res * x) % p;
                  y = y >> 1;
                  x = (x * x) % p;
              }
  
              return res;
          }
  
          long modInverse(long n, long p) {
              return power(n, p - 2, p);
          }
  
          long nCrModPFermat(int n, int r,
                             long p) {
              if (n < r)
                  return 0;
              if (r == 0)
                  return 1;
  
              //	System.out.println(n+" "+ r+" "+ fac[n]+" "+ modInverse(fac[r], p)+" "+ modInverse(fac[n - r], p) );
  
              return (fac[n] * modInverse(fac[r], p)
                      % p * modInverse(fac[n - r], p)
                      % p)
                      % p;
          }
  
          public void solve(int testNumber, Scanner sc, PrintWriter pw) {
              int t = 1;
              t = sc.nextInt();
              mod = 1000000007;
              fac = new long[200005];
              pow = new long[200005];
              fac[0] = 1;
  
              for (int i = 1; i < 200005; i++)
                  fac[i] = fac[i - 1] * i % mod;
              for (int i = 0; i < 200005; i++)
                  pow[i] = power(2, i, mod);
              while (t-- > 0) {
                  n = sc.nextInt();
                  k = sc.nextInt();
                  pren = 0;
                  for (int i = 0; i < n; i += 2) pren = (pren + nCrModPFermat(n, i, mod)) % mod;
  
                  //pw.println(Arrays.toString(nces));
                  dp = new long[k];
                  Arrays.fill(dp, -1);
                  pw.println(solve(0));
  
              }
  
          }
  
          long solve(int i) {
              if (i == k) return 1;
              if (dp[i] != -1) return dp[i];
              long bigger = n % 2 == 0 ? (power(pow[k - i - 1], n, mod)) % mod : 0;
              long equal = ((pren + n % 2) * solve(i + 1)) % mod;
              return dp[i] = (bigger + equal) % mod;
          }
  
      }
  
      static class Scanner {
          StringTokenizer st;
          BufferedReader br;
  
          public Scanner(FileReader r) {
              br = new BufferedReader(r);
          }
  
          public Scanner(InputStream s) {
              br = new BufferedReader(new InputStreamReader(s));
          }
  
          public String next() {
              while (st == null || !st.hasMoreTokens()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      throw new RuntimeException(e);
                  }
              }
              return st.nextToken();
          }
  
          public int nextInt() {
              return Integer.parseInt(next());
          }
  
      }
  }
  
  