//设dp[i][j]为选取的第i个数为j的方案数
//dp[i][j] = sum(dp[i-1][k]), i-1 <= k <= j/2
//ans = sum(dp[n][k])
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
const int N = 15;
const int M = 2005;
unsigned long long dp[N][M];
int main()
{
int n, m, num = 0;
int cases;
cin >> cases;
while (cases--)
{
cin >> n >> m;
unsigned long long ans = 0;
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= m; i++)
dp[1][i] = 1;
for (int i = 2; i <= n; i++)
for (int j = 1; j <= m; j++)
for (int k = i-1; k <= j/2; k++)
dp[i][j] += dp[i-1][k];
for (int i = n; i <= m; i++)
ans += dp[n][i];
printf("Case %d: n = %d, m = %d, # lists = %lld\n", ++num, n, m, ans);
}
return 0;
}