#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mxn = 1e7+1;
int fact[mxn+1];
vector<int> criba(mxn+1,-1);
void sieve(){
criba[0] = criba[1] = 1;
for(int i = 2; i <= mxn; i++){
if(criba[i] == -1){
for(int j = i*i; j <= mxn; j += i)
if(criba[j] == -1)
criba[j] = i;
}
}
for(int i = 2; i <= mxn; i++)
if(criba[i] == -1)
criba[i] = i;
}
int divs(int n){
int ans = 0;
while(n % criba[n] == 0 && n > 1){
ans++;
n /= criba[n];
}
return ans;
}
void preFact(){
fact[0] = fact[1] = 0;
for(int i = 2; i <= mxn; i++)
fact[i] = fact[i-1] + divs(i);
}
void solve(){
int n;
int it = 0;
while(cin >> n){
if(n == -1)break;
int lo = 0, hi = mxn, ans = -1;
while(lo <= hi){
int mid = lo + (hi-lo)/2;
if(fact[mid] >= n){
if(fact[mid] == n)ans = mid;
hi = mid-1;
}
else lo = mid+1;
}
cout << "Case " << ++it << ": ";
if(ans>=0)cout << ans << "!" << "\n";
else cout << "Not possible." << "\n";
}
}
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
sieve();
preFact();
solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgaW50IGxvbmcgbG9uZwp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IG14biA9IDFlNysxOwoKCmludCBmYWN0W214bisxXTsKdmVjdG9yPGludD4gY3JpYmEobXhuKzEsLTEpOwoKdm9pZCBzaWV2ZSgpewogICAgCiAgICBjcmliYVswXSA9IGNyaWJhWzFdID0gMTsKICAgIGZvcihpbnQgaSA9IDI7IGkgPD0gbXhuOyBpKyspewogICAgICAgIGlmKGNyaWJhW2ldID09IC0xKXsKICAgICAgICAgICAgZm9yKGludCBqID0gaSppOyBqIDw9IG14bjsgaiArPSBpKQogICAgICAgICAgICAgICAgaWYoY3JpYmFbal0gPT0gLTEpCiAgICAgICAgICAgICAgICAgICAgY3JpYmFbal0gPSBpOwogICAgICAgIH0KICAgIH0KICAgIGZvcihpbnQgaSA9IDI7IGkgPD0gbXhuOyBpKyspCiAgICAgICAgaWYoY3JpYmFbaV0gPT0gLTEpCiAgICAgICAgICAgIGNyaWJhW2ldID0gaTsKfQoKaW50IGRpdnMoaW50IG4pewogICAgaW50IGFucyA9IDA7CiAgICB3aGlsZShuICUgY3JpYmFbbl0gPT0gMCAmJiBuID4gMSl7CiAgICAgICAgYW5zKys7CiAgICAgICAgbiAvPSBjcmliYVtuXTsKICAgIH0KICAgIHJldHVybiBhbnM7Cn0KCnZvaWQgcHJlRmFjdCgpewogICAgZmFjdFswXSA9IGZhY3RbMV0gPSAwOwogICAgZm9yKGludCBpID0gMjsgaSA8PSBteG47IGkrKykKICAgICAgICBmYWN0W2ldID0gZmFjdFtpLTFdICsgZGl2cyhpKTsKfQoKdm9pZCBzb2x2ZSgpewogICAgaW50IG47CiAgICBpbnQgaXQgPSAwOwogICAgd2hpbGUoY2luID4+IG4pewogICAgICAgIGlmKG4gPT0gLTEpYnJlYWs7CiAgICAgICAgCiAgICAgICAgaW50IGxvID0gMCwgaGkgPSBteG4sIGFucyA9IC0xOwogICAgICAgIHdoaWxlKGxvIDw9IGhpKXsKICAgICAgICAgICAgaW50IG1pZCA9IGxvICsgKGhpLWxvKS8yOwogICAgICAgICAgICBpZihmYWN0W21pZF0gPj0gbil7CiAgICAgICAgICAgICAgICBpZihmYWN0W21pZF0gPT0gbilhbnMgPSBtaWQ7CiAgICAgICAgICAgICAgICBoaSA9IG1pZC0xOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgbG8gPSBtaWQrMTsKICAgICAgICAgICAgCiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgIkNhc2UgIiA8PCArK2l0IDw8ICI6ICI7CiAgICAgICAgaWYoYW5zPj0wKWNvdXQgPDwgYW5zIDw8ICIhIiA8PCAiXG4iOwogICAgICAgIGVsc2UgY291dCA8PCAiTm90IHBvc3NpYmxlLiIgPDwgIlxuIjsKICAgIH0KfQoKaW50MzJfdCBtYWluKCkgewogICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZSgwKTsKCXNpZXZlKCk7CglwcmVGYWN0KCk7Cglzb2x2ZSgpOwoJCiAgICByZXR1cm4gMDsKfQo=