RECFUN - Recursive function
Alice loves mathematics. She recently got a Laptop and so is excited to solve her crazy mathematics problems using her Lappy.
One day, she discovered something known as RecursiveSum. RecursiveSum is a recursive function defined as:
1. RecursiveSum(0,n) = n, for all n > 0.
2. RecursiveSum(k,n) = RecursiveSum(k-1,1) + RecursiveSum(k-1,2) + ... + RecursiveSum(k-1,n), for all positive k, n.
She wants to make a program that can find recursive sum for any given pairs of k and n. She has no coding experience yet, so she wants you to solve this problem for her. Given k and n, your task is to write a code that can return the value for RecursiveSum(k , n).
First line of input consists of an integer T <= 200 which is the number of test cases. Each test case consists of two integers k and n (1 <= k <=14 and 1 <= n <= 14).
For each test case, output a single line containing the integer RecursiveSum(k,n). The output is gauranteed to fit in 32-bit integer.
4 1 3 5 1 4 10 8 6
6 1 2002 2002