T = gets.to_i MOD = 998244353 T.times do n, k = gets.split.map(&:to_i) puts (n * (2.pow(n * k, MOD) - 2.pow(n * k - k, MOD))) % MOD end