Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]
m = M-1

def DFS(s):
    if len(s) == N:
        return [s]
    ans = []
    if s == '':
        r = 0
    else:
        r = int(s[-1])
    for i in range(r, M):
        ans.extend(DFS(s+str(i)))
    return ans


V = DFS('')
final_ans = []
for v in V:
    answer = 0
    for q in abcd:
        if int(v[q[1]-1]) - int(v[q[0]-1]) == q[2]:
            answer += q[3]
    final_ans.append(answer)
print(max(final_ans))

### FIXED CODE ###

N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]
m = M-1

def DFS(s):
    if len(s) == N:
        return [s]
    ans = []
    if s == '':
        r = 0
    else:
        r = int(s[-1])
    for i in range(r, M):
        ans.extend(DFS(s+str(i)))
    return ans


V = DFS('')
final_ans = 0
for v in V:
    answer = 0
    A = [int(c)+1 for c in v]
    for a, b, c, d in abcd:
        if int(v[b-1]) - int(v[a-1]) == c:
            answer += d
    final_ans = max(final_ans , answer)
print(final_ans)
### BUGGY CODE ###

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

    for div in range(1, num + 1):
        for i in range(1, num + 1):
            if i % div == 0:
                ans += i

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

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

    for divisor in range(1, num + 1):
        quotient = num // divisor
        ans += (quotient + 1) * quotient * divisor // 2

    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())
strX = input()

#10進数に変換
decX = int(strX,2)

#1の数をカウント
pop_c = strX.count('1')

# X % popcount+1
f_p = decX % (pop_c + 1)

# X % popcount-1(0になる時は0)
if pop_c == 1:
  f_m = 0
else:
  f_m = decX % (pop_c - 1)

for i in range(0,N):
  if strX[i] == '0':
    pop_a = (f_p + (2**(N-1-i)) % (pop_c + 1)) % (pop_c + 1) 
    Ans = 1
    
  elif pop_c == 1:
    pop_a = 0
    Ans = 0
    
  else:
    pop_a = f_m - (2**(N-1-i)) % (pop_c - 1)
    if pop_a < 0:
      pop_a = pop_a + pop_c - 1
    Ans = 1
  
  while pop_a > 0:
    wkpop = bin(pop_a).count('1')
    pop_a = pop_a % wkpop
    Ans += 1
  
  print(Ans)

### FIXED CODE ###

N = int(input())
strX = input()

#10進数に変換
decX = int(strX,2)

#1の数をカウント
pop_c = strX.count('1')

# X % popcount+1
f_p = decX % (pop_c + 1)

# X % popcount-1(0になる時は0)
if pop_c == 1:
  f_m = 0
else:
  f_m = decX % (pop_c - 1)

for i in range(0,N):
  if strX[i] == '0':
    pop_a = (f_p + pow(2,(N-1-i),(pop_c + 1))) % (pop_c + 1) 
    Ans = 1
    
  elif pop_c == 1:
    pop_a = 0
    Ans = 0
    
  else:
    pop_a = f_m - (pow(2,(N-1-i),(pop_c - 1)))
    if pop_a < 0:
      pop_a = pop_a + pop_c - 1
    Ans = 1
  
  while pop_a > 0:
    wkpop = bin(pop_a).count('1')
    pop_a = pop_a % wkpop
    Ans += 1
  
  print(Ans)
### BUGGY CODE ###

import collections
import math
n = int(input())
a = [0]*n
b = 0
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for j in range(n):
    t = list(input())
    t.sort()
    m = " ".join(t)
    a[j] = m
c = collections.Counter(a)
for k in range(len(c)):
    if c.most_common()[k][1] > 1:
        b += combinations_count(c.most_common()[k][1], 2)
    else:
        continue
print(b)

### FIXED CODE ###

import collections
import math
n = int(input())
a = [0]*n
b = 0
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for j in range(n):
    t = list(input())
    t.sort()
    m = " ".join(t)
    a[j] = m
