#Q237. 「一本通 6.6 练习 6」序列统计

「一本通 6.6 练习 6」序列统计

Description

Original source: BZOJ 4403

Given three positive integers NN, LL, and RR, count the number of non-decreasing sequences with lengths between 11 and NN, where each element is between LL and RR. Output the result modulo 106+310^6+3.

Input Format

The first line of input contains an integer TT, representing the number of test cases.

Lines 22 to T+1T+1 each contain three integers NN, LL, and RR, with meanings as described in the problem.

Output Format

Output TT lines, each containing a single number representing the answer modulo 106+310^6+3.

Sample 1

For the first test case, the two valid sequences are {4}\{4\} and {5}\{5\}.

2
1 4 5
2 4 5

2
5

Constraints & Hints

For all input, 1N,L,R1091\le N,L,R\le 10^9, 1T1001\le T\le 100, and it is guaranteed that LRL\le R.