You are given a positive integer $n$ greater or equal to $2$. For every pair of integers $a$ and $b$ ($2 \le |a|, |b| \le n$), you can transform $a$ into $b$ if and only if there exists an integer $x$ such that $1 < |x|$ and ($a \cdot x = b$ or $b \cdot x = a$), where $|x|$ denotes the absolute value of $x$.

After such a transformation, your score increases by $|x|$ points and you are not allowed to transform $a$ into $b$ nor $b$ into $a$ anymore.

Initially, you have a score of $0$. You can start at any integer and transform it as many times as you like. What is the maximum score you can achieve?


-----Input-----

A single line contains a single integer $n$ ($2 \le n \le 100\,000$) — the given integer described above.


-----Output-----

Print an only integer — the maximum score that can be achieved with the transformations. If it is not possible to perform even a single transformation for all possible starting integers, print $0$.


-----Examples-----
Input
4

Output
8
Input
6

Output
28
Input
2

Output
0


-----Note-----

In the first example, the transformations are $2 \rightarrow 4 \rightarrow (-2) \rightarrow (-4) \rightarrow 2$.

In the third example, it is impossible to perform even a single transformation.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Mathematics

Graph algorithms

Graph traversal

Implementation


Solutions:
n = int(input())
res = 0
for x in range(2, n):
	mults = n // x - 1
	res += 4 * x * mults
print(res)


