#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<cmath>
#define maxn 10000000
using namespace std;
int a[maxn];
int b[maxn];
int n;
long long pow(int a,int b)
{
long long res=1;
while(b--)
res*=a;
return res;
}
void factor(int n,int &tot){
int temp,i,now;
temp=(int)((double)sqrt(n)+1);
tot=0;
now=n;
for(i=2;i<=temp;++i)if(now%i==0){
a[++tot]=i;
b[tot]=0;
while(now%i==0){
++b[tot];
now/=i;
}
}
if(now!=1){
a[++tot]=now;
b[tot]=1;
}
}
int id=1;
long long ans;
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif // ONLINE_JUDGE
long long num;
while(cin>>num)
{
if(num==0)break;
if(num==1)
{
cout<<"Case "<<id++<<": "<<2<<endl;continue;
}
ans=0;
factor(num,n);
if(n==1){cout<<"Case "<<id++<<": "<<1ll*pow(a[1],b[1])+1<<endl;continue;}
for(int i=1;i<=n;i++)
{
ans+=pow(a[i],b[i]);
//cout<<c[i]<<endl;
//cout<<total<<endl;
}
//cout<<"total:"<<total<<endl;
cout<<"Case "<<id++<<": "<<ans<<endl;
}
}