#include <iostream>
#include <cstdlib>
using namespace std;
int main(void)
{
int x, p, sum;
while (scanf_s("%d", &x))
{
sum = 0;
p = 2;
while (x != 1)
{
if (x % p == 0)
{
sum += p;
x /= p;
}
else
{
p++;
}
}
if (x == 1)
{
sum = x;
}
printf("%d\n", sum);
}
return 0;
}