#include<bits/stdc++.h>
using namespace std;
int main()
{
    ifstream cin("tonguoc.inp");
    ofstream cout("tonguoc.out");
    int64_t n;
    cin>>n;
    int64_t r=1;
    for(int i=2;i<=n;i++)
    {
        if(n%i==0)
        {
            r+=i;
        }
    }
    cout<<r;
}
