//这个题目的大意是类似3n+1问题的,不过就是对于3n+1中.如果3n+1>给出的限制.就直接break了..
#include<stdio.h>
#include<stdlib.h>#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
const int inf = 0x3f3f3f;
using namespace std;
long long int compute(long long int x, long long int y)
{
long long int cnt = 1;
long long int mm;
while(x-1)
{
if( x % 2 )
{
mm = x*3+1;
if(mm <= y)
x = x*3+1;
else
{
x = 1;cnt--;
}
}
else
{
x = x/2;
}
cnt++;
}
return cnt;
}
int main()
{
long long int a,l,t = 1;
while(scanf("%lld%lld",&a,&l) && a + l != -2)
{
int m = compute(a,l);
printf("Case %lld: A = %lld, limit = %lld, number of terms = %lld\n",t,a,l,m);
t++;
}
}