#include #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() #define FSP(x) fixed << setprecision(x) using namespace std; using ll = long long; constexpr ll INF = LLONG_MAX; //constexpr ll P = 1e9 + 7; constexpr ll P = 998244353; constexpr long double PI = acosl(-1); void Yes() {cout << "Yes\n";} void No() {cout << "No\n";} void YES() {cout << "YES\n";} void NO() {cout << "NO\n";} #include #include /* NOTICE : followings requires template argument to be prime - use of modinv - division by modint - use of factorial_inv */ /* verified : 2020/07/30 AtCoder, Knapsack for All Subsets https://atcoder.jp/contests/abc169/tasks/abc169_f AtCoder, Bouquet https://atcoder.jp/contests/abc156/tasks/abc156_d */ template long long modinv(long long n) { long long a = P, u = 1, v = 0; while (a) { long long t = n / a; n -= t * a; std::swap(n, a); u -= t * v; std::swap(u, v); } u %= P; if (u < 0) u += P; return u; } template struct modint { long long val; modint(long long right) : val(right) {sub(val);} modint() {val = 0;} void sub(long long &n) { if (n < 0) { long long m = (-n) % M; n = M - m; } else n %= M; } modint operator+ (modint right) {return (this -> val) + right.val;} modint operator+ (long long right) {sub(right); return (this -> val) + right;} modint operator- (modint right) {return (this -> val) - right.val;} modint operator- (long long right) {sub(right); return (this -> val) - right;} modint operator* (modint right) {return (this -> val) * right.val;} modint operator* (long long right) {sub(right); return (this -> val) * right;} bool operator== (modint right) {return ((this -> val) == right.val);} bool operator== (long long right) {sub(right); return ((this -> val) == right);} bool operator!= (modint right) {return ((this -> val) != right.val);} bool operator!= (long long right) {sub(right); return ((this -> val) != right);} bool operator<= (modint right) {return ((this -> val) <= right.val);} bool operator<= (long long right) {sub(right); return ((this -> val) <= right);} bool operator>= (modint right) {return ((this -> val) >= right.val);} bool operator>= (long long right) {sub(right); return ((this -> val) >= right);} bool operator< (modint right) {return ((this -> val) < right.val);} bool operator< (long long right) {sub(right); return ((this -> val) < right);} bool operator> (modint right) {return ((this -> val) > right.val);} bool operator> (long long right) {sub(right); return ((this -> val) > right);} void operator+= (modint right) {*this = *this + right;} void operator+= (long long right) {*this = *this + right;} void operator-= (modint right) {*this = *this - right;} void operator-= (long long right) {*this = *this - right;} void operator*= (modint right) {*this = *this * right;} void operator*= (long long right) {*this = *this * right;} modint& operator++ () {*this += 1; return *this;} modint operator++ (int) {*this += 1; return *this - 1;} modint& operator-- () {*this -= 1; return *this;} modint operator-- (int) {*this -= 1; return *this + 1;} modint operator/ (modint right) {return *this * modinv(right.val);} modint operator/ (long long right) {sub(right); return *this * modinv(right);} void operator/= (modint right) {*this = *this / right;} void operator/= (long long right) {*this = *this / right;} }; std::vector factorial; std::vector factorial_inv; template void make_table(long long n) { factorial.resize(n + 1, 1); factorial_inv.resize(n + 1, 1); for (long long i = 2; i <= n; i++) { factorial[i] = factorial[i - 1] * i % P; } factorial_inv[n] = modinv

(factorial[n]); for (long long i = n - 1; i >= 0; i--) { factorial_inv[i] = factorial_inv[i + 1] * (i + 1) % P; } } template modint

permutation(long long n, long long r) { if (n <= factorial.size()) { modint

a = factorial[n], b = factorial_inv[n - r]; return a * b; } else { std::cerr << "attention : factorial table is not constructed" << '\n'; modint

ret = 1; for (long long i = 0; i < r; i++) ret *= n - i; return ret; } } template modint

combination(long long n, long long r) { r = std::min(r, n - r); if (n <= factorial.size()) { return permutation

(n, r) * factorial_inv[r]; } else { std::cerr << "attention : factorial table is not constructed" << '\n'; modint

ret = 1; for (long long i = 0; i < r; i++) { ret *= n - i; ret /= i + 1; } return ret; } } template modint modpow(long long a, long long n) { a %= M; if (n == 0) return 1; if (a == 0) return 0; if (a == 1) return 1; long long b = 1, cnt = 0; while (b < M && cnt < n) { b *= a; cnt++; } modint ret; if (b < M) ret = b; else { b %= M; ret = modpow(b, n / cnt) * modpow(a, n % cnt); } return ret; } template modint modpow(modint m, long long n) { long long a = m.val; if (n == 0) return 1; if (a == 0) return 0; if (a == 1) return 1; long long b = 1, cnt = 0; while (b < M && cnt < n) { b *= a; cnt++; } modint ret; if (b < M) ret = b; else { b %= M; ret = modpow(b, n / cnt) * modpow(a, n % cnt); } return ret; } template std::ostream &operator<< (std::ostream &out, modint tgt) {out << tgt.val; return out;} int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll t; cin >> t; while (t--) { ll n, k; cin >> n >> k; modint

ans = 0; cout << (modpow

(2, k) - 1) * modpow

(modpow

(2, k), n - 1) * n << '\n'; } }