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, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

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


def main():
    N = INT()
    print(sum([N//(i+1)*(N//(i+1) + 1)*(i+1)//2 for i in range(N)]))
    

if __name__ == '__main__':
    main()

Solution (Python):
def readinput():
    n=int(input())
    return n

def main(n):
    fk=[1]*(n+1)
    for i in range(2,n+1):
        j=i
        while(j<=n):
            fk[j]+=1
            j+=i
    sum=0
    for i in range(1,n+1):
        sum+=i*fk[i]
    return sum

def main2(n):
    fk=[]
    for i in range(n+1):
        fk.append(i)
    for i in range(2,n+1):
        j=i
        while(j<=n):
            fk[j]+=j
            j+=i
    sum=0
    for i in range(1,n+1):
        sum+=fk[i]
    return sum

if __name__=='__main__':
    n=readinput()
    ans=main2(n)
    print(ans)

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

Solution (Python):

N = int(input())
print(sum((N//x)*(N//x+1)*x//2 for x in range(1,N+1)))

Solution (Python):
from math import floor
N = int(input())


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


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

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

Solution (Python):

import math
from numba import jit, njit




n = int(input())







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


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

print(ans)

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

P = [1 for i in range(N + 1)]

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

for i in range(N + 1):
    res += i * P[i]

print(res)

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

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):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

Solution (Python):
n = int(input())
table=[1 for _ in range(n+1)]
ans=0
for x in range(1,n+1):
    y=n//x
    ans+=y*(y+1)*x//2
print(ans)

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

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

print(ans)

Solution (Python):


import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
ans = n * (n + 1) - 1  

i = 2
while i * i <= n:
    num = n // i
    min_i = i * i
    max_i = i * num
    ans += (num - i + 1) * (min_i + max_i)  
    ans -= min_i
    i += 1
print(ans)

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

print(int(out))

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

Solution (Python):
ans = 0
n = int(input())
s = [0] + [1]*n
for i in range(2, n+1):
    for j in range(i, n+1, i):
        s[j] += 1
for _ in range(n+1):
    ans += _*s[_]
print(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())
f=[1]*(10**7+1)
f[0]=0
for i in range(2,n+1):
  tem = i
  while tem <= n:
      f[tem] += 1
      tem += i
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):
    num = N//i
    a1 = i
    an = a1 + (num-1)*i
    ans += (num*(a1+an))//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):
if __name__ == "__main__":
    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())

def num_divisors_table(n):
  table = [0] * (n + 1)
  for i in range(1, n + 1):
    for j in range(i, n + 1, i):
      table[j] += j
  return sum(table)

print(num_divisors_table(N))

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

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

print(ans)

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

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

Solution (Python):


import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

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

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

if __name__ == "__main__":
    resolve()

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    temp = N // i
    ans += i * temp * (temp + 1) // 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):
from functools import reduce

n = int(input())
def f(x, y):
    k = n // y
    return x + k * (y + y * k) // 2

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

Solution (Python):
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue


Mod = 1000000007
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1] 
for i in range(2, 10**5 + 1):
    fact.append((fact[-1] * i) % Mod)
    inv.append((-inv[Mod % i] * (Mod // i)) % Mod)
    factinv.append((factinv[-1] * inv[-1]) % Mod)
    
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p
    
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)
import string
def main():  
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        x = n // i
        ans += x * (i + i * x) // 2
    print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

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

Solution (Python):
def main():
    N = int(input())
    
    ans = 0
    for X in range(1,N+1):
        Y = int(N/X)
        ans += (Y*(Y+1)*X)//2
                
    print(ans)
    
if __name__ == '__main__':
    main()

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


def divisor(N):
    div = [0] * (N + 1)
    for n in range(1, N + 1):
      for m in range(n, N + 1, n):
        div[m] += m
    return sum(div)

print(divisor(n))

Solution (Python):
import sys
import os
import itertools
import numpy as np
from collections import deque

def main():
    if os.getenv("ENV")=='LOCAL':
        sys.stdin = open(os.path.dirname(__file__)+'/input.txt', 'r')

    N=int(input())

    
    
    
    
    
    

    
    print(sieve(N))

def sieve(n):
    
    sum=n*(2+n-1)//2
    

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

    return sum


if __name__ == '__main__':
    main()

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):
import math
import collections
def main():

    N = int(input())
    d = dict()
    for i in range(1, N+1):
        d[i] = 0

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

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

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

Solution (Python):


import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

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

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

if __name__ == "__main__":
    resolve()

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

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


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

print(ans)

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

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

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

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

ans = 0

for i in range(1, n+1):
    ans += i*dp[i]

print(ans)

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

    ans = 0

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

    print(ans)

if __name__ == "__main__":
    main()

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

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

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


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


if __name__ == '__main__':
    solve()

Solution (Python):
def readinput():
    n=int(input())
    return n

def main(n):
    fk=[1]*(n+1)
    for i in range(2,n+1):
        j=i
        while(j<=n):
            fk[j]+=1
            j+=i
    sum=0
    for i in range(1,n+1):
        sum+=i*fk[i]
    return sum

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)

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

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

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

Solution (Python):
import math

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]



if __name__ == "__main__":
    N = int(input())
    total = 0
    for i in range(1,N+1):
        Y = math.floor(N/i)
        total += int(Y*(Y+1)*i/2)
    print(total)

Solution (Python):
if __name__ == '__main__':
    n = int(input().strip())
    ans = 0

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

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

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy


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)
    divisors.sort()
    return divisors

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

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

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

