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):
N = int(input())
f = [0] + [1] + [2] * (N - 1)
for d in range(2, int(N ** 0.5) + 1):
    for i in range((N // d) * d, d * d - 1, -d):
        if d * d == i:
            f[i] += 1
        else:
            f[i] += 2

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

print(ans)

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

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

print(int(ans))

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

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

Solution (Python):
N = int(input())
ans = 0
for d in range(1, N + 1):
    ans += (1 + N // d) * (N // d) * d // 2
 
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)

Solution (Python):

import sys

sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)

from collections import OrderedDict, defaultdict








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

    ret = 0
    for i in range(1,N+1):
        tmp = N // i
        left = i
        right = i * tmp
        ret += (left + right) * tmp // 2
    print(ret)
if __name__ == "__main__":
    run()

Solution (Python):

import sys

sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)

from collections import OrderedDict, defaultdict








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

    ret = 0
    for i in range(1,N+1):
        tmp = N // i
        left = i
        right = i * tmp
        ret += (left + right) * tmp // 2
    print(ret)
if __name__ == "__main__":
    run()

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

ans = 0
for j in range(1,N+1):
    num = int(N/j)
    ans += num*(num+1)/2*j
print(int(ans))

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

for i in range(1,n+1):
    N = math.floor(n / i)
    l = i * N
    s = N / 2 * (i + l)
    ans += s

print(int(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)

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

print(ans)

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

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

print(d_sum_of_divisors())

Solution (Python):



def solve(N):

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

    return ans


def main():

    N = int(input())
    print(solve(N))


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i4,)')(solve)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()

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

yaku = [0]*(N+1)
for i in range(1,N+1):
    yaku[i] = ((N//i)/2) * (2*i + ((N//i)-1)*i)

print(int(sum(yaku)))

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

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







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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  
from functools import reduce
from math import gcd


def lcm(a, b):
    
    g = gcd(a, b)
    return a // g * b




N = a_int()
ans = 0
for j in range(1, N + 1):
    for k in range(j, N + 1, j):
        ans += k
print(ans)

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

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
    num=n//i
    ans+=(((num+1)*num)//2)*i
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):
def g(x,n):
    y = n // x
    s = int(y * (y+1) * x / 2)
    return s

n = int(input())

answer = 0
for i in range(1,n+1):
    answer += int(g(i,n))

print(answer)

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

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def solve(N):

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

    return ans


def main():

    N = in_n()
    print(solve(N))


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i4,)')(solve)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()

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

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

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

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

res = 0
for x in range(1,N+1):
    for y in range(x,N+1,x):
        res += y
print(res)

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def solve(N):

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

    return ans


def main():

    N = in_n()
    print(solve(N))


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i4,)')(solve)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
        from my_module import solve
    main()

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

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

Solution (Python):













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


if __name__ == '__main__':
    N = int(input())
    solve(N)
    
    pass

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):
    k=n//i
    ans+=k*(k+1)//2*i

print(ans)

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

