#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int tc=0,dp[30][30][360],l,make;
void build()
{
int i,j,k,s;
for(i=1; i<=26; i++)dp[1][i][i]=1;
for( i=2; i<=26; i++) //length
for( j=1; j<=27-i; j++) //first letter
for(k=j+1; k<=26; k++) //next letter
for(s=(j-1)*i+(i*(i+1))>>1; s<=351; s++) //sum
{ //if(i<=2 )cout<<i<<" "<<j<<" "<<s<<" "<<dp[i][j][s]<<endl;
dp[i][j][s]+=dp[i-1][k][s-j];
}
}
int main()
{ build();
while(scanf("%d%d",&l,&make) && ( l+make) )
{
if(l>26||make>=352)
{
printf("Case %d: 0\n",++tc);
continue;
}
int ret=0;
for(int i=1; i<=27-l; i++)
{
// cout<<dp[l][i][make]<<endl;
ret+=dp[l][i][make];
}
printf("Case %d: %d\n",++tc,ret);
}
return 0;
}
#include<cstring>
#include<iostream>
using namespace std;
int tc=0,dp[30][30][360],l,make;
void build()
{
int i,j,k,s;
for(i=1; i<=26; i++)dp[1][i][i]=1;
for( i=2; i<=26; i++) //length
for( j=1; j<=27-i; j++) //first letter
for(k=j+1; k<=26; k++) //next letter
for(s=(j-1)*i+(i*(i+1))>>1; s<=351; s++) //sum
{ //if(i<=2 )cout<<i<<" "<<j<<" "<<s<<" "<<dp[i][j][s]<<endl;
dp[i][j][s]+=dp[i-1][k][s-j];
}
}
int main()
{ build();
while(scanf("%d%d",&l,&make) && ( l+make) )
{
if(l>26||make>=352)
{
printf("Case %d: 0\n",++tc);
continue;
}
int ret=0;
for(int i=1; i<=27-l; i++)
{
// cout<<dp[l][i][make]<<endl;
ret+=dp[l][i][make];
}
printf("Case %d: %d\n",++tc,ret);
}
return 0;
}