You are given a positive integer N. Find the sum of K * f(K) for K ranging from 1 to N, where f(X) is the number of positive divisors of X. The input is given as N, and the output should be the sum of K * f(K). The constraints are 1 ≤ N ≤ 10^7. For example, if N is 4, the output should be 23, calculated as 1*1 + 2*2 + 3*2 + 4*3. Be cautious of potential overflows.

# Buggy version:
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re


def main_chk():
    N = int(input())

    ans = 0
    for i in range(1,N+1):
        m = N // i
        ans += ( m + 1 ) * m * i / 2

    print(ans)
main_chk()


# Fixed version:
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re


def main_chk():
    N = int(input())

    ans = 0
    for i in range(1,N+1):
        m = N // i
        ans += ( m + 1 ) * m * i / 2

    print(math.floor(ans))
main_chk()

# Buggy version:
def main():
    n = int(input())
    if n == 1:
        print(1)
        sys.exit()
    # nd:num of div
    r = 0
    for i1 in range(1, n):
        y = n // i1
        r += y * (y + 1) * i1 / 2
    print(int(r))

if __name__ == '__main__':
    main()


# Fixed version:
import sys
read = sys.stdin.read
def main():
    n = int(input())
    if n == 1:
        print(1)
        sys.exit()
    # nd:num of div
    r = 0
    for i1 in range(1, n + 1):
        y = n // i1
        r += y * (y + 1) * i1 / 2
    print(int(r))

if __name__ == '__main__':
    main()

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

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

# Buggy version:
s = 0
q = int(n ** .5)
for i in range(1, int(n ** .5) + 1):
	x = n // i
	s += i * (x * (x+1)) / 2
	if x**2 != n:
		y = max(n // (i+1), q)
		s += (i * (i+1) // 2) * ((x * (x+1) // 2) - (y * (y+1) // 2))

print(int(s))

# Fixed version:
n = int(input())

s = 0
q = int(n ** .5)
for i in range(1, q+1):
	x = n // i
	s += i * (x * (x+1)) / 2
	if x**2 != n:
		y = max(n // (i+1), q)
		s += (i * (i+1) // 2) * ((x * (x+1) // 2) - (y * (y+1) // 2))

print(int(s))

# Buggy version:
n = int(input())
cnts = [k*d*(d+1)//2 for k in range(1,n//2)]
print(sum(cnts)+ (n//2)*d*(d+1)//2)

# Fixed version:
n = int(input())
cnts = [k*(n//k)*((n//k)+1)//2 for k in range(1,n//2+1)]
print(sum(cnts)+ ((n//2+1)+n)*(n-(n//2+1)+1)//2)

# Buggy version:
def solve(n):
    ans = 0
    for i in range(1,n+1):
        y = n//i
        print(y)
        ans += (y*(y+1)*i)/2
    return ans

def main():
    n = int(input())
    print(int(solve(n)))

if __name__ == "__main__":
    main()


# Fixed version:
def solve(n):
    ans = 0
    for i in range(1,n+1):
        y = n//i
        ans += (y*(y+1)*i)/2
    return ans

def main():
    n = int(input())
    print(int(solve(n)))

if __name__ == "__main__":
    main()

# Buggy version:
n=int(input())

su = 0
for i in range(1,n+1):
    m = int(n/i)
    su += int(m*(2*i + (m-1)*i)/2)
    

print(su)

# Fixed version:
n=int(input())
 
su = 0
for i in range(1,int(n**0.5)+1):
    m = int(n/i) - i + 1
    su += m*(2*i*i + (m-1)*i) - i*i
    
 
print(su)