I I U P C 2 0 0 9 |
|
|
|
Problem H: How Many Ways |
|
|
|
Dexter has N coins having values 1,2,3, … N. He should select a subset of exactly K coins from those such that the selected coins sum to N. Find how many ways he can do it. Suppose, N=8, K=3 then he can select coins in 2 ways: {1,2,5}, {1,3,4}.
|
|
Input |
|
First line of input is T (≤20) which is the number of cases. Then there are T lines each containing two numbers K (1 ≤ K ≤ 10) and N (1 ≤ N ≤ 10^9).
|
|
Output |
|
Output the number of ways to choose K coins MOD 1000000007.
|
|
Sample Input |
Output for Sample Input |
3 4 10 3 8 4 231 |
1 2 80142 |
|
|
Problem Setter: Tasnim Imran Sunny Special Thanks: Mahbubul Hasan |