c = collections.Counter(a)
d = list(c)
for k in range(len(d)):
    if c[d[k]] > 1:
        b += combinations_count(c[d[k]], 2)
    else:
        continue
print(b)
### BUGGY CODE ###

import sys
from collections import defaultdict

n = int(input())
aaa = list(map(int, sys.stdin))
MOD = 998244353

d2 = [1]
tmp = 1
for i in range(n):
    tmp = tmp * 2 % MOD
    d2.append(tmp)

s = sum(aaa)
dp = [defaultdict(lambda: 0) for _ in [0] * (s + 1)]
dp[0][0] = 1
tmp_sum = 0
for a in aaa:
    for i in range(tmp_sum, -1, -1):
        for k, p in dp[i].items():
            dp[i + a][k + 1] += p
            dp[i + a][k + 1] %= MOD
    tmp_sum += a

sub = 0
h = (s + 1) // 2
for dd in dp[h:]:
    for k, p in dd.items():
        sub = (sub + d2[n - k] * p * 3) % MOD
if s % 2 == 0:
    dd = dp[h]
    for k, p in dd.items():
        sub = (sub - p * 3) % MOD

ans = (pow(3, n, MOD) - sub) % MOD
print(ans)


### FIXED CODE ###

import sys

n = int(input())
aaa = list(map(int, sys.stdin))
MOD = 998244353

s = sum(aaa)
dp1 = [0] * (s + 1)
dp2 = [0] * (s + 1)
dp1[0] = 1
dp2[0] = 1
tmp_sum = 0
for a in aaa:
    for i in range(tmp_sum, -1, -1):
        dp1[i + a] += dp1[i]
        dp1[i] *= 2
        dp2[i + a] += dp2[i]
    for i in range(tmp_sum, -1, -1):
        dp1[i] %= MOD
        dp2[i] %= MOD
    tmp_sum += a

h = (s + 1) // 2
ans = (pow(3, n, MOD) - sum(dp1[h:]) * 3) % MOD
if s % 2 == 0:
    ans = (ans + dp2[h] * 3) % MOD
print(ans)
### BUGGY CODE ###

import bisect


def resolve():
    x, y, a, b, c = map(int, input().split())
    p = sorted(list(map(int, input().split())))[-x:]
    q = sorted(list(map(int, input().split())))[-y:]
    r = sorted(list(map(int, input().split())), reverse=True)
    for i in q:
        bisect.insort_right(p, i)
    for i in range(min(a + b, c)):
        if p[i] < r[i]:
            p[i] = r[i]
        else:
            break
    print(sum(p))


if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import heapq


def resolve():
    x, y, a, b, c = map(int, input().split())
    p = sorted(list(map(int, input().split())))[-x:]
    q = sorted(list(map(int, input().split())))[-y:]
    r = [-int(x) for x in input().split()]
    heapq.heapify(p)
    heapq.heapify(r)
    for i in q:
        heapq.heappush(p, i)
    ans = 0
    while p and r:
        ans += max(heapq.heappop(p), -heapq.heappop(r))
    ans += sum(p)
    print(ans)


if __name__ == '__main__':
    resolve()
### BUGGY CODE ###

N,M=map(int,input().split())
H=[int(h) for h in input().split()]
AB=[]
cnt=0
for i in range(M):
    A,B=map(int,input().split())
    AB.append([A,B])
NUMBERS=[int(x) for x in range(1,N+1)]

for i in range(M):
    if H[AB[i][0]-1]>H[AB[i][1]-1]:
        if AB[i][1] in NUMBERS:
            NUMBERS.remove(AB[i][1])
    elif H[AB[i][0]-1]==H[AB[i][1]-1]:
        if AB[i][0] in NUMBERS:
            NUMBERS.remove(AB[i][0])
        if AB[i][1] in NUMBERS:
            NUMBERS.remove(AB[i][1])
    else:
        if AB[i][0] in NUMBERS:
            NUMBERS.remove(AB[i][0])
