#include <bits/stdc++.h>
using namespace std;
int n, kase;
int divide_all(int d)
{
int x = 1;
while (n % d == 0) {n /= d; x *= d;}
return x;
}
long long solve()
{
if (n == 1) return 2;
int m = floor(sqrt(n) + 0.5);
long long ans = 0;
int pf = 0;
for (int i = 2; i < m; i++)
{
if (n % i == 0)
{
pf++;
ans += divide_all(i);
}
}
if (n > 1) {pf++; ans += n;}
if (pf <= 1) ans++;
return ans;
}
int main(int argc, char const *argv[])
{
while (cin >> n && n)
cout << "Case " << ++kase << ": " << solve() << endl;
return 0;
}
唯一分解定理的运用,需要注意的是当心溢出