Abundance and Perfect Numbers

Perfect numbers are the numbers whose sum of divisors are twice the number itself. For example 28 is a perfect number because the summation of the divisors of 28 is (1+2+4+7+14+28) = 56 = 2∗28. Like perfect persons perfect numbers are also rare. The first few even perfect numbers are 6, 28, 496, 8128, 33550336, 8589869056, 137438691328 and 2305843008139952128. The sign σ is used to denote the function, the sum of all divisors. So we can write σ(28) = 56. If n is a perfect number then σ(n) − 2n = 0. If an even number has only one odd divisor (other than one) then that number is called almost odd prime. For example 6, 24 are almost odd prime numbers. Let X denote the set of all almost odd prime numbers. Then the abundance function abun() is defined as ∑ abun(n) = for any positive number n. Given the value of n your job is to find the value of abun(n). Input The input file contains at most 1001 lines of inputs. Each line contains an integer n (1 ≤ n ≤ 10000000), which denotes the value of n. Input is terminated by a line where the value of n is zero. This line should not be processed. Output For each line of input produce one line of output. This line contains two integers separated by a single space. The first integer is the input number n and the second integer is the value of abun(n). Sample Input 10 20 1000000 0 Sample Output 10 -2 20 0 1000000 -13478901222 ai∈X, ai≤n σ(ai) − 2ai