The Smart Beaver from ABBYY decided to have a day off. But doing nothing the whole day turned out to be too boring, and he decided to play a game with pebbles. Initially, the Beaver has n pebbles. He arranges them in a equal rows, each row has b pebbles (a > 1). Note that the Beaver must use all the pebbles he has, i. e. n = a·b.

<image> 10 pebbles are arranged in two rows, each row has 5 pebbles 

Once the Smart Beaver has arranged the pebbles, he takes back any of the resulting rows (that is, b pebbles) and discards all other pebbles. Then he arranges all his pebbles again (possibly choosing other values of a and b) and takes back one row, and so on. The game continues until at some point the Beaver ends up with exactly one pebble. 

The game process can be represented as a finite sequence of integers c1, ..., ck, where: 

  * c1 = n
  * ci + 1 is the number of pebbles that the Beaver ends up with after the i-th move, that is, the number of pebbles in a row after some arrangement of ci pebbles (1 ≤ i < k). Note that ci > ci + 1. 
  * ck = 1



The result of the game is the sum of numbers ci. You are given n. Find the maximum possible result of the game.

Input

The single line of the input contains a single integer n — the initial number of pebbles the Smart Beaver has.

The input limitations for getting 30 points are: 

  * 2 ≤ n ≤ 50



The input limitations for getting 100 points are: 

  * 2 ≤ n ≤ 109

Output

Print a single number — the maximum possible result of the game.

Examples

Input

10


Output

16


Input

8


Output

15

Note

Consider the first example (c1 = 10). The possible options for the game development are:

  * Arrange the pebbles in 10 rows, one pebble per row. Then c2 = 1, and the game ends after the first move with the result of 11. 
  * Arrange the pebbles in 5 rows, two pebbles per row. Then c2 = 2, and the game continues. During the second move we have two pebbles which can be arranged in a unique way (remember that you are not allowed to put all the pebbles in the same row!) — 2 rows, one pebble per row. c3 = 1, and the game ends with the result of 13. 
  * Finally, arrange the pebbles in two rows, five pebbles per row. The same logic leads us to c2 = 5, c3 = 1, and the game ends with the result of 16 — the maximum possible result.

Difficulty: EASY
Tags: Number theory

Starter code:

Solutions:
n = int(input())
(i, s) = (2, n)
m = int(n ** 0.5) + 1
while n > 1 and i < m:
	if n % i:
		i += 1
	else:
		n //= i
		s += n
print(s + (n > 1))


n = int(input())
from math import sqrt
ans = n
while n != 1:
	divisor = 1
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			divisor = i
			break
	if divisor == 1:
		ans += 1
		break
	ans += n // divisor
	n = n // divisor
print(ans)


__author__ = 'Esfandiar'
import sys
input = sys.stdin.readline
n = int(input())
res = n
while n:
	f = 1
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			res += n // i
			n //= i
			f = 0
			break
	if f:
		res += 1
		break
print(res)


import math

def maxsum(n):
	ans = 0
	while n > 1:
		ans += n
		flag = 0
		for i in range(2, int(math.sqrt(n)) + 1):
			if n % i == 0:
				flag = 1
				n = n // i
				break
		if flag == 0:
			break
	return ans + 1
n = int(input())
print(maxsum(n))


n = int(input())

def pebbles(n, count):
	maxi = 0
	a = 2
	while a * a <= n:
		b = n / a
		if b % 1 == 0 and b > maxi:
			maxi = b
		a += 1
	count += maxi
	if maxi == 0:
		count += 1
		print(count)
		return
	pebbles(int(maxi), int(count))
if n == 1:
	print(1)
else:
	pebbles(n, n)


n = int(input())
k = 2
ans = n
while k * k <= n:
	while n % k == 0:
		n //= k
		ans += n
	if k == 2:
		k = 3
	else:
		k += 2
if n > 1:
	ans += 1
print(ans)


def primeFact(n):
	ans = []
	i = 3
	num = n
	while n % 2 == 0:
		ans.append(2)
		n = n / 2
	num = n
	while i * i < num + 1:
		while n % i == 0:
			ans.append(i)
			n = n / i
		i += 2
	if n > 1:
		ans.append(int(n))
	return ans
