Series Sum
시간 제한2초메모리 제한2048 MB
n=k부터 무한대로 가는 C(n,k)^p / 2^n의 합을 998244353으로 나눈 나머지를 구한다. p*k <= 10^6이다.
문제
Given are two integers and . Calculate
where denotes a binomial coefficient that equals to .
It is guaranteed that the result can be represented in the form of where and are positive coprime integers and . Find modulo .
입력
The first line contains an integer (), the number of test cases. The test cases follow.
Each test case is described by a single line containing two integers and (; ).
The total sum of over all test cases does not exceed .
출력
For each test case, print a single line containing the integer : the result of the calculation.