Disbalance

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Scientists discovered a new bacteria species that reproduces in a peculiar way. When there's xx bacteria in one room, each minute they perform a telepathic communication, upon which one of them is selected to divide. The probability of each particular bacteria being selected is equal to 1/x1 / x.

Scientists became interested in how well this division strategy is balanced. They placed nn Petri dishes in a room, each dish with exactly 11 bacteria. After each divide, coefficient dd was calculated in the following way. If the number of bacteria in one of the dishes was higher than in all other dishes combined, dd was set to the difference between these two quantities. Otherwise, dd was set to 00. Formally, if there are a_1a_2a_na\_1 \ge a\_2 \ge \ldots \ge a\_n bacteria in the dishes, then d=max(a_1a_2a_n,0)d = \max(a\_1 - a\_2 - \ldots - a\_n, 0).

Find the expected value of the sum of kk numbers: the values of dd after the first, second, \ldots, kk-th minute of this study. It is possible to write the answer in the form pq\frac{p}{q}, where pp and qq are relatively prime integers and q≢0(mod998,244,353)q \not\equiv 0 \pmod{998\\,244\\,353}. Output such integer rr that rqp(mod998,244,353)r \cdot q \equiv p \pmod{998\\,244\\,353}.

입력

The first line contains an integer tt, the number of test cases (1t31051 \le t \le 3 \cdot 10^5).

Each of the following tt lines describes one test case and contains two integers nn and kk (1n,k1061 \le n, k \le 10^6).

It is guaranteed that the sum of all nn and all kk in all test cases is at most 21062 \cdot 10^6.

출력

For each test case, print a single line with a single integer rr such that rqp(mod998,244,353)r \cdot q \equiv p \pmod{998\\,244\\,353}, where pq\frac{p}{q} is the expected value of the sum of kk numbers: the values of dd after the first, second, \ldots, kk-th minute of the study.