print(len(NUMBERS))


### FIXED CODE ###

N,M=map(int,input().split())
H=[int(h) for h in input().split()]
cnt=[0]*N
for i in range(M):
    a,b=map(int,input().split())
    if H[a-1]>H[b-1]:
        cnt[b-1]+=1
    elif H[a-1]==H[b-1]:
        cnt[a-1]+=1
        cnt[b-1]+=1
    else:
        cnt[a-1]+=1
print(cnt.count(0))
### BUGGY CODE ###

from math import sqrt
N=int(input())
A=list(map(int,input().split()))
A.sort()
def main():
    a=0
    s=set()
    t=0
    if A[0]!=1:
        for i in A:
            if i in s:
                if t==i:
                    a-=1
                    t=0
                continue
            for j in range(2,int(sqrt(i)+1.5)):
                if i%j:
                    continue
                if j in s:
                    break
                if i//j in s:
                    break
            else:
                t=i
                a+=1
            s.add(i)
    else:
        if N>1 and A[1]==1:
            a=0
        else:
            a=1
    print(a)
main()

### FIXED CODE ###

from math import sqrt
from time import perf_counter
t0=perf_counter()
N=int(input())
A=list(map(int,input().split()))
A.sort()
def main():
    a=0
    s=set()
    t=0
    if A[0]!=1:
        for i in A:
            if i in s:
                if t==i:
                    a-=1
                    t=0
                continue
            for j in range(2,int(sqrt(i)+1.1)):
                if i%j:
                    continue
                if j in s:
                    break
                if i//j in s:
                    break
            else:
                t=i
                a+=1
            s.add(i)
            if perf_counter()-t0>1.9:
                a=N
                break                
    else:
        if N>1 and A[1]==1:
            a=0
        else:
            a=1
    print(a)
main()
### BUGGY CODE ###

N = int(input())
a = [int(input()) for i in range(N)]
count = 0
i = 0
while True:
    i = a[i]-1
    count+=1
    if i==1:
        break
    elif i==0:
        count=-1
        break
print(count)

### FIXED CODE ###

N = int(input())
a = [int(input())-1 for i in range(N)]
cnt = 0
index = 0
while True:
    if index == 1:
        print(cnt)
        break
    elif cnt>N:
        print(-1)
        break
    index = a[index]
    cnt += 1
### BUGGY CODE ###

n = int(input())
ms = list(map(int, input().split()))
for i in range(1, n+1):
    print(ms.count(i))


### FIXED CODE ###

import math
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

n = int(input())
b = {}
vals = list(map(int, input().split()))
for i in range(n-1):
    if(vals[i] in b):
        b[vals[i]]+=1
    else:
        b[vals[i]] = 1
for i in range(1, n+1):
    if(i in b):
        print(b[i])
    else:
        print(0)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

R, C, K = map(int, input().split())
INF = 10**18
dp = [[[-INF] * 4 for _ in range(C+1)] for _ in range(R+1)]
items = [[0] * (C+1) for _ in range(R+1)]
dp[1][0][0] = dp[0][1][0] = 0
for _ in range(K):
    r, c, v = map(int, input().split())
    items[r][c] = v
for i in range(1, R+1):
    for j in range(1, C+1):
        for k in range(4):
            dp[i][j][0] = max(dp[i][j][0], dp[i-1][j][k])
            if items[i][j]:
                dp[i][j][1] = max(dp[i][j][1], dp[i-1][j][k] + items[i][j])
            dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][k])
            if items[i][j] and k:
                dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][k-1] + items[i][j])
ans = max(dp[R][C])
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

R, C, K = map(int, input().split())
items = [[0] * (C+1) for _ in range(R+1)]
for _ in range(K):
    r, c, v = map(int, input().split())
    items[r][c] = v
