#include <iostream>
#include <string>
using namespace std;
int Plus(int* arr1, int count, int j)
{
int num2 = 0;
int num = 0;
for (int i = 0; i < count; ++i)
{
if (j == 0)
{
arr1[i] = i + 1;
num += arr1[i];
}
else
{
num2 += arr1[i];
arr1[i] = num2;
num += arr1[i];
}
}
return num;
}
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int input = 0;
cin >> input;
for (int i = 0; i < input; ++i)
{
int k, n;
cin >> k >> n;
int* n1, * n2;
n1 = new int[n];
int num = 0;
for (int j = 0; j < k; ++j)
{
num = Plus(n1, n, j);
}
cout << num << '\n';
delete[] n1;
}
return 0;
}
코딩 테스트