Under construction

Still being built. Things may change

Series Sum

Time limit2sMemory limit2048 MB

Summary
Given k and p, compute the infinite sum of C(n, k)^p / 2^n for n from k to infinity, modulo 998244353.
Level

Hard8 of 10

Topics
Math, Combinatorics, Dynamic programming
Solved
No attempts yet

Problem

Given two integers kk and pp, calculate the following value.

∑n=k∞(nk)p2n\sum\limits_{n = k}^{\infty} \frac{{n \choose k}^p}{2^n}

Here (nk){n \choose k} is the binomial coefficient, equal to n!k!⋅(n−k)!\displaystyle \frac{n!}{k! \cdot (n-k)!}.

The result can be written as rq\frac{r}{q}, where rr and qq are positive coprime integers and q≠0q \neq 0. Output r⋅q−1r \cdot q^{-1} modulo 998244353.

Input

The first line contains an integer tt (1≤t≤21121 \le t \le 2112), the number of test cases. Each test case is one line with two integers kk and pp (k,p≥1k, p \ge 1, p⋅k≤106p \cdot k \le 10^6). The sum of p⋅kp \cdot k over all test cases does not exceed 10610^6.

Output

For each test case, print on a single line the value r⋅q−1 mod 998244353r \cdot q^{-1} \bmod 998244353.

Examples1

  1. Example 1

    Input
    3
    2 3
    1 10
    9 6
    
    Expected output
    818
    204495126
    16726290