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: #include <bits/stdc++.h>
  #pragma GCC target( \
      "sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,abm,mmx,avx,avx2,popcnt")
  #pragma GCC optimize("Ofast")
  #pragma GCC optimize("unroll-loops")
  using namespace std;
  using ll = long long;
  using ull = unsigned long long;
  using ld = long double;
  template <typename T1, typename T2>
  inline void chkmin(T1& x, const T2& y) {
    if (y < x) x = y;
  }
  template <typename T1, typename T2>
  inline void chkmax(T1& x, const T2& y) {
    if (x < y) x = y;
  }
  mt19937 rnd(time(0));
  int mod = 1000000007;
  int mul(int a, int b) { return 1ll * a * b % mod; }
  int add(int a, int b) {
    if (a + b >= mod) return a + b - mod;
    return a + b;
  }
  int sub(int a, int b) {
    if (a - b < 0) return a - b + mod;
    return a - b;
  }
  int binpow(int a, int b) {
    int res = 1;
    while (b) {
      if (b & 1) res = mul(res, a);
      a = mul(a, a);
      b >>= 1;
    }
    return res;
  }
  const int MAXN = 2e5 + 228;
  int inv(int x) { return binpow(x, mod - 2); }
  int fact[MAXN];
  int rfact[MAXN];
  int cnk(int n, int k) {
    if (k < 0 || k > n) return 0;
    return mul(fact[n], mul(rfact[k], rfact[n - k]));
  }
  signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cout.precision(20), cout.setf(ios::fixed);
    fact[0] = 1;
    for (int i = 1; i < MAXN; ++i) fact[i] = mul(fact[i - 1], i);
    rfact[MAXN - 1] = inv(fact[MAXN - 1]);
    for (int i = MAXN - 2; i >= 0; --i) rfact[i] = mul(rfact[i + 1], i + 1);
    int t;
    cin >> t;
    while (t--) {
      int n, k;
      cin >> n >> k;
      if (n % 2 == 0) {
        int am = 0;
        for (int bt = 0; bt < n; bt += 2) {
          am = add(am, cnk(n, bt));
        }
        int gl = binpow(2, n);
        int ans = 0;
        int nw = 1;
        for (int fbt = k - 1; fbt >= 0; --fbt) {
          ans = add(ans, mul(nw, binpow(gl, fbt)));
          nw = mul(nw, am);
        }
        ans = add(ans, nw);
        cout << ans << endl;
      } else {
        int am = 1;
        for (int bt = 0; bt <= n; bt += 2) {
          am = add(am, cnk(n, bt));
        }
        am = binpow(am, k);
        cout << am << '\n';
      }
    }
  }
  