dp = [[0] * 4 for _ in range(C+1)]
for i in range(1, R+1):
    ndp = [[0] * 4 for _ in range(C+1)]
    for j in range(1, C+1):
        for k in range(4):
            ndp[j][0] = max(ndp[j][0], dp[j][k])
            ndp[j][k] = max(ndp[j][k], ndp[j-1][k])
        if items[i][j]:
            for k in range(3, 0, -1):
                ndp[j][k] = max(ndp[j][k], ndp[j][k-1] + items[i][j])
    dp = ndp
print(max(dp[C]))
### BUGGY CODE ###

def bit_add(bit, i, x):
    i += 1
    n = len(bit)
    while i <= n:
        bit[i - 1] += x
        i += i & -i


def bit_sum(bit, i):
    result = 0
    i += 1
    while i > 0:
        result += bit[i - 1]
        i -= i & -i
    return result


def main():
    from sys import stdin
    from builtins import int, list, map, range
    readline = stdin.readline
    N, D, A = map(int, readline().split())
    XH = []
    for _ in range(N):
        X, H = map(int, readline().split())
        H = (H + A - 1) // A
        XH.append((X, H))

    XH.sort()
    X = [x for x, h in XH]
    result = 0
    bit = [0] * (N + 1)
    for i in range(N):
        x, h = XH[i]
        h -= bit_sum(bit, i)
        if h <= 0:
            continue
        result += h
        bit_add(bit, i, h)

        t = x + 2 * D
        ok = i
        ng = N
        while ng - ok != 1:
            m = ok + (ng - ok) // 2
            if X[m] <= t:
                ok = m
            else:
                ng = m
        bit_add(bit, ng, -h)
    print(result)


main()


### FIXED CODE ###

N, D, A = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]

XH.sort()
q = []
t = 0
result = 0
for x, h in XH:
    while True:
        if len(q) == 0:
            break
        if x <= q[0][0]:
            break
        t -= q[0][1]
        q.pop(0)
    h -= t
    if h < 0:
        continue
    c = (h + A - 1) // A
    result += c
    t += c * A
    q.append((x + 2 * D, c * A))
print(result)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))

for i in range(N):
    a=A.index(i+1)+1
    print(a,end=' ')


### FIXED CODE ###

N=int(input())
keys=list(map(int,input().split()))
A={ value:index  for index,value in enumerate(keys,1) }

for i in range(1,N+1):
    print(A[i],end=' ')
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7) #再帰関数の呼び出し制限

def dfs(v,p): #点vについての処理。p：vの親
    if (p != -1): res[v] += res[p]
    
    for e in edges[v]:
        if (e == p): continue
        dfs(e,v)
#--------------------------------
N, Q = map(int, input().split())
edges = [[] for _ in range(N+1)]
for i in range(N-1):
    a,b = map(int, input().split())
    edges[a].append(b)
    edges[b].append(a)
#print(edges)
px = [list(map(int, input().split())) for _ in range(Q)]

res = [0]*(N+1) #点数リスト
for i in range(Q): #点数リストに初期値を格納
    p,x = px[i]
    res[p] += x

dfs(1,-1)
print(*res[1:])


### FIXED CODE ###

import collections,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,Q = LI()
ab = [LI() for _ in [None]*(N-1)]
px = [LI() for _ in [None]*(Q)]
ans = [0]*(N+1) #1_index
graph = [collections.deque() for _ in [None]*(N+1)] #1_index
for a,b in ab:
        graph[a].append(b)
        graph[b].append(a)
for p,x in px:
    ans[p] += x
seen = [0]*(N+1) #1_index
stack = []
def dfs():
    seen[1] = 1
    stack.append(1)
    while stack:
        s = stack.pop()
        if not graph[s]:
            continue
        for j in range(len(graph[s])):
            g_NO = graph[s].popleft()
            if seen[g_NO]:
                continue
            seen[g_NO] = 1
            stack.append(g_NO)
            ans[g_NO] += ans[s]
