Problem:
 Score : 400 points    Problem Statement For a positive integer X , let f(X) be the number of positive divisors of X .  Given a positive integer N , find \sum_{K=1}^N K\times f(K) .      Constraints  1 \leq N \leq 10^7         Input Input is given from Standard Input in the following format:  N       Output Print the value \sum_{K=1}^N K\times f(K) .        Sample Input 1 4      Sample Output 1 23  We have f(1)=1 , f(2)=2 , f(3)=2 , and f(4)=3 , so the answer is 1\times 1 + 2\times 2 + 3\times 2 + 4\times 3 =23 .       Sample Input 2 100      Sample Output 2 26879       Sample Input 3 10000000      Sample Output 3 838627288460105  Watch out for overflows.

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()

    ans_list = [1] * n

    for i in range(2,n+1):
        for j in range(i,n+1,i):
            ans_list[j-1] += 1

    count = 0
    for i, ans in enumerate(ans_list):
        count += (i+1) * ans

    print(count)
 
if __name__ == '__main__':
    main()

Solution (Python):




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

Solution (Python):
def solve(n):
  ans = 0
  for i in range(1,n+1):
    for j in range(i,n+1,i):
      if j % i == 0:
        ans += j
  return ans

def main():
  N = int(input())
  print(solve(N))
  return

main()

Solution (Python):
def S(k):
    return k * (k + 1) // 2

N = int(input())
M = int((N+1)**.5)
ans = 0

