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

def main():
    monster_health, spells = map(int, input().split())
    attack = []
    damage = []
    for _ in range(spells):
        a, b = map(int, input().split())
        attack.append(a)
        damage.append(b)
    dp = [[float("inf") for _ in range(monster_health + 1)] for _ in range(spells + 1)]
    dp[0][0] = 0
    for i in range(1, spells + 1):
        for j in range(monster_health + 1):
            ind = min(j + attack[i - 1], monster_health)
            dp[i][j] = min(dp[i][j], dp[i - 1][j])
            dp[i][ind] = min(dp[i][ind], dp[i][j] + damage[i - 1])
    print(dp[-1][-1])


if __name__ == '__main__':
    main()



### FIXED CODE ###

def main():
    monster_health, spells = map(int, input().split())
    attack = []
    damage = []
    for _ in range(spells):
        a, b = map(int, input().split())
        attack.append(a)
        damage.append(b)
    dp = [[float("inf") for _ in range(monster_health + 1)] for _ in range(spells + 1)]
    dp[0][0] = 0
    for i in range(1, spells + 1):
        for j in range(monster_health + 1):
            ind = min(j + attack[i - 1], monster_health)
            dp[i][j] = min(dp[i][j], dp[i - 1][j])
            dp[i][ind] = min(dp[i][ind], dp[i][j] + damage[i - 1])
    print(dp[-1][-1])


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

def resolve():
	# N: 足場の個数, K: 1回で右にジャンプできる足場の数
	N, K = map(int, input().split())
	# h: 各足場の高さ
	h = list(map(int, input().split()))
	# dpテーブル宣言: dp[今いる足場の番号-1]=最小コスト
	dp = [float('inf')] * N
	dp[0] = 0

	# k個左の足場からジャンプして来た時の最小コストを調べる
	for n in range(1, N):
		for k in range(1, K+1):
			n_prev = n-k
			if n_prev >= 0:
				dp[n] = min(
					dp[n],
					abs(h[n] - h[n_prev]) + dp[n_prev]
				)
	print(dp[N-1])

resolve()

### FIXED CODE ###

def resolve():
	# N: 足場の個数, K: 1回で右にジャンプできる足場の数
	N, K = map(int, input().split())
	# h: 各足場の高さ
	# dpテーブル宣言: dp[今いる足場の番号-1]=[最小コスト, 足場の高さ]
	dp = [
		[float('inf'), int(h_)]
		for h_ in input().split()
	]
	dp[0][0] = 0
	dp[1][0] = abs(dp[0][1] - dp[1][1])

	# k個左の足場からジャンプして来た時の最小コストを調べる
	for n in range(2, N):
		index_0 = max(0, n-K)
		h_ = dp[n][1]
		dp[n][0] = min(
			[
				abs( h_ - dp_[1] ) + dp_[0]
				for dp_ in dp[index_0:n]
			]
		)
	print(dp[N-1][0])

resolve()
### BUGGY CODE ###

import sys
from functools import reduce


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


sys.setrecursionlimit(10 ** 9)

MOD = 10 ** 9 + 7


