// #include #include #define rep( i, n, m ) for (int i = ( n ); i < ( m ); i++) #define rep_d( i, n, m ) for (int i = ( n ); i < ( m ); i--) int main( void ){ int n; if(!scanf( "%d", &n )) return -1; if (n == 1){ printf( "1\n" ); return 0; } int sum = 1 + n; int max = n; int a; for(int i = 2; i < max; i++){ a = n / i; if (n - i * a == 0){ sum += i; sum += a; max = a; } } printf("%d\n", sum); return 0; }