import sys readline = sys.stdin.readline n = 202020 mod = 998244353 fact = [1] * (n + 1) inv = [1] * (n + 1) for i in range(1, n): fact[i + 1] = ((i+1) * fact[i]) % mod inv[n] = pow(fact[n], mod - 2, mod) for i in range(n - 1, -1, -1): inv[i] = inv[i + 1] * (i + 1) % mod def comb(n, r): if n < 0 or r < 0 or n - r < 0: return 0 return fact[n] * inv[r] * inv[n - r] % mod A = [] two = 1 for i in range(n): A.append(two) two *= 2 two %= mod Ac = [0] * (n + 1) for i in range(n): Ac[i + 1] = Ac[i] + A[i] T = int(readline()) for _ in range(T): N, M = map(int, readline().split()) ans = 0 for i in range(M + 1): ans += comb(N - 1, i - 1) * Ac[N] ans %= mod print(ans)