#include <iostream>
#include <cmath>
using namespace std ;
int main() {
int n;
while(cin>>n)
{
int sum=0;
for(int i=2; i<=sqrt(n); i+=(i==2?1:2)){
if(n%i==0) while(n%i==0) {n/=i; sum+=i;}
}
if(n==1) cout<<sum<<endl;
else cout<<(sum+n)<<endl;
}
return 0;
}