https://www.acmicpc.net/problem/2775
import java.util.*;
public class Main {
static int check(int k, int n){
int sum=0;
if(k==0) return n;
else{
for(int i=1;i<=n;i++){
sum+=check(k-1,i);
}
}
return sum;
}
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
for(int i=0;i<t;i++){
int k=s.nextInt(), n=s.nextInt();
System.out.println(check(k,n));
}
}
}