Solution (Python):

















import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

    ans=0
    for k,v in enumerate(ll):
        if k==0: continue
        ans+=k*v

    print(ans)
        

    
resolve()

Solution (Python):
from numba import jit
@jit(cache = True)
def main():
    n=int(input())
    ans=0
    for i in range(1,n+1):
        x=n//i
        ans+=i*(x+1)*x//2
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):

N = int(input())

lis = [0] * (N+1)

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

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

    ans += i * lis[i]

print (ans)

Solution (Python):

N = int(input())

f = [2] * (N+1)
f[0] = 0
f[1] = 1
for k in range(2, int(N**0.5)+1):
  if f[k] > 2:
    continue
  m = 1
  while k ** m <= N:
    for j in range(1, N//k**m + 1):
      f[j * k**m] = f[j] * (m+1)
    m += 1
  

ans = 0
for i, ff in enumerate(f):
  ans+=i*ff
print(ans)

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

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

ans = 0

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

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 = 0

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

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

Solution (Python):
n=int(input())
DP=[0 for _ in range(n+1)]

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

N = int(input())

ans = 0

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

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

print(sm)

Solution (Python):

















import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

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

    print(ans)
        

    
resolve()

Solution (Python):
import sys

def I(): return int(sys.stdin.readline().rstrip())

N = I()

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

print(ans)

Solution (Python):

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left 
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N = int(input())

vals = [1]*(N)
for num in range(1, N//2+1):
    mlt = 2
    
    while num*(mlt) <= N:
        v = num*mlt
        
        vals[v-1] += 1
        mlt += 1



cnt = 0
for ind, val in enu(vals):
    cnt += (ind+1)*val
print(cnt)

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

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
    x=n//i
    ans+=i*(x+1)*x//2
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):
def main():
    import sys
    input=sys.stdin.readline
    n=int(input())
    ans=0
    for i in range(1,n+1):
        c=n//i
        ans+=((c+1)*c*i)//2
    print(ans)       
if __name__ == '__main__':
    main()

Solution (Python):

MOD = 10 ** 9 + 7
INFI = 10**10

import math
from collections import deque
import itertools
import heapq

from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint




def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default




def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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


if __name__ == "__main__":

    main()

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

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

def ii(): return int(input())
def fi(): return float(input())
def si(): return input()
def lii(): return list(map(int, input().split()))
def lfi(): return list(map(float, input().split()))
def vvi(a,b,d): return [[d] * a for i in range(b)]

inf = 10**18
mod = 10**9+7

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

print(ans)

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

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

Solution (Python):

def main():
    n = int(input())
    nums = list(range(1,n+1))
    ans = 0
    for num in nums:
        cnt = n//num
        curr_sum = cnt*(2*num+(cnt-1)*num)//2
        ans += curr_sum
    print(ans)


if __name__ == "__main__":
    main()

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

a = 0
def g(x):
    y = N//x
    return y * (y+1)*x//2

print(sum(g(x) for x in range(1,N+1)))

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

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

ans = 0

if N == 1:
    print(1)
    exit()
if N == 2:
    print(5)
    exit()
if N == 3:
    print(11)
    exit()

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

ans += (N//2+2 + N) * (N - N//2 - 1) // 2

print(ans)

Solution (Python):



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

if __name__ == '__main__':
    main()

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):
    X=N//i
    ans+=i*(X+1)*X//2
print(ans)

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

cnt = [i for i in range(n + 1)]
for i in range(2, n + 1):
    for j in range(i, n + 1, i):
        cnt[j] += j
print(sum(cnt))

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

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

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

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

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

Solution (Python):
import sys

def I(): return int(sys.stdin.readline().rstrip())

N = I()

import math

def sieve_of_eratosthenes(n):
    prime_list = []  
    A = [1]*(n+1)    
    A[0] = A[1] = 0
    for i in range(2,math.floor(math.sqrt(n))+1):
        if A[i]:
            prime_list.append(i)
            for j in range(i**2,n+1,i):
                A[j] = 0
    for i in range(math.floor(math.sqrt(n))+1,n+1):
        if A[i] == 1:
            prime_list.append(i)
    return prime_list

primelist = sieve_of_eratosthenes(N)

list = [i for i in range(N+1)]

for p in primelist:
    a = p
    r = 2
    while a <= N:
        for i in range(1,N//a+1):
            if i % p == 0:
                continue
            else:
                list[a*i] *= r
        a *= p
        r += 1

print(sum(list))

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


print(ans)

Solution (Python):
def resolve():
    import math
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        count = math.floor(n/i)
        last = int(math.floor(n/i) * i)
        ans += (i+last)*count//2
    print(ans)

resolve()

Solution (Python):
from sys import stdin
from sys import setrecursionlimit

n = int(input())
ans = 0

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

print(ans)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from math import floor

    n = int(readline())
    ans = 0
    for i in range(1, n + 1):
        first = i
        cnt = floor(n / i)
        last = cnt * i
        ans += cnt * (first + last) // 2
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np
n=int(input())
num=list(range(1,n+1))
num=np.array(num)
x=n//num
ans=num*(x+1)*x/2
print(int(np.sum(ans)))

Solution (Python):



from math import *
from copy import *					
from heapq import *					
from string import *				
from random import *				
from bisect import *				
from sys import stdin				
from sys import maxsize				
from operator import *				
from itertools import *				
from decimal import Decimal 		
from collections import Counter		
from collections import defaultdict 

'''

'''

def primeFactorization(x):
	d = defaultdict(int)
	d[1] = 0
	while(x%2 == 0):
		x //= 2
		d[2] += 1
	for i in range(3,int(sqrt(x))+1,2):
		while(x%i == 0):
			d[i] += 1
			x //= i
	if(x > 2):
		d[x] += 1
	return d

def Sieve(x):
	checkPrime = [1 for i in range(x+1)]
	zz = 2
	L = []
	while(zz**2 <= x):
		if(checkPrime[zz] == 1):
			for i in range(zz*2,x+1,zz):
				checkPrime[i] = 0
		zz += 1
	for i in range(2,x):
		if(checkPrime[i] == 1):
			L.append(i)
	return L
	




def solve(x):
	check = [0]*(x+1)
	for i in range(1,x+1):
		j = 1
		while(i*j < x+1):
			check[i*j] += 1
			j += 1
	ans = 0
	
	for i in range(1,x+1):
		ans += i * check[i]
	return ans

N = int(stdin.readline())
ans = solve(N)
print(ans)

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

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

yakusu=[0]*(n+1)

for i in range(1,n+1):
    for j in range(1,n+1):
        if i*j<=n:
            yakusu[i*j]+=1
        else:
            break

ans=0
for i,v in enumerate(yakusu):
    ans+=i*v

print(ans)

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

Solution (Python):

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

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

  print(ans)


main()

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

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

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


if __name__ == '__main__':
    main()

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

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

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

def main():
    N = int(readline())
    res = 0
    for x in range(1, N+1):
        y = N // x
        res += y * (y + 1) * x // 2
    
    print(res)

if __name__ == '__main__':
    main()

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

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

print(ans)

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

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())

def eratosthenes(lim):
  is_p=[2]*lim

  is_p[0]=0
  is_p[1]=1

  for i in range(2,lim):
    for j in range(i*2,lim,i):
      is_p[j] += 1

  return is_p

lim=n+1
is_p=eratosthenes(lim)

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

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

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

Solution (Python):
def sieve(n):
    count = [2] * (n+1)
    count[1] = 1

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

def solve():
    N = int(input())
    sieve_res = sieve(N)
    ans = 0
    for i in range(1,N+1):
        ans += i * sieve_res[i]
    print(ans)

if __name__ == '__main__':
    solve()