object Main {

   def main(args: Array[String]): Unit = {
     import scala.io.StdIn._
     val N = readLine().toLong

     val start = Math.floor((1 + Math.sqrt(4 * N + 1))/2).toLong

     def rec(m: Long, acm: Long): Long =
       if (m < N) {
         if ((N / m) == (N % m)) rec(m + 1, acm + m)
         else rec(m + 1, acm)
       } else acm

     println(rec(start, 0))
   }

}