Universal Cup Judging System

Universal Cup

Límite de tiempo: 2 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓
Estadísticas

Yuki dreams of reaching the unreachable land. After years of hard work, only this problem remains before her.

Given three integers $a, b, m$. You need to perform $m$ rounds of operations. In the $i$-th round, you can either set $a \leftarrow a \bmod (m - i + 1)$ or choose not to modify $a$. Find the number of ways to make $a = b$ after $m$ rounds, modulo $998244353$.

Two schemes are considered different if and only if there exists some $1 \le i \le m$ such that in one scheme you performed a modification in the $i$-th round, while in the other you did not. Note that choosing to perform $a \leftarrow a \bmod (m - i + 1)$ is considered a modification, regardless of whether the value of $a$ changes after the operation.

You once dreamed of reaching the unreachable land that only exists in fairy tales. Now that Yuki has a chance to realize this dream, you must help her.

Input

This problem contains multiple test cases.

The first line contains a positive integer $t$ ($1 \le t \le 10^5$), representing the number of test cases.

For each test case:

  • A single line contains three integers $a, b, m$ ($0 \le b < m \le a \le 2 \cdot 10^5$).

It is guaranteed that the sum of $a$ over all test cases does not exceed $2 \cdot 10^5$.

Output

For each test case, output a single line containing an integer representing the answer modulo $998244353$.

Example

Sample Input 1

5
5 0 5
5 2 3
10 1 7
10 6 10
100000 114 514

Sample Output 1

25
1
14
0
837481226

Note

For the first test case:

  • One valid operation scheme is to perform modifications in the $3$-rd and $4$-th rounds.
  • Another valid operation scheme is to perform modifications in all rounds from $1$ to $5$.

For the second test case:

  • The only valid operation scheme is to perform a modification in the $3$-rd round.

For the fourth test case:

  • It can be proven that no valid operation scheme exists.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.