P5239 Recalling Kyoto.
Background
106th place in the Music section of the 15th Touhou Popularity Poll.
51st place in the 4th domestic poll survey of people who do not know Touhou voting on Touhou original tracks.
The chorus of Recalling Kyoto is so good, and Touhou Bunkachou is also so good.
Description
While collecting materials, Shameimaru Aya discovered something interesting, called the binomial coefficient.
The definition of a binomial coefficient is as follows: from $n$ distinct elements, choose any $m$ elements $(m \leq n)$ to form a group. This is called a combination of choosing $m$ elements from $n$ distinct elements. The number of all such combinations is the binomial coefficient.
The formula for computing the binomial coefficient is: $\mathrm C^m_n=\dfrac{n!}{m! \times (n-m)!}$. It is guaranteed that $m \leq n$, and it represents the number of ways to choose $m$ elements from $n$ elements.
To make it easier to understand, here is an example: in the third playthrough (week) of th16.5 Violet Detector, each day’s battle has $4$ characters appearing in pairs. Then clearly there are $\mathrm C^2_4=6$ ways to form pairs.
For a more detailed explanation, please see the sample explanation.
Since she is curious about new things, she wants to know what $\mathrm C^m_n$ is. This is very easy for her, so she solved it instantly at a glance. Therefore, she decided to compute the following expression:
$$\sum_{i=1}^n \sum_{j=1}^m \mathrm C^i_j$$
When $i>j$, $\mathrm C^i_j$ is defined to be $0$.
She quickly computed it, but she is not very confident in her answer, so you decide to help her. However, she, being idle and looking for something to do, computed the result $q$ times for different $n,m$. So this can only be left to you. Since you do not plan to truly help her, you do not need to take the answer modulo $998244353$, nor modulo $64123$. You only need to tell her the answer modulo $19260817$.
Input Format
The first line contains a non-negative integer $q$, indicating that there are $q$ queries.
Starting from the second line, there are $q$ lines in total. Each line contains two non-negative integers $n,m$, with the meaning as described in the statement.
Output Format
Output $q$ lines in total. For each query, output one answer.
Explanation/Hint
| Test Point ID | $q$ | $n$ | $m$ |
|:-:|:-:|:-:|:-:|
| $1$ | $=0$ | Does not exist | Does not exist |
| $2\sim 3$ | $\le 10$ | $\le 10$ | $\le 10$ |
| $4\sim 6$ | $\le 10$ | $\le 10^3$ | $\le 10^3$ |
| $7\sim 10$ | $\le 10^4$ | $\le 10^3$ | $\le 10^3$ |
Sample explanation about binomial coefficients.
For example, if Remilia, Flandre, Hijiri Byakuren, and Toyosatomimi no Miko appear in combinations on that day, there will be six cases:
1. Remilia x Flandre $\text{\color{white}背德组}$
2. Toyosatomimi no Miko x Hijiri Byakuren $\text{\color{white}宗教组}$
3. Remilia x Toyosatomimi no Miko.
4. Flandre x Toyosatomimi no Miko.
5. Remilia x Hijiri Byakuren.
6. Flandre x Hijiri Byakuren.
Translated by ChatGPT 5