for i in range(1, N // (M+1) + 1):
    ans += i * S(N // i)

for k in range(1, M+1):
    ans += S(k) * (S(N//k) - S(N//(k+1)))
print(ans)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline

def S(k):
    return k * (k + 1) // 2

N = int(readline())
M = int((N+1)**.5)
ans = 0

for i in range(1, N // (M+1) + 1):
    ans += i * S(N // i)

for k in range(1, M+1):
    ans += S(k) * (S(N//k) - S(N//(k+1)))
print(ans)

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

Solution (Python):
n = int(input())
s = 0
for i in range(1, n + 1):
  d = n // i
  s += d * (d + 1) // 2 * i
print(s)

Solution (Python):
def cal(b, e):
    return ((b + (e//b) * b) * (e//b))//2

n = int(input())
ans = 0

for i in range(1, n+1):
    ans += cal(i, n)

print(ans)

Solution (Python):
def A083356(n):
    t = 0
    for r in range(1, int(n**0.5)+1):
        t += r*(r+int(n/r))*(int(n/r)+1-r)//2
    return t

def A000330(n):
    return n * (n + 1) * (2 * n +1) // 6

def A143127(n):
    return 2 * A083356(n) - A000330(int(n**0.5))

n = int(input())
print(A143127(n))

Solution (Python):
def cal(b, e):
    return ((b + (e//b) * b) * (e//b))//2

n = int(input())
ans = 0

for i in range(1, n+1):
    ans += cal(i, n)

print(ans)

Solution (Python):
import math
n=int(input())

l=[2 for i in range(max(2,n+1))]
l[1]=1

for i in range(2,int(math.sqrt(n))+1):
  for j in range(i,n//i+1):
    if i==j:
      l[i*j]+=1
    else:
      l[i*j]+=2
print(sum([i*l[i] for i in range(n+1)]))

Solution (Python):
import math
n=int(input())

l=[4 if i%2==0 else 2 for i in range(max(5,n+1))]
l[1]=1
l[2]=2
l[4]=3
for i in range(3,int(math.sqrt(n))+1):
  for j in range(i,n//i+1):
   
    if i==j:
      l[i*j]+=1
    else:
      l[i*j]+=2


l2=[i*l[i] for i in range(n+1)]
print(sum(l2))

Solution (Python):
import time
import math
N=int(input())
if N==1:
    print(1)
    exit()


d=[1]*(N+1)

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


print(ans)

Solution (Python):
N = int(input())

div = [0 for _ in range(10**7+5)];

for i in range(1,10**7+1):
    j = 1
    while i * j <= N:
        div[i * j] += 1
        j += 1

ans = 0

for i in range(1,N+1):
    ans += div[i] * i
print(ans)

Solution (Python):
N = int(input())

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
ans = 0
for i in range(1, N+1):
    for j in range(i, N+1, i):
        ans += j
print(ans)

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

Solution (Python):
n = int(input())
print(sum(n//i * (n//i+1) // 2 * i for i in range(1, n+1)))

Solution (Python):

import sys


buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    ans = 0
    for i in range(1, N+1):
        for j in range(i, N+1, i):
            ans += j
    return ans


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Solution (Python):

"""
Created on Sun Jun 28 13:44:44 2020

@author: NEC-PCuser
"""
N = int(input())
ans = 0
for i in range(1, N + 1):
    n = N // i
    ans += i * n * (n + 1) // 2 

print(ans)

Solution (Python):
N = int(input())


def g(n):
    return (n * (n + 1))//2

total = 0
for i in range(1,N+1):
    total += i * g(N//i)
    
print(total)

Solution (Python):

import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys


buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    ans = 0
    for i in range(1, N+1):
        for j in range(i, N+1, i):
            ans += j
    return ans


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
ans=0
for i in range(1,N+1):
    mn,mx=i,N//i*i
    ko=(mx-mn)//i+1
    ans+=(mn+mx)*ko//2
print(ans)

Solution (Python):
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    n = ni()
    m = int((n+1)**.5)
    u = n // (m + 1)
    ans = 0
    for i in range(1, u+1):
        v = n // i
        ans += v * (v + 1) // 2 * i
    for i in range(m, 0, -1):
        v = n // i
        ans += (v * (v + 1) - u * (u + 1)) // 2 * i * (i + 1) // 2
        u = v
    print(ans)
    return

solve()

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

Solution (Python):
N = int(input())
 
sum = 0
for n in range(1,N+1):
    num = N//n
    sum += n*(1+num)*num//2
print(sum)

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

Solution (Python):
N = int(input())
 
sum = 0
for n in range(1,N+1):
    num = N//n
    sum += n*((1+num)*num)//2
print(sum)

Solution (Python):
import numpy as np

N = int(input())

Xarray = np.arange(1, N+1)
Xans = ((N // Xarray) * (2 * Xarray + ((N // Xarray) - 1) * Xarray)) // 2

print(sum(Xans))

Solution (Python):
n = int(input())

L = [0] * (n + 1)

for i in range(1, n + 1):
    for j in range(1, (n // i)+1):
        L[i * j] += 1

i = 0
ans = 0
for i in range(len(L)):
    ans += i *L[i]

print(ans)

Solution (Python):
N = int(input())
 
sum = 0
for n in range(1,N+1):
    num = N//n
    s = ((1+num)*num)//2
    sum += n*s
print(sum)

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

Solution (Python):
N = int(input())

sum = 0
for i in range(1, N+1):
    k = N // i 
    sum += int(i * k * (k+1) / 2)
print(sum)

Solution (Python):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
ans=0
for i in range(1,n+1):
    x=n//i
    ans+=i*x*(x+1)//2
print(ans)

Solution (Python):
n=int(input())

ans=0

def calc(begin, end, cnt):
    return cnt*(begin+end)//2

for i in range(1, n+1):
    begin=i
    end=(n//i)*i
    cnt=(n//i)

    ans+=calc(begin, end, cnt)

print(ans)

Solution (Python):
n=int(input())

d=[0]*(n+1)

for i in range(1,n+1):
    for j in range(i,n+1,i):
        d[j]+=1
        
ans=0
for j in range(n+1):
    ans+=j*d[j]
print(ans)

Solution (Python):
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    n = ni()
    ans = 0
    for i in range(1, n+1):
        v = n // i
        ans += v * (v + 1) // 2 * i
    print(ans)
    return

solve()

Solution (Python):
n=int(input())

ans=0

for i in range(1, n+1):
    begin=i
    end=(n//i)*i
    cnt=(n//i)
    ans+=cnt*(begin+end)//2

print(ans)

Solution (Python):
n=int(input())

ans=0

for i in range(1, n+1):
    begin=i
    end=(n//i)*i
    cnt=(n//i)
    ans+=(1/2)*cnt*(begin+end)

print(int(ans))

Solution (Python):
n = int(input())

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

print(ans)

Solution (Python):
n=int(input())

def sum_k(n):
    return n*(n+1)//2

ans=0
for i in range(1,n+1):
    ans+=i*sum_k(n//i)

print(ans)

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

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

Solution (Python):
def g(n):
    return n*(n+1)//2

N = int(input())

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

Solution (Python):
N=input()
ans=0
for cur in range(1,N+1):
    for i in range(cur,N+1,cur):
        ans+=i
print ans

Solution (Python):
import math
N=input()
ans=0
for cur in range(1,N+1):
    for i in range(cur,N+1,cur):
        ans+=i
print ans

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

Solution (Python):
n = int(input())
F = [1] * -~n
for i in range(2, n + 1):
    for j in range(i, n + 1, i):
        F[j] += 1
print(sum(e * v for e, v in enumerate(F)))

Solution (Python):
def solve(N):
    ans = 0
    for i in range(1,N+1):
        tmp = N//i
        ans += tmp*(2*i + (tmp-1)*i)//2
    
    return ans 

print(solve(int(input())))

Solution (Python):
import time
import math
N=int(input())
if N==1:
    print(1)
    exit()


d=[1]*(N+1)

ans=1
for i in range(2,N+1):
    j=0
    while i+j<=N:
        d[i+j]+=1
        j+=i
    ans+=d[i]*i


print(ans)

Solution (Python):
def solve(N):
    ans = 0
    for i in range(1,N+1):
        ans += N//i*(2*i + (N//i-1)*i)//2
    
    return ans 

print(solve(int(input())))

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n+1):
    ans += i*(n//i)*(n//i+1)//2

print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
  n = N//i
  cnt = i*n*(n+1)//2
  ans += cnt
print(ans)

Solution (Python):
N = int(input())

nn = N//2
t = 0
for j in range(1,nn+1):
  m = N//j
  t += (1+m)*m//2 * j

t += ((nn+1)+N)*(N-nn)//2
print(t)

Solution (Python):
N = int(input())
res = 0
for i in range(1, N+1):
    j = N // i
    res += j * (j + 1) // 2 * i
print(res)

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

Solution (Python):
n = int(input())

ans = 0

for i in range(1, n+1):
    ans += (i+(n//i)*i)*(n//i)//2

print(ans)

Solution (Python):
n = int(input())
ans = 0

for i in range(1, n + 1):
    y = n // i
    ans += y * (y + 1) * i // 2


print(ans)

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

Solution (Python):
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(input())
    ans = 0
    sumn = lambda x: x*(x+1)//2
    for i in range(1,n+1):
        r = n//i
        ans += i*(sumn(r))
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import sys 
import numpy as np
from numba import jit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
@jit(cache=True)
def solve(n):
  a = np.zeros(N+1,np.int64)
  for i in range(1,N+1):
      for j in range(i,N+1,i):
        a[j] += j
  ans = a.sum()
  return ans
 
N = int(readline())
print(solve(N))

Solution (Python):
N = int(input())

def gfunc(n):
    return int((n * (n + 1)) / 2)


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

Solution (Python):
def m():
    N = int(input())
    ans = 0
    for i in range(1, N + 1):
        n = N//i

        ans += (n * (n + 1) // 2)*i
        pass
    return ans


print(m())

Solution (Python):
n=int(input())
g=0
for i in range(n):
    g+=((n//(i+1))*((n//(i+1)+1)*(i+1)/2))
print(int(g))

Solution (Python):
n=int(input())
g=0
for i in range(n):
    g+=((n//(i+1))*((n//(i+1)+1)*(i+1)/2))
print(int(g))

Solution (Python):
import math
N=input()
A=[ 2 for _ in range(N+1)]
A[0]=0
A[1]=1

for cur in range(2,N+1):
    for i in range(cur*2,N+1,cur):
        A[i]+=1

ans=0
for i in range(1,N+1):
    ans+=i*A[i]
print ans

Solution (Python):
N = int(input())
ans = 0
for i in range(int(N)):
  q = N // (i+1)
  
  ans += (i+1)*q*(q+1)/2
print(int(ans))

Solution (Python):

import math
N=input()
A=[ 2 for _ in range(N+1)]
A[0]=0
A[1]=1

for cur in range(2,N+1):
    for i in range(cur*2,N+1,cur):
        A[i]+=1

ans=0
for i in range(1,N+1):
    ans+=i*A[i]
print ans

Solution (Python):
def main():
  N,t=int(input()),0
  for x in range(1,N+1):
    t+=(N//x)*(N//x+1)*x//2
  print(t)

main()

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
    for j in range(i,n+1,i):
        ans+=j
print(ans)

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
	return list(map(int,input().split()))
def m(): 
	return map(int,input().split())
def onem(): 
	return int(input())
def s(x): 
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): 
	return " ".join(map(str,x))
def max2(x): 
	return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

n = onem()

ans = 0

for i in range(1,n+1):
	po = n // i
	ans += po * (2*i+(po-1)*i) // 2
print(ans)

Solution (Python):
n=int(input())

ksum=0
nn=n//2
for k in range(1,nn+1):
    m=n//k
    ksum+=k*m*(m+1)//2

ksum=ksum+(n-nn)*(n++nn+1)//2

print(ksum)

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

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

Solution (Python):
N = int(input())
ans = N * (N + 1) // 2
for i in range(2, N + 1):
    p = N // i
    ans += i * (p * (p + 1) // 2)
print(ans)

Solution (Python):
n=int(input())

ksum=0
for k in range(1,n+1):
    m=n//k
    ksum+=k*m*(m+1)//2
    
print(ksum)

Solution (Python):
n = int(input().strip())

ans=0
for divisor in range(1,n+1):
    ans+=divisor*(n//divisor*(n//divisor+1)//2)

print(ans)

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
	return list(map(int,input().split()))
def m(): 
	return map(int,input().split())
def onem(): 
	return int(input())
def s(x): 
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): 
	return " ".join(map(str,x))
def max2(x): 
	return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""


def make_primes(n): 
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass  


def prime_decomposition(n): 
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table

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

    
    return len(divisors)


n = onem()
po = [1 for i in range(10**7+1)]

for i in range(n+1):
	if i == 0 or i == 1:
		continue
	for j in range(i,n+1,i):
		po[j] += 1
an = 0

for i in range(n+1):
	an += po[i]*i
print(an)

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    L = [0] * (n + 1)
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            L[j] += 1

    res = 0
    for i in range(1, n + 1):
        res += i * L[i]
    print(res)


def resolve2():
    def g(n):
        return ((n + 1) * n) // 2

    n = int(input())
    res = 0
    for i in range(1, n + 1):
        res += i * g(n // i)
    print(res)


if __name__ == '__main__':
    resolve2()

Solution (Python):
n=int(input())

ksum=0
for k in range(1,n+1):
    m=n//k
    ksum+=k*m*(m+1)//2
    
print(ksum)

Solution (Python):

import sys
import math as mt
import bisect
input=sys.stdin.buffer.readline  
t=1

for _ in range(t):
    
    
    
    n=int(input())
    ans=0
    for i in range(1,n+1):
        for j in range(i,n+1,i):
            ans+=j
    print(ans)

Solution (Python):
import sys

import numba as nb

input = sys.stdin.readline


@nb.njit("i8(i8)")
def g(n):
    return n * (n + 1) // 2


@nb.njit("i8(i8)")
def solve(n):
    ans = 0
    for i in range(1, n + 1):
        ans += i * g(n // i)
    return ans


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

    ans = solve(N)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())

divisors = [0 for _ in range(n+1)]

for i in range(1, n+1):
    for j in range(i, n+1, i):
        divisors[j] += 1


ans = 0
for k in range(n+1):
    ans += (k * divisors[k])

print(ans)

Solution (Python):
import sys



input = sys.stdin.readline



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


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

    ans = solve(N)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

import numba as nb

input = sys.stdin.readline


@nb.njit("i8(i8)")
def solve(n):
    ans = 0
    for i in range(1, n + 1):
        m = n // i
        ans += i * m * (m + 1) // 2
    return ans


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

    ans = solve(N)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
def solve():
    
    n = int(input())
    
    divisors = [0 for _ in range(n+1)]
    
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            divisors[j] += 1
    
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

solve()

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

Solution (Python):
N = int(input())

m = [0] * (N+1)
for i in range(1, N+1):
  temp = i
  for k in range(temp, N+1, i):
    m[k] += 1

ans = 0
for n in range(1, N+1):
  ans += n*m[n]
print(ans)

Solution (Python):
import numpy as np
from numba import jit

@jit 
def solve():
    
    n = int(input())
    
    divisors = np.zeros(n+1, np.int64)
    
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            divisors[j] += 1
    
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

solve()

Solution (Python):
import sys
input = sys.stdin.readline

if __name__ == '__main__':
  n=int(input())
  ans=0
  d=[0]*(n+1)
  for i in range(1,n+1):
    for j in range(i,n+1,i):
      d[j]+=1
  for i in range(1,n+1):
    ans+=i*d[i]
  print(ans)

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    L = [0] * (n + 1)
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            L[j] += 1

    res = 0
    for i in range(1, n + 1):
        res += i * L[i]
    print(res)


if __name__ == '__main__':
    resolve()

Solution (Python):
N = int(input())

ans = 0

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

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

Solution (Python):

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

Solution (Python):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



def floor(a,b):
    return a//b

N = I()

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

print(ans)

Solution (Python):
N = int(input())

def g(n):
  return ((n**2)+n)//2

goukei = 0
half = N//2
for i in range(1,half+1):
  goukei += i*g(N//i)

add = list(range(half+1,N+1))
goukei += sum(add)
print(goukei)

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def main():
    INF = 999999999999999999999999
    MOD = 10**9+7

    n = int(input())

    ans = 0
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            ans += j

    print(ans)

main()

Solution (Python):
N = int(input())

def g(X, N):
  Y = N//X
  return Y*(Y+1)*X//2

ans = 0
for i in range(1,N+1):
  ans += g(i,N)
  
print(ans)

Solution (Python):

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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()

N = int(input())

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

Solution (Python):



N = int(input())


ans = 0


for j in range(1, N+1):
    Y = N // j
    ans += ((Y * (Y + 1))*j) // 2


print(ans)

Solution (Python):

n = int(input())


def calc(b,e):
    cnt = e//b
    return (b+e)*cnt//2
ans = 0

for i in range(1,n+1):
    ans += calc(i,n//i*i)
print(ans)

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline



def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
ans = 0

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

print(ans)

Solution (Python):
import sys

import numba as nb

input = sys.stdin.readline


@nb.njit("i8(i8)")
def solve(n):
    table = [0] * (n + 1)
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    ans = 0
    for i, v in enumerate(table):
        ans += i * v
    return ans


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

    ans = solve(N)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())

ans = 0
D = [0] * (N+1)
for i in range(1, N+1):
    for j in range(i, N+1, i):
        D[j] += 1
    ans += i*D[i]
print(ans)

Solution (Python):
import numpy as np
from numba import jit

@jit
def solve():
    
    n = int(input())
    
    divisors = np.zeros(n+1, np.int64)
    
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            divisors[j] += 1
    
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

solve()

Solution (Python):
import sys

import numba as nb

input = sys.stdin.readline


@nb.njit
def solve(n):
    table = [0] * (n + 1)
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    ans = 0
    for i, v in enumerate(table):
        ans += i * v
    return ans


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

    ans = solve(N)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    n = ni()
    g = [1]*(n+1)
    for i in range(2, n+1):
        for j in range(i, n+1, i):
            g[j] += 1
    s = sum(i*g[i] for i in range(n+1))
    print(s)
    return

solve()

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

Solution (Python):


N=int(input())
count=0
for i in range(1,N+1):
    n=N//i
    count=n*(i+i*n)//(2)+count
print(count)

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

INF = 999999999999999999999999
MOD = 10**9+7

n = int(input())

ans = 0
for i in range(1, n+1):
    for j in range(i, n+1, i):
        ans += j

print(ans)

Solution (Python):


N = int(input())

ans = 0

for i in range(1, N+1):
    for j in range(i, N+1, i):
        
        ans += j
    
print(ans)