#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define mod 1000000007
#define inf 100000000000005
#define MAXN 10000010
//#pragma comment(linker, "/STACK:102400000,102400000")
int scan()
{
int res = 0 , ch ;
while( !( ( ch = getchar() ) >= ‘0‘ && ch <= ‘9‘ ) )
{
if( ch == EOF ) return 1 << 30 ;
}
res = ch - ‘0‘ ;
while( ( ch = getchar() ) >= ‘0‘ && ch <= ‘9‘ )
res = res * 10 + ( ch - ‘0‘ ) ;
return res ;
}
vector<pair<ll ,ll > >v;
vector <ll>ans;
ll prime[MAXN],cnt;
bool vis[MAXN];
void Prime()
{
cnt=0;
memset(vis,0,sizeof(vis));
v.push_back(make_pair(1LL,1LL));
for(ll i=2;i<MAXN;i++)
{
if(!vis[i])
{
prime[cnt++]=i;
for(double j=(double)i*i;j<inf;j*=i)
v.push_back(make_pair((ll)j,i));
}
for(ll j=0;j<cnt&&i*prime[j]<MAXN;j++)
{
vis[i*prime[j]]=1;
if(i%prime[j]==0)
break;
}
}
sort(v.begin(),v.end());
ans.push_back(1LL);
for(int i=1;i<v.size();i++)
ans.push_back((ans[i-1]*v[i].second)%mod);
}
int main()
{
ll x,y,z,i,t;
Prime();
int T,cs=1;
scanf("%d",&T);
while(T--)
{
scanf("%llu",&x);
ll st=0;
ll en=v.size()-1;
while(st<en)
{
ll mid=(st+en)/2;
if(v[mid].first>x)
en=mid;
else
st=mid+1;
}
if(x>=v[st].first)
printf("Case %d: %llu\n",cs++,ans[st]%mod);
else if(x>=v[st-1].first)
printf("Case %d: %llu\n",cs++,ans[st-1]%mod);
}
return 0;
}