#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[70][70];
ll nCr(ll n,ll r)
{
if(r==1) return n;
if(n==r) return 1;
if(dp[n][r]!=-1) return dp[n][r];
else{
dp[n][r]=nCr(n-1,r)+nCr(n-1,r-1);
return dp[n][r];
}
}
int main()
{
//ofstream o("output.txt");
ll i,j,k,l,m,n,test;
cin>>test;
for(j=1;j<=test;j++)
{
cin>>n>>k;
memset(dp,-1,sizeof(dp));
cout<<"Case "<<j<<": ";
if(n<k)
cout<<0<<endl;
else if(k==0)
cout<<1<<endl;
else
{
ll mul=1;
for(i=n-k+1;i<=n;i++)
{
mul=mul*i;
}
cout<<mul*nCr(n,k)<<endl;
}
}
return 0;
}
using namespace std;
typedef long long ll;
ll dp[70][70];
ll nCr(ll n,ll r)
{
if(r==1) return n;
if(n==r) return 1;
if(dp[n][r]!=-1) return dp[n][r];
else{
dp[n][r]=nCr(n-1,r)+nCr(n-1,r-1);
return dp[n][r];
}
}
int main()
{
//ofstream o("output.txt");
ll i,j,k,l,m,n,test;
cin>>test;
for(j=1;j<=test;j++)
{
cin>>n>>k;
memset(dp,-1,sizeof(dp));
cout<<"Case "<<j<<": ";
if(n<k)
cout<<0<<endl;
else if(k==0)
cout<<1<<endl;
else
{
ll mul=1;
for(i=n-k+1;i<=n;i++)
{
mul=mul*i;
}
cout<<mul*nCr(n,k)<<endl;
}
}
return 0;
}