n = int(input())
facts = primeFact(n)
ans = n
for i in facts:
	n = n // i
	ans += n
print(ans)


def prime(n):
	if n == 2 or n == 3:
		return True
	elif n % 2 == 0:
		return False
	else:
		for i in range(3, int(n ** 0.5) + 1, 2):
			if n % i == 0:
				return False
		return True

def factors(n):
	l = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			l.append(i)
			if i != n ** 0.5:
				l.append(n // i)
	return l

def solution(n):
	if prime(n):
		return n + 1
	else:
		ans = n
		l = factors(n)
		x = min(l)
		y = n // x
		ans = ans + y
		n = y
		while not prime(n):
			l = factors(n)
			x = min(l)
			y = n // x
			ans = ans + y
			n = y
		ans = ans + 1
		return ans
n = int(input())
print(solution(n))


n = int(input())
i = 2
Sum = n
while True:
	if i ** 2 > n:
		Sum += 1
		break
	elif n % i == 0:
		n = n // i
		Sum += n
	else:
		i += 1
print(Sum)


def prime_test(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if n % i == 0:
			return False
	return True

def function(n):
	count = 0
	ans = n
	m = 2
	while m <= n:
		if n % m == 0:
			ans += n // m
			n = n // m
		else:
			m += 1
			count += 1
			if count >= 10 ** 6:
				if prime_test(n):
					ans += 1
					break
	return ans
n = int(input())
print(function(n))


def main():
	n = int(input())
	sum_points = n
	from math import floor, sqrt
	while n > 1:
		try:
			max_divisor = floor(sqrt(n)) + 1
			divisor = next((i for i in range(2, max_divisor) if n % i == 0))
			while n % divisor == 0:
				n //= divisor
				sum_points += n
		except StopIteration:
			n = 1
			sum_points += n
	print(sum_points)
main()


def isPrime(n):
	if n <= 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def number(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return n // i
		else:
			continue
n = int(input())
count = n
left = n
while left > 1:
	if isPrime(left):
		break
	else:
		count += number(left)
		left = number(left)
count += 1
print(count)


number = int(input())

def rectangularGame(currentNum):
	if currentNum == 1:
		return 1
	else:
		numSqrt = int(currentNum ** 0.5)
		div = 1
		for i in range(2, numSqrt + 1):
			if currentNum % i == 0:
				div = i
				break
		if div == 1:
			return currentNum + 1
		else:
			return currentNum + rectangularGame(int(currentNum / div))
print(rectangularGame(number))


from collections import Counter

def factors(n):
	if n == 1:
		return [1]
	i = 2
	factors = []
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				factors.append(i)
				n //= i
		i += 1
	if n != 1:
		factors.append(n)
	return factors

def main():
	n = int(input())
	res = n
	for e in factors(n):
		n //= e
		res += n
	print(res)
main()


from sys import stdin
from math import sqrt
input = stdin.readline
n = int(input())
ans = n
s = int(sqrt(n))
fact = []
for i in range(1, s + 1):
	if n % i == 0:
		fact.append(i)
		fact.append(n // i)
if fact[-1] == fact[-2]:
	fact.pop()
fact.sort()
i = len(fact) - 2
j = len(fact) - 1
while i >= 0:
	if fact[j] % fact[i] == 0:
		ans += fact[i]
		j = i
	i -= 1
print(ans)


n = int(input())
res = n
while n != 1:
	i = 2
	while i * i <= n:
		if not n % i:
			break
		i += 1
	if i * i > n:
		n = 1
	else:
		n //= i
	res += n
print(res)


def sieve(x):
	i = 2
	while i * i <= x:
		if x % i == 0:
			return x // i
		i += 1
	else:
		return 1
n = int(input())
c = n
ans = c
while c != 1:
	c = sieve(c)
	ans += c
print(ans)


n = int(input())
d = 2
r = 1
while d * d <= n:
	while n % d < 1:
		r += n
		n //= d
	d += 1
if n > 1:
	r += n
print(r)


a = int(input())
c = a
while a > 1:
	v = 0
	for i in range(2, int(a ** 0.5) + 1):
		if a % i == 0:
			a //= i
			c += a
			v = 1
			break
	if not v:
		c += 1
		break
print(c)


def greatestFactor(x):
	i = 2
	while i * i <= x:
		if x % i == 0:
			return int(x / i)
		else:
			i = i + 1
	if i * i > x:
		return 1
x = int(input())
c = x
while x != 1:
	c = c + greatestFactor(x)
	x = greatestFactor(x)
print(c)


n = int(input())
sum = n
while n % 2 == 0:
	n = n // 2
	sum = sum + n
i = 3
while i <= int(n ** 0.5):
	while n % i == 0:
		n = n // i
		sum = sum + n
	i = i + 2
if n > 2:
	sum = sum + 1
print(sum)


N = int(input())
ans = N
lastD = 2
while N > 1:
	nextD = None
	for i in range(lastD, int(N ** (1 / 2)) + 1):
		if N % i == 0:
			nextD = i
			break
	if nextD != None:
		ans += N // nextD
		N //= nextD
	else:
		ans += 1
		N = 1
print(ans)


n = int(input())
result = n
while n != 1:
	a = 2
	while a * a <= n:
		if n % a == 0:
			break
		a += 1
	if a * a > n:
		n = 1
	else:
		n //= a
	result += n
print(result)


from collections import defaultdict
import math

def solve(n):
	sq = math.ceil(n ** 0.5)
	ans = 0
	for i in range(2, sq + 1):
		while n % i == 0:
			ans += n
			n //= i
	return ans + n + (n > 1)
print(solve(int(input())))


from collections import deque, defaultdict, Counter
from itertools import product, groupby, permutations, combinations
from math import gcd, floor, inf, log2, sqrt, log10
from bisect import bisect_right, bisect_left
from statistics import mode
from string import ascii_uppercase

def divisors(x):
	divs = [1]
	for i in range(2, int(x ** 0.5) + 1):
		if x % i == 0:
			divs.append(i)
			divs.append(x // i)
			break
	return max(divs)
n = int(input())
ans = n
prev = inf
while True:
	x = divisors(n)
	if x < prev:
		ans += x
		prev = x
	n -= x
	if x == 1:
		break
print(ans)


import math
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 11897, 36709, 1187, 1193, 1201, 1213, 1217, 31607]
n = int(input())
tot = n
for i in range(len(primes)):
	while n % primes[i] == 0:
		tot += n // primes[i]
		n = n // primes[i]
if n == 1:
	print(tot)
else:
	print(tot + 1)


import math
n = int(input())
sum = n
x = n
while x != 1:
	f = True
	for i in range(2, int(math.sqrt(x)) + 1):
		if x % i == 0:
			x = x // i
			f = False
			break
	if f:
		x = 1
	sum += x
print(sum)


def flag(x):
	return x and (not x & x - 1)
import math

def big(n):
	z = int(math.sqrt(n))
	for i in range(2, z + 1):
		if n % i == 0:
			return n // i
	return 1

def solve(n):
	if flag(n):
		return n + (n - 1)
	else:
		ans = 0
		while n % 2 == 0:
			ans += n
			n = n // 2
		ans += n
		while n != 1:
			z = big(n)
			n = z
			ans += z
		return ans
n = int(input())
print(solve(n))


def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def pebbles(n, k):
	k += n
	if n == 1:
		return int(k)
	else:
		n = n / smallestDivisor(n)
		return pebbles(n, k)
n = int(input())
print(pebbles(n, 0))


import sys, math, string, bisect
input = sys.stdin.readline
from collections import deque
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = I()
c = n
while n != 1:
	p = 2
	k = n
	while p < n ** 0.5 + 1:
		if n % p == 0:
			c += n // p
			n = n // p
			break
		p += 1
	if n == k:
		c += 1
		n = 1
print(c)


n = int(input())
a = {}

def search(k):
	if k not in a:
		t = 1
		i = 2
		while i * i <= k:
			if k % i == 0:
				t = max(t, search(i), search(k // i))
			i += 1
		a[k] = k + t
	return a[k]
print(search(n))


n = int(input())
r = n + 1
i = 2
s = n ** 0.5
while i <= s:
	if n % i == 0:
		r += n // i
		n //= i
		s = n ** 0.5
		i = 1
	i += 1
print(r)