dfs()
print(*ans[1:])
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
P = 10**9+7
ans = 0

for i in range(N):
    for j in range(i+1,N):
        ans += A[i]*A[j]
        if ans >= P:
            ans = ans%P
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
P = 10**9+7
ans = 0
S = sum(A)

for i in range(N):
    S -= A[i]
    ans += A[i]*S%P
print(ans%P)
### BUGGY CODE ###

N, C = map(int, input().split(' '))

ss = [0] * N
tt = [0] * N
cc = [0] * N

for n in range(N):
    ss[n], tt[n], cc[n] = map(int, input().split(' '))

L = 10 ** 5 * 2 + 2
timeline = [[0] * L for c in range(C)]

# print(len(timeline), len(timeline[0]))

# 同じチャンネルでマージ
for n in range(N):
    timeline[cc[n] - 1][ss[n] * 2] += 1
    timeline[cc[n] - 1][tt[n] * 2] -= 1

# チャンネルのスタート時間0.5ずらして一個前のところに
for c in range(C):
    for t in range(L):
        if timeline[c][t] > 0:
            timeline[c][t - 1] = timeline[c][t]
            timeline[c][t] = 0

max_ = 0
stack = 0
for t in range(L):
    for c in range(C):
        stack += timeline[c][t]
    if stack > max_:
        max_ = stack

print(max_)

# 3 2
# 1 3 1
# 3 4 1
# 4 5 2

### FIXED CODE ###

N, C = map(int, input().split(' '))

ss = [0] * N
tt = [0] * N
cc = [0] * N

for n in range(N):
    ss[n], tt[n], cc[n] = map(int, input().split(' '))

L = 10 ** 5 * 2 + 2
timeline = [[0] * L for c in range(C)]

# print(len(timeline), len(timeline[0]))

# 同じチャンネルでマージ
for n in range(N):
    timeline[cc[n] - 1][ss[n] * 2] += 1
    timeline[cc[n] - 1][tt[n] * 2] -= 1

# チャンネルのスタート時間0.5ずらして一個前のところに
num = [0] * L
for c in range(C):
    for t in range(L):
        if timeline[c][t] > 0:
            num[t - 1] += timeline[c][t]
        if timeline[c][t] < 0:
            num[t] += timeline[c][t]

stack = 0
max_ = 0
for i in range(L):
    stack += num[i]
    if stack > max_:
        max_ = stack

print(max_)
# 3 2
# 1 3 1
# 3 4 1
# 4 5 2
### BUGGY CODE ###

n = int(input())
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