def main():
    def cmb(N, A):
        num = reduce(lambda x, y: x * y % MOD, range(N, N - A, -1))
        den = reduce(lambda x, y: x * y % MOD, range(1, A + 1))
        # pow(den,MOD-2,MOD)はdenの逆元
        return num * pow(den, MOD - 2, MOD) % MOD

    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    n = A[-1]
    C = 0
    ans = -1
    for a in A:
        if a == 0:
            c = 1
        else:
            c = cmb(n, a)
        if c > C:
            C = c
            ans = a
        elif c < ans:
            break

    print(n, ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys


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


sys.setrecursionlimit(10 ** 9)


def main():
    _ = int(input())
    A = list(map(int, input().split()))
    A.sort()
    n = A[-1]
    ans = -1
    for a in A:
        if a + 1 <= n / 2:
            ans = a
        else:
            b = n - a
            if b > ans:
                ans = a

    print(n, ans)


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

from collections import Counter

N=int(input())
S=[]

for _ in range(N):
    s=input()
    S.append(s)

c=Counter(S)

max_s_list= [kv[0] for kv in c.items() if kv[1]==max(c.values())]

ans=sorted(max_s_list)
for a in ans:
    print(a)

### FIXED CODE ###

from collections import Counter

N=int(input())
S=[]

for _ in range(N):
    s=input()
    S.append(s)

c=Counter(S)
arr=c.most_common()

maxnum=arr[0][1]
ans=[]

for i in range(len(arr)):
    if arr[i][1]==maxnum:
        ans.append(arr[i][0])        
    else:
        break
FA=sorted(ans)
for j in FA:
    print(j)
### BUGGY CODE ###

H, W, M = map(int, input().split())
h_list = [0] * H
w_list = [0] * W
target = []
for _ in range(M):
  h, w = map(int, input().split())
  h_list[h-1] += 1
  w_list[w-1] += 1
  target += [[h-1,w-1]]

h_max = max(h_list)
w_max = max(w_list)
h_max_list = set([i for i, v in enumerate(h_list) if v == max(h_list)])
w_max_list = set([i for i, v in enumerate(w_list) if v == max(w_list)])

place = len(h_max_list) * len(w_max_list)
candidate = 0
for h,w in target:
  if (h in h_max_list) and (w in w_max_list):
    candidate +=1

print(h_max+w_max-(place == candidate))

### FIXED CODE ###

H, W, M = map(int, input().split())
h_list = [0] * H
w_list = [0] * W
target = []
for _ in range(M):
  h, w = map(int, input().split())
  h_list[h-1] += 1
  w_list[w-1] += 1
  target += [[h-1,w-1]]

h_max = max(h_list)
w_max = max(w_list)
h_max_list = set([i for i, v in enumerate(h_list) if v == h_max])
w_max_list = set([i for i, v in enumerate(w_list) if v == w_max])

place = len(h_max_list) * len(w_max_list)
candidate = 0
for h,w in target:
  if (h in h_max_list) and (w in w_max_list):
    candidate +=1

print(h_max+w_max-(place == candidate))
### BUGGY CODE ###

import sys
input=sys.stdin.readline
n=int(input())
high=list(map(int,input().split()))
ans=[]
for i in range(n):
    count=0
    for k in range(i,n-1):
        if high[k]>=high[k+1]:
            count+=1
        else:
            break
    ans.append(count)

print(max(ans))

### FIXED CODE ###

n=int(input())
high=list(map(int,input().split()))
ans=[]
count=0
MaxC=0
for k in range(n-1):
    if high[k]>=high[k+1]:
        count+=1
        MaxC=max(MaxC,count)
    else:
        count=0
print(MaxC)
### BUGGY CODE ###



def main():
    n = int(input())
    a = [int(i) for i in input().split()]

    limit = 10**18
    result = 1
    for i in a:
        result *= i

    if result > limit:
        result = -1
    print(result)

main()


### FIXED CODE ###



def main():
    _ = int(input())
    a = [int(i) for i in input().split()]
    if 0 in a:
        print(0)
        return
    a.sort()

    limit = 10**18
    result = 1
    for i in a[::-1]:
        result *= i
        if result > limit:
            print(-1)
            return
    print(result)

main()
### BUGGY CODE ###

N,M = map(int, input().split())

A = [int(input()) for _ in range(M)]

lis = [0]*(N+1)
lis[0] = 1


for i in range(1,N+1):
    lis[i] = (lis[i-1] + lis[i-2])%(10**9+7)
    if i in A:
        lis[i] = 0

print(lis[N])



### FIXED CODE ###


n,m = map(int, input().split())
a = set([int(input()) for i in range(m)])

dp = [0]*(n+1)
dp[0] = 1
for i in range(1,n+1):
    dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)
    if i in a:
        dp[i] = 0
print(dp[n])
### BUGGY CODE ###

