#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
LL multi_mod(LL a,LL b,LL c)
{
a%=c;b%=c;
LL ans=0;
while(b)
{
if(b&1)
{
ans+=a;ans%=c;
b--;
}
b>>=1;
a<<=1;a%=c;
}
return ans;
}
LL pow_mod(LL x,LL n,LL mod)
{
x%=mod;
LL ans=1;
while(n)
{
if(n&1)
{
ans=multi_mod(ans,x,mod);
n--;
}
n>>=1;
x=multi_mod(x,x,mod);
}
return ans;
}
int main()
{
LL n,k;
int cnt=0;
while(~scanf("%lld%lld",&n,&k))
{
printf("Case #%d: %lld\n",++cnt,pow_mod(n,k,(LL)(1e9+7)));
}
return 0;
}