//https://www.geeksforgeeks.org/dice-throw-dp-30/
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while (t-->0) {
int n,m,x;
cin>>n>>m>>x;
int dp[n+1][x+1]= {0};
for (int i=1;i<=x;i++) {
if (i<=m)
dp[1][i]= 1;
}
for (int i=2;i<=n;i++) {
for (int j=1;j<=x;j++) {
for (int k=1;k<=m && k<j;k++)
dp[i][j]+= dp[i-1][j-k];
}
}
cout<< dp[n][x]<<endl;
}
}