Solution (Python):
N = int(input())
ans = 0
for j in range(1, N + 1):
    m = (N // j)
    ans += m * (1 + m) * j // 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):
N = int(input())
ans = 0
l = [0] * (10 ** 7 + 1)
for i in range(1, N + 1):
    for j in range(i, N + 1, i):
        l[j] += 1

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

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())
ans=0
for i in range(1,N+1):
  ans+=(N//i)*(N//i+1)//2*i
print(ans)

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

divs = [0]*(N+1)

for i in range(1,N+1):
    for j in range(1,N+1):
        if i*j > N:
            break
        divs[i*j] += 1

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

Solution (Python):

N=int(input())
A=[0]*(N+1)
for i in range(1,N+1):
  for j in range(i,N+1,i):
    A[j] += j

print(sum(A))

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


def prime_numbers(n):
    """
    n以下の素数列挙
    O(n)
    """
    eratosthenes = [2] * (n + 1)
    eratosthenes[1] = 1
    num_sum = 1
    for i in range(2, n // 2 + 1):
        k = 2
        while True:
            if i * k < n + 1:
                eratosthenes[i * k] += 1
                k += 1
            else:
                break

    return eratosthenes, num_sum


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

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

    ans = 0

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

    print(ans)

if __name__ == "__main__":
    main()

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

Ans = [2 * i for i in range(N+1)]
Ans[0] = 0
Ans[1] = 1
ans = N * (N + 1) - 1
for i in range(2, N+1):
    if i * 2 > N+1:
        break
    for j in range(2 * i, N+1, i):
        Ans[j] += j
        ans += j

print(ans)

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

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

def main():
    n = int(input())
    ans = 0

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  
from functools import reduce
from math import gcd


def lcm(a, b):
    
    g = gcd(a, b)
    return a // g * b




N = a_int()
ans = 0

'''
以下のような問題を高速化したい
for k in range(1, N + 1):
    for j in range(1, N + 1):
        ans += k * (k % j == 0)  

式の形からk,jはひっくり返せる
jをgivenとしたとき, k * (k%j==0)となる数列の和を高速に列挙する。
→この数列はkがjの倍数のときだけ値をとる→nonzero数列だけに注目すると以下のように言い換えられる
「jの倍数であってN以下であるものの数列」の和を高速に知りたい

1j+2j+3j...yjを求めたいただし,yj<=N (⇔ y<=N//j)
j*((1+y)*y)//2と式変形可能

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

Solution (Python):
production = True

import sys, math, collections

def input(input_format = 0, multi = 0):

    if multi > 0: return [input(input_format) for i in range(multi)]
    else:
        next_line = sys.stdin.readline()[:-1]

        if input_format >= 10:
            use_list = False
            input_format = int(str(input_format)[-1])
        else: use_list = True

        if input_format == 0: formatted_input = [next_line]
        elif input_format == 1: formatted_input = list(map(int, next_line.split()))
        elif input_format == 2: formatted_input = list(map(float, next_line.split()))
        elif input_format == 3: formatted_input = list(next_line)
        elif input_format == 4: formatted_input = (lambda x: [x[0], list(map(int, x[1:]))])(next_line.split())
        elif input_format == 5: formatted_input = (lambda x: [x[0], list(map(float, x[1:]))])(next_line.split())
        elif input_format == 6: formatted_input = next_line.split()
        else: formatted_input = [next_line]

        return formatted_input if use_list else formatted_input[0]


def out(output_line, output_format = 0, newline = True):

    formatted_output = ""

    if output_format == 0: formatted_output = str(output_line)
    elif output_format == 1: formatted_output = " ".join(map(str, output_line))
    elif output_format == 2: formatted_output = "\n".join(map(str, output_line))

    print(formatted_output, end = "\n" if newline else "")


def log(*args):
    if not production:
        print("$$$", end = "")
        print(*args)

enum = enumerate





p = []

def seive(n):
    global p

    p = [0] * (n + 1)

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

def solve():

    n = input(11)

    seive(n)
    t = sum(map(lambda a: a[0] * a[1], enum(p)))

    out(t)
    
    return



solve()

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
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    ans = 0

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

if __name__ == '__main__':
    main()

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache





MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1: arr.append([temp, 1])
  if arr==[]: arr.append([n, 1])
  return arr


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 divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b: a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n-1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n: return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N = I()
sqrtN = math.floor(math.sqrt(N))
ans = 0
for m in range(1,sqrtN+1):
  ans += m*(m+(N//m))*(N//m+1-m)
print(ans-(sqrtN*(sqrtN+1)*(2*sqrtN+1)//6))

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 prime_numbers(n):
    """
    n以下の素数列挙
    O(n)
    """
    eratosthenes = [2] * (n + 1)
    eratosthenes[1] = 1
    num_sum = 1
    for i in range(2, n // 2 + 1):
        k = 2
        while True:
            if i * k < n + 1:
                eratosthenes[i * k] += 1
                k += 1
            else:
                break

    return eratosthenes, num_sum


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

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

furui = [1]*(N+1)
ans = 1
for i in range(2, N+1):
    k = i
    while k <= N:
        furui[k] += 1
        k += i
    ans += furui[i]*i

print(ans)

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

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


if __name__ == '__main__':
    main()

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

Solution (Python):
import math

n = int(input())
result = 0

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


print(int(result))

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

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())
print(sum([i * (n // i) * (n // i + 1) // 2 for i in range(1,n+1)]))

Solution (Python):
def main():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        
        ans += sum(range(i,n+1,i))

    print(ans)
main()

Solution (Python):
n=int(input())
dp=[1]*(n+1) 
ans=1
for i in range(2,n+1):
    for j in range(i, n+1, i):
        dp[j]+=1
    ans+=dp[i]*i
print(ans)

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

def gen():
  for j in range(1,N+1):
    yield j * (N//j)*(N//j+1)/2

ans = int(sum(gen()))

print(ans)

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

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

memo = [1]*(N+1)
for x in range(2,N+1):
    for y in range(x,N+1,x):
        memo[y] += 1
print(sum(c*m for c,m in enumerate(memo)))

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
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


@njit('(i4,i4[:])', cache=True)
def solve(N, yaku):

    for i in range(1, N + 1):
        for j in range(i, N + 1, i):
            yaku[j] += 1

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

    return ans


def main():

    N = in_n()
    yaku = np.zeros(N + 1, np.int32)
    print(solve(N, yaku))


if __name__ == '__main__':
    main()

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

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


print(ans)

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

ans = int(sum([j * (N//j)*(N//j+1)/2 for j in range(1,N+1)]))

print(ans)

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

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

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

print(ans)

Solution (Python):

n = int(input())

ans = 0

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

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

print(ans)

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

Solution (Python):


N = int(input())

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

half = int(N/2)+1

each_result = [n*sum_inc(int(N/n)) for n in range(1,half)]

print(sum(each_result)+sum_inc(N) - sum_inc(half-1))

Solution (Python):
N = int(input())
dp = [1]*(N+1)
ans = 1
for i in range(2, N+1):
    j = i
    while j < N+1:
        dp[j] += 1
        j += i
    ans += i*dp[i]
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    ans = 0
    for j in range(1, N+1):
        a = int(N/j)
        ans += a*(a+1)*j / 2
    print(int(ans))
    
main()

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

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

print(ans)

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

print(ans)

Solution (Python):
import sys
import itertools

import time
import math
import heapq
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines




N = int(input())

ans = 1
for i in range(2, N + 1):
    x = N // i
    ans += i * ((x + 1) * x // 2 + 1)
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)

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):


def main():
    n = int(input())
    ret = 0
    for i in range(1, n+1):
        x = n // i
        ret += i * x * (x+1) // 2

    print(ret)

if __name__ == '__main__':
    main()

Solution (Python):


def main():
    n = int(input())
    ret = 0
    for i in range(1, n+1):
        x = n // i
        ret += i * x * (x+1) // 2

    print(ret)

if __name__ == '__main__':
    main()

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

Solution (Python):


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

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


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
ans = 0
l = [0] * (10 ** 7 + 1)
for i in range(1, N + 1):
    for j in range(i, N + 1, i):
        l[j] += 1

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

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

Solution (Python):
n = int(input())
tau = [0 for i in range(n+1)]
for d in range(1,n+1):
	for k in range(d,n+1,d):
		tau[k] += 1
print(sum([k*tau[k] for k in range(1,n+1)]))

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

ans = 1
div = [2 for i in range(N + 1)]

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

print(ans)

Solution (Python):
N = int(input())
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())
cnt = [1] * (n + 1)
tot = 1
for i in xrange(2, n + 1):
    for j in xrange(i, n + 1, i):
        cnt[j] += 1
    tot += i * cnt[i]
print tot

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

def sieve(n):
    n += 10
    res = list(range(n))
    res[0] = -1
    res[1] = -1
    i = 2
    while i*i<n:
        if res[i]<i:
            i += 1
            continue
        j = i*i
        while j<n:
            if res[j]==j:
                res[j] = i
            j += i
        i += 1
    return res

l = sieve(n)
res = 0
for k in range(1,n+1):
    m = k
    r = 1
    while m!=1:
        p = l[m]
        c = 0
        while l[m]==p:
            m //= l[m]
            c += 1
        r *= c+1
    res += k*r
print(res)

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

Solution (Python):

N = int(input())

sieve = [0] * (N + 1)
sieve[0] = -1
sieve[1] = -1
for i in range(2, N + 1):
    if sieve[i] != 0:
        continue
    sieve[i] = i
    for j in range(i * i, N + 1, i):
        if sieve[j] == 0:
            sieve[j] = i


def f(X):
    t = []
    a = X
    while a != 1:
        if len(t) != 0 and t[-1][0] == sieve[a]:
            t[-1][1] += 1
        else:
            t.append([sieve[a], 1])
        a //= sieve[a]
    result = 1
    for _, n in t:
        result *= (n + 1)
    return result


result = 0
for K in range(1, N + 1):
    result += K * f(K)
print(result)

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

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

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Solution (Python):
import numpy as np
n=int(input())
num=np.array(list(range(1,n+1)))

x=n//num
ans=num*(x+1)*x/2
print(int(np.sum(ans)))

Solution (Python):
import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


def main():
    n = I()
    ans = 0
    

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


main()

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

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

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

print(int(res))

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

Solution (Python):
n=int(input())
ans = 0
for j in range(1,n+1):
  ans += (n//j)*(n//j+1)*j//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(int(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())
ans = 0
for j in range(1, n + 1):
    y = n // j
    ans += y * (y + 1) * j // 2
print(ans)

Solution (Python):


import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ret = 0
    for i in range(1, N + 1):
        c = N // i
        cc = (1 + c) * c // 2
        ret += i * cc
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

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

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

answer=0
for i in range(1,N+1):
  term=N//i
  answer+=i*sum_n(term)
  
print(answer)

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

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

Solution (Python):
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()

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

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

print(int(count))

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

ans = 0

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

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

Solution (Python):
def main():
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        ans += sum(j for j in range(i, N+1, i))
    print(ans)
main()

Solution (Python):


n = int(input())

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



    _tmp = n//j
    ans += j * _tmp * (_tmp+1) // 2
    
print(ans)

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