#include <cstdio>
using namespace std;
typedef unsigned long long ll;
ll mod = 1e9 + 7;
ll qpow(ll a, ll b)
{
    ll ans = 1;
    for (; b; b >>= 1, a = a * a % mod)
        if (b & 1)
            ans = ans * a % mod;
    return ans;
}
int main()
{
    ll n, k, t = 0;
    while (~scanf("%llu%llu", &n, &k))
        printf("Case #%llu: %llu\n", ++t, qpow(n%mod, k));
    return 0;
}