fact = factorize(n)
dif = []
from itertools import combinations as com
for i in range(len(fact) + 1):
  for cands in com(fact, i):
    ans = 1
    for cand in cands:
      ans *= cand
    dif.append(n//ans + ans - 2)
print(min(dif))



### FIXED CODE ###

n = int(input())

end = int(n**0.5) + 2
dif = []
for i in range(1, end):
  if n % i == 0:
    dif.append(abs(n//i + i) - 2)
print(min(dif))
### BUGGY CODE ###

l,r = map(int, input().split())
 
mod = 2019
for j in range(r,l,-1):
    for i in range(j-1,l-1,-1):
        mod_new = (i*j)%2019
        mod = min(mod,mod_new)

print(mod)

### FIXED CODE ###

l,r = map(int, input().split())
n = r - l + 1
if 2019<=n:
    print(0)
elif 3<=n and n<2019:
    for k in range(l,r+1):
        if k%673==0:
            print(0)
            exit()

    mod = 2019
    for i in range(l,r):
        for j in range(l+1,r+1):
            mod_new = (i*j)%2019
            if mod_new == 1:
                print(1)
                exit()
            else:
                mod = min(mod,mod_new)
    print(mod)                             
else:
    print((l*r)%2019)
### BUGGY CODE ###

n, k = map(int,input().split())

pedras = list(map(int,input().split()))

INF = 1e12

dp = [INF] * n

dp[0] = 0
dp[1] = abs(pedras[1] - pedras[0])

for i in range(2,n):
    pulo = 0
    for j in range(i-1,-1,-1):
        pulo += 1
        if pulo > k:
            break
        else:
            dp[i] = min(dp[i], dp[j] + abs(pedras[i] - pedras[j]))


print(dp[n-1])


### FIXED CODE ###

def main():
    infinity = 1e10

    n, k, height = getInputs()

    cost = [infinity] * n
    cost[0] = 0
    cost[1] = abs(height[0] - height[1])

    for i in range(2, n):
        for j in range(i - 1, i - k - 1, -1):
            if j >= 0:
                cost[i] = min(cost[i], cost[j] + abs(height[i] - height[j]))

    print(cost[-1])

def getInputs():
    n, k = map(lambda x: int(x), input().split())
    height = tuple(map(lambda x: int(x), input().split()))

    return n, k, height

main()
### BUGGY CODE ###

n, k = map(int, input().split())
p_list = [int(i) for i in input().split()]


for i in range(len(p_list)-k+1):
    sum_temp = sum(p_list[i:i+k])
    if i == 0:
        sum_max = sum_temp
        index = i
    elif sum_temp > sum_max:
        sum_max = sum_temp
        index = i
    

kitaichi = k/2 + sum(p_list[index:index+k])/2
    
print(kitaichi)

### FIXED CODE ###

import numpy as np

n, k = map(int, input().split())
p_list = [int(i) for i in input().split()]

p_list = [0] + p_list

cum_list = []
p_sum = 0
for p in p_list:
    p_sum += p
    cum_list.append(p_sum)
    
cum_list = np.array(cum_list)
sum_list = cum_list[k:]-cum_list[:-k]
index = np.argmax(sum_list)

kitaichi = k/2 + sum_list[index]/2

print(kitaichi)
### BUGGY CODE ###

def readinput():
    n=int(input())
    x=input()
    return n,x

poptbl=[0]*(2*10**5+1)
def popcount(x):
    global poptbl
    if poptbl[x]!=0:
        return poptbl[x]
    
    poptbl[x]=bin(x).count('1')
    return poptbl[x]

ftbl=[0]*(2*10**5+1)
def f(x):
    global ftbl

    if ftbl[x]!=0:
        return ftbl[x]
    
    #print('f(x), x: {}'.format(x))
    if x==0:
        return 0
    else:
        ans=f(x%popcount(x))+1
        #print(ans)
        ftbl[x]=ans
        return ans    

def main():
    n=int(input())
    x=input()
    m=x.count('1')
    #print('m: {}'.format(m))
    xint=int(x,2)
    #print('xint: {}'.format(xint))
    if m!=1:
        xmodm1=xint%(m-1)
    else:
        xmodm1=1
    xmodp1=xint%(m+1)
    ans=[]
    b=2**(n-1)
    for i in range(n):
        if x[i]=='1':
            if m==1:
                a=0
                ans.append(a)
            else:
                xx=( xmodm1 + (m-1) -b%(m-1) )%(m-1)
                #ans.append(f(xx)+1)
                a=f(xx)+1
                ans.append(a)
        else:
            xx=( xmodp1 + b%(m+1) )%(m+1)
            #ans.append(f(xx)+1)
            a=f(xx)+1
            ans.append(a)
        b=b//2
        print(a)
    return ans

if __name__=='__main__':
    #n,x=readinput()
    ans=main()
    #for a in ans:
    #    print(a)



### FIXED CODE ###

def readinput():
    n=int(input())
    x=input()
    return n,x

poptbl=[0]*(2*10**5+1)
def popcount(x):
    global poptbl
    if poptbl[x]!=0:
        return poptbl[x]
    
    poptbl[x]=bin(x).count('1')
    return poptbl[x]

ftbl=[0]*(2*10**5+1)
def f(x):
    global ftbl

    if ftbl[x]!=0:
        return ftbl[x]
    
    #print('f(x), x: {}'.format(x))
    if x==0:
        return 0
    else:
        ans=f(x%popcount(x))+1
        #print(ans)
        ftbl[x]=ans
        return ans    

def main():
    n=int(input())
    x=input()
    m=x.count('1')
    #print('m: {}'.format(m))
    xint=int(x,2)
    #print('xint: {}'.format(xint))
    if m!=1:
        xmodm1=xint%(m-1)
    else:
        xmodm1=1
    xmodp1=xint%(m+1)
    pow2mod1=[0]*n
    pow2mod2=[0]*n
    pow2mod1[0]=1
    pow2mod2[0]=1
    for i in range(1,n):
        if m!=1:
            pow2mod1[i]=pow2mod1[i-1]*2 % (m-1)
        pow2mod2[i]=pow2mod2[i-1]*2 % (m+1)

    ans=[]
    #b=2**(n-1)
    for i in range(n):
        if x[i]=='1':
            if m==1:
                a=0
                ans.append(a)
            else:
                xx=( xmodm1 + (m-1) -pow2mod1[n-i-1] )%(m-1)
                #ans.append(f(xx)+1)
                a=f(xx)+1
                ans.append(a)
        else:
            xx=( xmodp1 + pow2mod2[n-i-1] )%(m+1)
            #ans.append(f(xx)+1)
            a=f(xx)+1
            ans.append(a)
        #b=b//2
        print(a)
    return ans

if __name__=='__main__':
    #n,x=readinput()
    ans=main()
    #for a in ans:
    #    print(a)
### BUGGY CODE ###

from collections import defaultdict
n = int(input())


def sieve(n):
    n += 1
    res = [i for i in range(n)]
    for p in range(2, int(n**.5)+1):
        if res[p] < p:
            continue
        for q in range(p**2, n, p):
            if res[q] == q:
                res[q] = p
    return res


U = 10**7
min_factor = sieve(U)


def prime_factor(n):
    res = defaultdict(int)
    while 1 < n:
        res[min_factor[n]] += 1
        n //= min_factor[n]
    return res


ans = 0
for i in range(1, n+1):
    x = 1
    for v in prime_factor(i).values():
        x *= v+1
    ans += x*i


print(ans)

### FIXED CODE ###

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

h,w,m=map(int, input().split())
r = [0]*max(h,w)
c = [0]*max(h,w)
l =[]

for i in range(m):
    x,y=map(int, input().split())
    r[x-1]+=1
    c[y-1]+=1
    l.append([x,y])

cm = max(c)
rm = max(r)
ci = [i for i, x in enumerate(c) if x == cm]
ri = [i for i, x in enumerate(r) if x == rm]
ans = cm + rm

for i in ri:
    for j in ci:
        if [i+1,j+1] not in l:
            print(int(ans))
            exit()

print(int(ans)-1)

### FIXED CODE ###

h,w,m=map(int, input().split())
r = [0]*max(h,w)
c = [0]*max(h,w)
l=[]

for i in range(m):
    x,y=map(int, input().split())
    r[x-1]+=1
    c[y-1]+=1
    l.append([x,y])

cm = max(c)
rm = max(r)
ci = [i for i, x in enumerate(c) if x == cm]
ri = [i for i, x in enumerate(r) if x == rm]
ans = cm + rm

cnt = 0
#print(l,ci,ri)
for i in range(m):
    if r[l[i][0]-1] == rm and c[l[i][1]-1] ==cm:
        cnt += 1

if cnt == len(ci)*len(ri):
    print(int(ans)-1)
else:
    print(int(ans))