from collections import defaultdict, Counter, deque
from math import sqrt, log10, log, floor, factorial, gcd
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations
from heapq import heapify, heappop, heappush
import sys, io, os
input = sys.stdin.readline
t = 1
for i in range(t):
	n = int(input())
	print(sum([sum([k // j for k in range(2 * j, n + 1, j)]) for j in range(2, n + 1)]) * 4)


n = int(input())
ans = 0
for i in range(2, n + 1):
	for j in range(2 * i, n + 1, i):
		ans += 4 * (j // i)
print(ans)


import sys
import math
input = sys.stdin.readline
from functools import cmp_to_key

def pi():
	return int(input())

def pl():
	return int(input(), 16)

def ti():
	return list(map(int, input().split()))

def ts():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
f = []

def factMod(n, m):
	global f
	f = [1 for i in range(n + 1)]
	f[0] = 1
	for i in range(1, n + 1):
		f[i] = f[i - 1] * i % m

def fact(n):
	global f
	f = [1 for i in range(n)]
	for i in range(1, n):
		f[i] = f[i - 1] * i

def fast_mod_exp(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b = b >> 1
	return res

def inverseMod(n, m):
	return fast_mod_exp(n, m - 2, m)

def ncrMod(n, r, m):
	if r == 0:
		return 1
	if n < r:
		return 0
	return f[n] * inverseMod(f[n - r], m) % m * inverseMod(f[r], m) % m

def ncr(n, r):
	if r == 0:
		return 1
	if n < r:
		return 0
	return f[n] / (f[r] * f[n - r])

def nc2(n):
	return n * (n - 1) / 2

def main():
	D()

def D():
	n = pi()
	ans = 0
	for i in range(2, n):
		ans += 4 * i * (math.floor(n / i) - 1)
	print(ans)
main()


from collections import defaultdict, Counter, deque
from math import sqrt, log10, log, floor, factorial, gcd
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations
from heapq import heapify, heappop, heappush
import sys, io, os
input = sys.stdin.readline
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
inf = float('inf')
mod = 10 ** 9 + 7

def get_list():
	return [int(i) for i in input().split()]

def yn(a):
	print('YES' if a else 'NO')
ceil = lambda a, b: (a + b - 1) // b
t = 1
for i in range(t):
	n = int(input())
	suma = 0
	for j in range(2, n + 1):
		for k in range(2 * j, n + 1, j):
			suma += k // j
	print(suma * 4)


N = int(input())
ans = 0
for i in range(2, N + 1):
	ans += 4 * i * (N // i - 1)
print(ans)


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
except Exception:

	def dprint(*args, **kwargs):
		pass
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
(N,) = getIntList()
re = 0
for i in range(2, N):
	t = N // i - 1
	re += t * i
print(re * 4)


import sys
input = sys.stdin.readline
n = int(input())
ans = 0
for i in range(2, n + 1):
	for j in range(i + i, n + 1, i):
		ans += j // i
print(4 * ans)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 5)
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
n = int(input())
ans = 0
for i in range(2, n + 1):
	ans += i * (n // i - 1)
print(ans * 4)


n = int(input())
print(4 * sum((x * ((n - x) // x) for x in range(2, n))))


n = int(input())
print(sum([i * (int(n / i) - 1) for i in range(2, n + 1)]) * 4)


n = int(input())
ans = 0
if n < 4:
	print('0')
	exit(0)
for i in range(2, n // 2 + 1):
	k = n // i
	ans += k * (k + 1) // 2 - 1
print(4 * ans)


n = int(input())
cnt = [0] * (n + 1)

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * (n + 1)

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n + 1) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]
uf = UnionFind(n)
for i in range(2, n + 1):
	for j in range(i, n + 1, i):
		uf.union(i, j)
for c in range(2, n + 1):
	p = uf.find(c)
	for j in range(2 * c, n + 1, c):
		cnt[p] += 4 * (j // c)
ans = max(cnt)
print(ans)


n = int(input())
ans = 0
if n == 2 or n == 3:
	print(0)
else:
	i = 2
	while i <= n:
		j = 2
		num = n // i
		ans += 2 * num * (num + 1)
		ans -= 4
		i += 1
	print(ans)


n = int(input())
print(sum([sum([k for k in range(2, n // j + 1)]) for j in range(2, n // 2 + 1)]) * 4)


import sys
n = int(input())
if n <= 3:
	print(0)
	return
score = 0
import math

def score(x):
	ANS = 0
	xr = math.ceil(math.sqrt(x))
	LIST = []
	for i in range(1, xr + 3):
		if x % i == 0:
			LIST.append(i)
			LIST.append(x // i)
	LIST = sorted(list(set(LIST)))
	for l in LIST[1:-1]:
		ANS += x // l
	return ANS
ANS = 0
for i in range(4, n + 1):
	ANS += score(i)
print(ANS * 4)


class IntegersFun:

	def __init__(self, n):
		self.n = n

	def get_value(self):
		sm = 0
		for i in range(2, self.n + 1):
			for j in range(2 * i, self.n + 1, i):
				sm += 4 * j / i
		return int(sm)
n = int(input())
print(IntegersFun(n).get_value())


import sys, io, os
input = sys.stdin.readline
inf = float('inf')
mod = 10 ** 9 + 7

def get_list():
	return [int(i) for i in input().split()]

def yn(a):
	print('YES' if a else 'NO')
ceil = lambda a, b: (a + b - 1) // b
t = 1
for i in range(t):
	n = int(input())
	print(sum([sum([k // j for k in range(2 * j, n + 1, j)]) for j in range(2, n + 1)]) * 4)


def fun_with_integers_linear2_solve():
	n = int(input())
	ans = 0
	for i in range(2, n):
		cant = n // i
		ans += cant * (cant + 1) // 2 - 1
	print(ans * 4)
fun_with_integers_linear2_solve()


import sys, io, os
input = sys.stdin.readline
t = 1
for i in range(t):
	n = int(input())
	print(sum([sum([k // j for k in range(2 * j, n + 1, j)]) for j in range(2, n + 1)]) * 4)


n = int(input())
A = [0] * (n + 1)
for i in range(2, n + 1):
	j = i * 2
	while j <= n:
		A[j] += j // i * 4
		j += i
for i in range(1, n + 1):
	A[i] += A[i - 1]
print(A[n])


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = ii()
ans = 0
for i in range(2, n):
	for j in range(2 * i, n + 1, i):
		ans += j // i
print(ans * 4)


i = input()
i = int(i)
v = 0
g = 2
s = 4
while g <= i:
	while s <= i:
		v = v + int(s / g * 4)
		s = s + g
	g = g + 1
	s = g * 2
print(str(v))


def fun_with_integers_sqrt_solve():
	n = int(input())
	ans = 0
	l = 2
	while l < n:
		r = n // (n // l)
		cant = n // l
		ans += (cant * (cant + 1) // 2 - 1) * (r - l + 1)
		l = r + 1
	print(ans * 4)
fun_with_integers_sqrt_solve()


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import math
alphabets = list('abcdefghijklmnopqrstuvwxyz')

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def si():
	return input()

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')

def fastPrintNextLines(a):
	print('\n'.join(map(str, a)))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = 1
for _ in range(t):
	n = ii()
	res = 0
	for i in range(2, n + 1):
		res += i * (n // i - 1)
	print(res * 4)


n = int(input())
rang = list(range(2, n // 2 + 1))
a = [i * (n // i - 1) for i in rang]
print(sum(a) * 4)


import sys
input = sys.stdin.readline
n = int(input())
print(sum([sum([k // j for k in range(2 * j, n + 1, j)]) for j in range(2, n + 1)]) * 4)


n = int(input())
r = 0
i = 2
while i * 2 <= n:
	a = int(n / i)
	r += (a + 2) * (a - 2 + 1) / 2
	i += 1
print(int(4 * r))


n = int(input())
ans = 0
for i in range(2, n + 1):
	cur = n // i
	if cur == 1:
		continue
	summ = (cur + 2) * (cur - 1) // 2
	ans += summ
print(ans * 4)


def fun_with_integers_graph_solve(n):
	ans = 0
	for i in range(-n, n):
		if i in [-1, 0, 1]:
			continue
		if i < 0:
			k = 2
			while i * k >= -n:
				ans += k
				k += 1
			k = 2
			while i * -k <= n:
				ans += k
				k += 1
		if i > 0:
			k = 2
			while i * k <= n:
				ans += k
				k += 1
			k = 2
			while i * -k >= -n:
				ans += k
				k += 1
	print(ans)
fun_with_integers_graph_solve(int(input()))


from math import sqrt, floor, ceil
n = int(input())
ran = list(range(2, 1 + n // 2))
xx = [d * (n // d - 1) for d in ran]
print(sum(xx) * 4)


n = int(input())
res = 0
for i in range(n - 2):
	if int(n / (i + 2) - 1):
		res += 4 * (i + 2) * int(n / (i + 2) - 1)
print(res)


from sys import stdin, stdout
import collections
N = int(input())
res = 0
for m in range(2, N + 1):
	d = N // m
	d -= 1
	res += d * m
	if d == 0:
		break
print(4 * res)