#P8432. 「WHOI-2」ぽかぽかの星
「WHOI-2」ぽかぽかの星
Background
You are drinking hot cocoa in a snow cave while counting stars. But this time, the stars are replaced by sequences. Clever as you are, you can surely count the sequences clearly.
Problem Description
How many non-decreasing positive integer sequences of length satisfy:
- .
- .
Output the answer modulo .
Input Format
This problem has multiple test cases.
The first line contains a positive integer .
The next lines each contain two positive integers .
Output Format
Output lines, each containing one positive integer, the answer.
3
2 2
1145 1419
19198 12321
2
66937457
949924930
Hint
This problem uses bundled testdata.
- .
- No special constraints.
For of the testdata, , , and .
Translated by ChatGPT 5