#include <fstream>
using namespace std;
ifstream f1("tonguoc.inp");
ofstream f2("tonguoc.out");
long long n;
int main()
{
    f1 >> n;
    long long tong = n + 1;
    for (long long i = 2; i < n; i++)
    {
        if (n%i == 0) tong = tong + i;
    }
    f2 << tong;
    return 0;
}
