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>
  using namespace std;
  #pragma GCC optimize("Ofast")
  const long long int maxn = 2e5 + 16, md = 1e9 + 7, inf = 2e16;
  long long int gcd(long long int a, long long int b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
  }
  long long int tav(long long int n, long long int k) {
    long long int res = 1;
    while (k > 0) {
      if (k & 1) {
        res *= n;
        res %= md;
      }
      n *= n;
      n %= md;
      k >>= 1;
    }
    return res;
  }
  long long int tv[maxn];
  void solve() {
    long long int n, k, cur = 1, ans = 0, w, d;
    cin >> n >> k;
    if (n & 1) {
      w = 0;
    } else {
      w = 1;
    }
    if (n & 1) {
      d = 1 + tv[n - 1];
    } else {
      d = tv[n - 1] - 1;
    }
    for (long long int i = k - 1; i >= 0; i--) {
      long long int h = 1ll * w * cur * tav(2, 1ll * i * n) % md;
      ans += h;
      cur *= d;
      cur %= md;
    }
    ans += cur;
    ans %= md;
    cout << ans << '\n';
    return;
  }
  int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    tv[0] = 1;
    for (long long int i = 1; i < maxn; i++) {
      tv[i] = (tv[i - 1] << 1);
      if (tv[i] >= md) tv[i] -= md;
    }
    long long int T;
    cin >> T;
    while (T--) solve();
    return 0;
  }
  