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.*;
  import java.util.Arrays;
  import java.util.Random;
  import java.util.StringTokenizer;
  
  public class codeforces737_C {
      private static int mod = (int) 1e9 + 7;
      static int[] powersOf2 = powersOf2(200000);
  
      private static void solve(FastIOAdapter ioAdapter) {
          int n = ioAdapter.nextInt();
          int k = ioAdapter.nextInt();
  
          if (n % 2 == 1) {
              ioAdapter.out.println(fast_pow(powersOf2[n - 1] + 1, k));
          } else {
              if (k != 0) {
                  int res = fast_pow(powersOf2[n - 1] - 1, k);
                  for (int i = 0; i < k; i++) {
                      int first = fast_pow(powersOf2[n - 1] - 1, i);
                      int second = fast_pow(powersOf2[n], k - i - 1);
                      int mult = (int) (((long) first * second) % mod);
                      res = (res + mult) % mod;
                  }
                  ioAdapter.out.println(res);
              } else {
                  ioAdapter.out.println(1);
              }
          }
      }
  
      static int[] powersOf2(int limit) {
          int[] res = new int[limit + 1];
          res[0] = 1;
          for (int i = 1; i < limit + 1; i++) {
              res[i] = (int) ((long) res[i - 1] * 2 % mod);
          }
          return res;
      }
  
      static int fast_pow(int a, int p) {
          int res = 1;
          while (p > 0) {
              if (p % 2 == 0) {
                  a = (int) ((long) a * a % mod);
                  p /= 2;
              } else {
                  res = (int) ((long) res * a % mod);
                  p--;
              }
          }
          return res;
      }
  
      public static void main(String[] args) throws Exception {
          try (FastIOAdapter ioAdapter = new FastIOAdapter()) {
              int count = 1;
              count = ioAdapter.nextInt();
              while (count-- > 0) {
                  solve(ioAdapter);
              }
          }
      }
  
      static void shuffleSort(int[] arr) {
          int n = arr.length;
          Random rnd = new Random();
          for (int i = 0; i < n; ++i) {
              int tmp = arr[i];
              int randomPos = i + rnd.nextInt(n - i);
              arr[i] = arr[randomPos];
              arr[randomPos] = tmp;
          }
          Arrays.sort(arr);
      }
  
      static class FastIOAdapter implements AutoCloseable {
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          public PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter((System.out))));
          StringTokenizer st = new StringTokenizer("");
  
          String next() {
              while (!st.hasMoreTokens())
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              return st.nextToken();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          int[] readArray(int n) {
              int[] a = new int[n];
              for (int i = 0; i < n; i++) a[i] = nextInt();
              return a;
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          @Override
          public void close() throws Exception {
              out.flush();
              out.close();
              br.close();
          }
      }
  }