#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,d,m;
ll dem=0;
void r(ll &x)
{
    x=0;
    char a;
    a=getchar();
    for (;a<'0'||a>'9';a=getchar());
    for (;a>='0'&&a<='9';a=getchar())
        x=x*10+a-'0';
}
void w(ll x)
{
    if (x>9) w(x/10);
    putchar(x%10+'0');
}
int main()
{
    freopen("TONGUOC.inp","r",stdin);
    freopen("TONGUOC.out","w",stdout);
    ios_base::sync_with_stdio(false);
    r(n);
    ll i=1;
    while (i<sqrt(n))
    {
        if (n%i==0){
            d=d+i+n/i;
        }
        i++;
    }
    ll t=sqrt(n);
    if (n!=t*t) w(d);
    else
        w(d+t);
}

