#include <iostream>
#include <math.h>
using namespace std;
int main()
{
unsigned long long n;
cin >> n;
unsigned long long S = n;
for (unsigned long long div = 2; div <= sqrt(n); div++) {
if (!(n % div)) {
if (!(div % 2))
S += div;
if (!((n / div) % 2))
S += (n / div);
}
}
cout << S;
return 0;
}