N=int(input())


X=[1]+[6**i for i in range(1,7)]+[9**i for i in range(1,6)]
X.sort()
X.reverse()

ANS=1000000



i=7



for i_0 in range(max(N//X[0]-i,0),N//X[0]+1):
    N_0=N-X[0]*i_0
    for i_1 in range(max(N_0//X[1]-i,0),N_0//X[1]+1):
        N_1=N_0-X[1]*i_1
        for i_2 in range(max(N_1//X[2]-i,0),N_1//X[2]+1):
            N_2=N_1-X[2]*i_2
            for i_3 in range(max(N_2//X[3]-i,0),N_2//X[3]+1):
                N_3=N_2-X[3]*i_3
                for i_4 in range(max(N_3//X[4]-i,0),N_3//X[4]+1):
                    N_4=N_3-X[4]*i_4
                    for i_5 in range(max(N_4//X[5]-i,0),N_4//X[5]+1):
                        N_5=N_4-X[5]*i_5
                        for i_6 in range(max(N_5//X[6]-i,0),N_5//X[6]+1):
                            N_6=N_5-X[6]*i_6
                            for i_7 in range(max(N_6//X[7]-i,0),N_6//X[7]+1):
                                N_7=N_6-X[7]*i_7
                                for i_8 in range(max(N_7//X[8]-i,0),N_7//X[8]+1):
                                    N_8=N_7-X[8]*i_8
                                    for i_9 in range(max(N_8//X[9]-i,0),N_8//X[9]+1):
                                        N_9=N_8-X[9]*i_9
                                        i_10=N_9//6
                                        N_10=N_9-X[10]*i_10
                                        if ANS>i_0+i_1+i_2+i_3+i_4+i_5+i_6+i_7+i_8+i_9+i_10+N_10:
                                            ANS=i_0+i_1+i_2+i_3+i_4+i_5+i_6+i_7+i_8+i_9+i_10+N_10


                                            




print(ANS)
        
    


### FIXED CODE ###

N=int(input())


X=[1]+[6**i for i in range(1,7)]+[9**i for i in range(1,6)]
X.sort()
X.reverse()

ANS=1000000







for i_0 in range(max(N//X[0]-3,0),N//X[0]+1):
    N_0=N-X[0]*i_0
    for i_1 in range(max(N_0//X[1]-3,0),N_0//X[1]+1):
        N_1=N_0-X[1]*i_1
        for i_2 in range(max(N_1//X[2]-3,0),N_1//X[2]+1):
            N_2=N_1-X[2]*i_2
            for i_3 in range(max(N_2//X[3]-3,0),N_2//X[3]+1):
                N_3=N_2-X[3]*i_3
                for i_4 in range(max(N_3//X[4]-3,0),N_3//X[4]+1):
                    N_4=N_3-X[4]*i_4
                    for i_5 in range(max(N_4//X[5]-3,0),N_4//X[5]+1):
                        N_5=N_4-X[5]*i_5
                        for i_6 in range(max(N_5//X[6]-3,0),N_5//X[6]+1):
                            N_6=N_5-X[6]*i_6
                            for i_7 in range(max(N_6//X[7]-3,0),N_6//X[7]+1):
                                N_7=N_6-X[7]*i_7
                                for i_8 in range(max(N_7//X[8]-3,0),N_7//X[8]+1):
                                    N_8=N_7-X[8]*i_8
                                    for i_9 in range(max(N_8//X[9]-3,0),N_8//X[9]+1):
                                        N_9=N_8-X[9]*i_9
                                        i_10=N_9//6
                                        N_10=N_9-X[10]*i_10
                                        if ANS>i_0+i_1+i_2+i_3+i_4+i_5+i_6+i_7+i_8+i_9+i_10+N_10:
                                            ANS=i_0+i_1+i_2+i_3+i_4+i_5+i_6+i_7+i_8+i_9+i_10+N_10


                                            




print(ANS)
### BUGGY CODE ###

n, ma, mb = map(int, input().split())
abc = [list(map(int, input().split())) for _ in range(n)]

inf = 10 ** 9
lst = [[inf for _ in range(401)] for _ in range(401)]
lst[0][0] = 0
for a, b, c in abc:
    for i in range(400, -1, -1):
        if i - a < 0:
            break
        for j in range(400, -1, -1):
            if j - b < 0:
                break
            lst[i][j] = min(lst[i][j], lst[i - a][j - b] + c)

ans = inf
a = ma
b = mb
while 1:
    try:
        ans = min(ans, lst[a][b])
        a += ma
        b += mb
    except IndexError:
        break
if ans == inf:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n, ma, mb = map(int, input().split())
abc = [list(map(int, input().split())) for _ in range(n)]

inf = 10 ** 9
lst = [[inf for _ in range(401)] for _ in range(401)]
lst[0][0] = 0
for a, b, c in abc:
    for i in range(400, -1, -1):
        if i - a < 0:
            break
        for j in range(400, -1, -1):
            if j - b < 0:
                break
            lst[i][j] = min(lst[i][j], lst[i - a][j - b] + c)

ans = inf
a = ma
b = mb
while 1:
    try:
        ans = min(ans, lst[a][b])
        a += ma
        b += mb
    except IndexError:
        break
if ans == inf:
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

from collections import deque

n, m = map(int, input().split())
path = [[] for i in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    path[a].append(b)
    path[b].append(a)

ans = [0] * (n - 1) 
seen = deque([1])
not_seen = [True] * n
not_seen[0] = False

while sum(not_seen) > 0:
    pre = seen.popleft()
    for now in path[pre]:
        if not_seen[now - 1]:
            #print(now, pre)
            seen.append(now)
            ans[now - 2] = pre
            not_seen[now - 1] = False
            #print(ans)

print("Yes")
for i in ans:
    print(i)



### FIXED CODE ###

from collections import deque

n, m = map(int, input().split())
path = [[] for i in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    path[a].append(b)
    path[b].append(a)

ans = [0] * (n - 1) 
seen = deque([1])
not_seen = [True] * n
not_seen[0] = False
cnt = n - 1

while cnt > 0:
    pre = seen.popleft()
    for now in path[pre]:
        if not_seen[now - 1]:
            seen.append(now)
            ans[now - 2] = pre
            not_seen[now - 1] = False
            cnt -= 1

print("Yes")
for i in ans:
    print(i)
### BUGGY CODE ###

n,p = list(map(int,input().split()))
S = input()

if p == 2 or p == 5:
  ans = 0
  for i,s in enumerate(S):
    if int(s)%p == 0:
      ans += i+1
  print(ans)
  exit()

def MS(i,s,pre):
  return (s*(10**i) +pre)%p
 
M = [0]*p
pre = 0
ans = 0
i = 0
for s in S[::-1]:
  pre = MS(i,int(s),pre)
  M[pre] += 1
  i += 1

M[0] += 1
ans = sum(map(lambda m:(m*(m-1))//2, M))
print(ans)


### FIXED CODE ###

n,p = list(map(int,input().split()))
S = input()

if p == 2 or p == 5:
  ans = 0
  for i,s in enumerate(S):
    if int(s)%p == 0:
      ans += i+1
  print(ans)
  exit()

def MS(i,s,pre):
  return (s*i +pre)%p
 
M = [0]*p
M[0] = 1
t = 1
now = 0
for i in S[::-1]:
    i = int(i)
    now += i*t
    now %= p
    M[now] += 1
    t = t*10%p

ans = sum(map(lambda m:(m*(m-1))//2, M))
print(ans)
### BUGGY CODE ###

n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))

primes = [True]*n
for d in range(2,10001):
    for i in range(n):
        if d!=a[i] and a[i]%d==0:
            primes[i] = False

print sum(primes)

### FIXED CODE ###

def prime(num):
    if num == 0:
        return False
    elif num == 1:
        return False
    elif num == 2:
        return True
    i = 2
    while True:
        if i**2 > num:
            break
        if num%i==0:
            return False
        i += 1
    return True
n = int(raw_input())

nums = []
for _ in range(n):
    a = int(raw_input())
    nums.append(a)

ret = 0
for num in nums:
    if prime(num):
        ret += 1
print ret
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))

dp1 = [x for x in a]
dp2 = [0 for _ in range(1<<n)]

for j in range(n+1):
	for i in range(1<<n):
		if i & (1<<j):
			if dp1[i & ~(1<<j)] >= dp1[i]:
				if dp2[i & ~(1<<j)] >= dp1[i]:
					dp2[i] = dp2[i & ~(1<<j)]
				else:
					dp2[i] = dp1[i]
				dp1[i] = dp1[i & ~(1<<j)]
			else:
				if dp1[i & ~(1<<j)] >= dp2[i]:
					dp2[i] = dp1[i & ~(1<<j)]

ans = 0
for i in range(1, 1<<n):
	ans = max(ans, dp1[i]+dp2[i])
	print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))

dp1 = [x for x in a]
dp2 = [0 for _ in range(1<<n)]

for j in range(n+1):
	for i in range(1<<n):
		if i & (1<<j):
			if dp1[i & ~(1<<j)] >= dp1[i]:
				if dp2[i & ~(1<<j)] >= dp1[i]:
					dp2[i] = dp2[i & ~(1<<j)]
				else:
					dp2[i] = dp1[i]
				dp1[i] = dp1[i & ~(1<<j)]
			else:
				if dp1[i & ~(1<<j)] >= dp2[i]:
					dp2[i] = dp1[i & ~(1<<j)]

ans = 0
for i in range(1, 1<<n):
	ans = max(ans, dp1[i]+dp2[i])
	print(ans)
### BUGGY CODE ###

N = int(input())
S = input()

center = N // 2

ans = 10 ** 9

for i in range(1,N):
  left = S[:i]
  right = S[i:]

  turn = left.count("W")+ right.count("E")
  if S[i - 1] == "W":
    turn -= 1
  if ans >= turn:
    ans = turn
    
print(ans)

### FIXED CODE ###

N = int(input())
S = input()
L = [0] * N
e = 0

for i in range(N - 1):
  #E,Wが互い違いになっていると相殺されるため手数は変わらない
  #iが増える = カーソルが右に行くにつれ
  #Eが続けて増えると手数は減り(カーソルの方向へ向く人が増えるため)、
  #Wが続けて増えると手数は増える(カーソルと逆方向を向く人が増えるため)
  if S[i + 1] == "E":
    #累積和を取っていくとともに、東の方向を向いている人数を記録する
    #カーソルが西端にあるとき、Eの総数が手数となる
    ##Eが続けて増えるとき累積和が減り、Eの総数からカーソル以西のEが相殺され、
    ##カーソル以東のEだけが計上される
    e += 1
    if S[i] == "E":
      L[i + 1] = L[i] - 1
    else: 
      L[i + 1] = L[i]
  else:
    if S[i] == "W":
      L[i + 1] = L[i] + 1
    else:
      L[i + 1] = L[i]

ans = min(L) + e
print(ans)
### BUGGY CODE ###

from itertools import*
N,K,Q,*A=map(int,open(0).read().split())
l=len
s=sorted
a=1e9
for Y in A:
	C=s(sum((v[:l(v)-K+1] for v in(s(v)for k,v in groupby(A,lambda a:a>=Y)if k)if l(v)>=K),[]))
	if l(C)>=Q:a=min(a,C[Q-1]-Y)
print(a)

### FIXED CODE ###

N, K, Q, *A = map(int, open(0).read().split())

ans = float("inf")
for Y in A:
    C = []
    tmp = []
    for a in A:
        if a >= Y:
            tmp.append(a)
        else:
            if len(tmp) >= K:
                C += sorted(tmp)[:len(tmp) - K + 1]
            tmp = []
    if len(tmp) >= K:
        C += sorted(tmp)[:len(tmp) - K + 1]

    if len(C) >= Q:
        C.sort()
        X = C[Q - 1]
        ans = min(ans, X - Y)

print(ans)
### BUGGY CODE ###

M = 1046572

def getkey(text):
    dic = {'A': 1, 'T': 2, 'G': 3, 'C': 4}
    sum = 0
    p = 1
    for c in text:
        sum += p*dic[c]
        p *= 5
    return sum

def h1(key):
    return key % M

def h2(key):
    return 1 + (key %(M-1))

def h3(key, i):
    return (h1(key) + i*h2(key)) % M

dict = {}
def find(text):
    global dict
    key = getkey(text)
    i = 0
    while i < M:
        h = h3(key, i)
        if dict.get(h) == None:
            return False
        elif dict[h] == text:
            return True
        i += 1
    return False

def insert(text):
    global dict
    key = getkey(text)
    i = 0
    while i < M:
        j = h3(key, i)
        if dict.get(j) == None:
            dict[j] = text
            break
        else:
            i += 1

n = int(input())
for i in range(n):
    op, text = input().split(' ')
    if op == 'insert':
        j = insert(text)
    elif op == 'find':
        rst = find(text)
        if rst:
            print('yes')
        else:
            print('no')



### FIXED CODE ###

import sys

M = 1046527
def h1(key):
    return key % M

def h2(key):
    return 1 + (key %(M-1))

def h3(key, i):
    return (h1(key) + i*h2(key)) % M

word_dic = {'A': 1, 'T': 2, 'G': 3, 'C': 4}
def getkey(text):
    sum = 0
    p = 1
    for c in text:
        sum += p*word_dic[c]
        p *= 5
    return sum

dict = [None for i in range(M)]
def find(text):
    key = getkey(text)
    i = 0
    while i < M:
        h = h3(key, i)
        if dict[h] == None:
            break
        elif dict[h] == text:
            return True
        i += 1
    return False

def insert(text):

    key = getkey(text)
    i = 0
    while i < M:
        j = h3(key, i)
        if dict[j] == None:
            dict[j] = text
            break
        else:
            i += 1

n = int(input())
operations = sys.stdin.readlines()
for ope in operations:
    op, text = ope.rstrip().split(' ')
    if op == 'insert':
        insert(text)
    elif op == 'find':
        rst = find(text)
        if rst:
            print('yes')
        else:
            print('no')
### BUGGY CODE ###

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


def mod_pow(a, n, m):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % m
        a = a * a % m
        n >>= 1
    return res


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


count = mod_pow(2, N, 10 ** 9 + 7) - 1
count -= cmb(N, A) % (10 ** 9 + 7)
count -= cmb(N, B) % (10 ** 9 + 7)
if count < 0:
    count += 10 ** 9 + 7
print(count)


### FIXED CODE ###

N, A, B = map(int, input().split())
MAX = max(A, B) + 1
MOD = 1000000007
nCk = [0] * MAX
nCk[0] = 0
nCk[1] = N


def mod_pow(a, n, m):
    res = 1
    while n != 0:
        if n & 1:
            res = (res * a) % m
        n = n >> 1
        a = (a * a) % m
    return res


def mod_inv(a, m):
    b = m
    u = 1
    v = 0
    while b:
        t = a // b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u


for i in range(2, MAX):
    nCk[i] = (nCk[i-1] * ((N-i+1) * mod_inv(i, MOD))) % MOD

count = (mod_pow(2, N, MOD) - 1 - nCk[A] - nCk[B]) % MOD
print(int(count))
### BUGGY CODE ###

import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()

def divisors(n):
    S, T = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            S.append(i)
            T.append(n // i)
        i += 1
    T.reverse()
    return S + T if S[-1] != T[0] else S + T[1:]

def resolve():
    n = int(input())
    print(sum(k * len(divisors(k)) for k in range(1, n + 1)))
resolve()

### FIXED CODE ###

n = int(input())
ans = 0
for m in range(1, int(n**.5) + 1):
    ans += m * (m + (n // m)) * ((n // m) + 1 - m)
k = int(n**.5)
ans -= k * (k + 1) * (2 * k + 1) // 6

print(ans)
### BUGGY CODE ###

import fractions
a,b = map(int, input().split())
g = fractions.gcd(a,b)
ans = 1
if g == 2:
  ans += 1
elif g > 2 and g%2 == 0:
  ans += 1
  while True:
    g //= 2
    if g%2 != 0:
      break
      
if g == 3:
  ans += 1
elif g > 3 and g%3 == 0:
  ans += 1
  while True:
    g //= 3
    if g%3 != 0:
      break

      
if g == 5:
  ans += 1
elif g > 5 and g%5 == 0:
  ans += 1
  while True:
    g //= 5
    if g%5 != 0:
      break
      
      
if g == 7:
  ans += 1
elif g > 7 and g%7 == 0:
  ans += 1
  while True:
    g //= 7
    if g%7 != 0:
      break

      
if g == 11:
  ans += 1
elif g > 11 and g%11 == 0:
  ans += 1
  while True:
    g //= 11
    if g%11 != 0:
      break

if g == 13:
  ans += 1
elif g > 13 and g%13 == 0:
  ans += 1
  while True:
    g //= 13
    if g%13 != 0:
      break

if g >= 17:
  for i in range(3, g+1):
    if g%i == 0:
      for j in range(2, i):
        if i%j == 0:
          break
      else:
        ans += 1
  print(ans)
else:
  print(ans)


### FIXED CODE ###

import fractions
import math
a,b = map(int, input().split())
g = fractions.gcd(a,b)
ans = 1

for i in range(2, int(math.sqrt(g))+1):
  if g%i == 0:
    ans += 1
    while True:
      g //= i
      if g%i != 0:
        break
if (g != 1):
  ans += 1
print(ans)
### BUGGY CODE ###

S = input()

ans = 0
for i in range(4, len(S)):
    for j in range(len(S) - 1, i - 1, -1):
        if int(S[j - i: j + 1]) % 2019 == 0:
            ans += 1

print(ans)

### FIXED CODE ###

S = input()

ans = 0
lists = [0 for i in range(2019)]
lists[0] += 1

num = 0
for i in range(len(S) - 1, -1, -1):
    num += pow(10, len(S) - 1 - i, 2019) * int(S[i])
    lists[num % 2019] += 1

for i in range(2019):
    if lists[i] >= 2:
        ans += (lists[i] * (lists[i] - 1)) // 2

print(ans)
### BUGGY CODE ###

S = input()
S = S[::-1]
C = ['maerd', 'remaerd', 'esare', 'resare']
ans = False
for j in range(len(S)):
    for i in range(len(S)):
        if S[0:i] in C:
            S = S[i:len(S)]
            ans = True
            break
if ans:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

S = input()
S = S[::-1]
C = ['maerd', 'remaerd', 'esare', 'resare']
ans = False
s = 0
for i in range(len(S)+1):
    if S[s:i] in C:
        s = i
        ans = True
    else:
        ans = False
if ans:
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

n,m=map(int,input().split(" "))
l=[]
bone=[]
count = 0
ans="IMPOSSIBLE"
for i in range(m):
	a,b=map(int,input().split(" "))
	l.append(a)
	l.append(b)
	
	if b==n:
		bone.append(a) #nと定期便がある島を記録
for i in l:
	if i==1:
		for j in bone:
			if l[count+1] == j:
				ans="POSSIBLE"
				break
	count=count+1
		
print(ans)

### FIXED CODE ###

n,m=map(int,input().split(" "))
l=[]
bone=[]
for i in range(m):
		a,b=input().split(" ")
		if a=="1":l.append(b)
		if b==str(n):bone.append(a)

ans=list(set(l) & set(bone))
if len(ans)!=0:
	print("POSSIBLE")
else:			
	print("IMPOSSIBLE")