You are given two numbers \(A\) and \(S\).
Write a program to determine the number of ways in which the numbers that are greater than or equal to \(S\) can be added to get the sum \(A\). Print the result as modulo \(10^9 + 9\).
Input format
- First line: \(T\) denoting the number of test cases
- For each test case:
- First line: Two space-separated integers \(A\) and \(S\)
Output format
For each test case, print the number of ways to get the sum equal to \(A\) by using the numbers that are greater than or equal to \(S\). Since the number can be large, print it modulo \(10^9 + 9\) .
Constraints
\(1 ≤ T ≤ 1000\)
\(1 ≤ A , S ≤ 1000\)
4 2 1 3 1 4 5 750 466
2 3 0 1
In the first test case: <1, 1> and <2> are the 2 ways.
In the second test case: <1,1,1>, <1,2> and <3> are the three ways.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor