#include<bits/stdc++.h> using namespace std; int n,x=1; int main(){ cin>>n; int res=0; for(int i=2;i*i<=n;i++){ while(n%i==0){ res+=i; n=n/i; } } if(n>1) res+=n; cout<<res<<endl; return 0; }