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

import sys
input = sys.stdin.readline


def main():
    N, K = map(int, input().rstrip().split())
    pn = list(map(int, input().rstrip().split()))

    a = 0
    for i in range(N-K+1):
        p = pn[i:i+K]
        a = max(a, sum(p))

    ans = (a+K)/2
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

N, K = map(int, input().split())
pn = list(map(int, input().split()))

pn_t = [0]
for i in range(N):
    pn_t.append(pn[i]+pn_t[i])

l = 0
for i in range(N-K+1):
    l = max(l, pn_t[K+i]-pn_t[i])
ans = (l+K)/2
print(ans)
### BUGGY CODE ###

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

cntm = 0
for j in range(N-1):
	cnt = 0
	for i in range(j, N-1):
		if H[i] >= H[i+1]:
			cnt += 1
		else:
			break
	if cntm < cnt:
		cntm = cnt

print(cntm)


### FIXED CODE ###

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

cntm = 0
cnt = 0
for i in range(N-1):
	if H[i] >= H[i+1]:
		cnt += 1
	else:
		if cntm < cnt:
			cntm = cnt
		cnt = 0

if cntm < cnt:
	cntm = cnt
print(cntm)
### BUGGY CODE ###

n=int(input())
S=input()
q=int(input())

D=[[0]*26 for _ in range(n+1)]
for i,s in enumerate(S):
  for j in range(26):
    if j==ord(s)-97:
      D[i+1][j]=D[i][j]+1
    else:
      D[i+1][j]=D[i][j]

n_max=5*10**5
nn=n_max.bit_length()+1
BITS=[[0]*(2**nn) for _ in range(26)]
for i in range(26):
  BITS[i].insert(0,0)

def bitsum(BIT,i):
  s=0
  while i>0:
    s+=BIT[i]
    i-=i&(-i)
  return s

def bitadd(BIT,i,x):
  while i<=2**nn:
    BIT[i]+=x
    i+=i&(-i)
  return BIT

for _ in range(q):
  q1,q2,q3=map(str,input().split())
  if q1=="1":
    num=int(q2)-1
    prev=ord(S[num])-97
    new=ord(q3)-97
    bitadd(BITS[prev],num,-1)
    bitadd(BITS[new],num,1)
  else:
    l,r=int(q2),int(q3)
    ans=0
    for i in range(26):
      diff=D[r][i]-D[l-1][i]+bitsum(BITS[i],r)-bitsum(BITS[i],l-1)
      if diff:
        ans+=1
    print(ans)



### FIXED CODE ###

n=int(input())
S=list(input())
q=int(input())

D=[[0]*26 for _ in range(n+1)]
for i,s in enumerate(S):
  for j in range(26):
    if j==ord(s)-97:
      D[i+1][j]=D[i][j]+1
    else:
      D[i+1][j]=D[i][j]

n_max=n+1
nn=n_max.bit_length()+1
BITS=[[0]*(2**nn) for _ in range(26)]
for i in range(26):
  BITS[i].insert(0,0)

def bitsum(BIT,i):
  s=0
  while i>0:
    s+=BIT[i]
    i-=i&(-i)
  return s

def bitadd(BIT,i,x):
  while i<=2**nn:
    BIT[i]+=x
    i+=i&(-i)
  return BIT

for _ in range(q):
  q1,q2,q3=map(str,input().split())
  if q1=="1":
    num=int(q2)-1
    prev=ord(S[num])-97
    new=ord(q3)-97
    S[num]=q3
    if prev!=new:
      bitadd(BITS[prev],num+1,-1)
      bitadd(BITS[new],num+1,1)
  else:
    l,r=int(q2),int(q3)
    ans=0
    for i in range(26):
      diff=D[r][i]-D[l-1][i]+bitsum(BITS[i],r)-bitsum(BITS[i],l-1)
      if diff>0:
        ans+=1
    print(ans)
### BUGGY CODE ###

import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
from functools import lru_cache
INF = 1 << 60

#ここから書き始める
s = input()
q = int(input())
cnt = 0
for i in range(q):
    query = input().split()
    if len(query) == 1:
        cnt += 1
    else:
        if cnt % 2 == 0:
            if query[1] == "1":
                s = query[2] + s
            else:
                s += query[2]
        else:
            if query[1] == "1":
                s += query[2]
            else:
                s = query[2] + s

if cnt % 2 != 0:
    s = s[::-1]

print(s)


### FIXED CODE ###

import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce

sys.setrecursionlimit(4100000)
from functools import lru_cache

INF = 1 << 60

# ここから書き始める
s = input()
q = int(input())
cnt = 0
left = []
right = []
for i in range(q):
    query = input().split()
    if len(query) == 1:
        cnt += 1
    else:
        f = query[1]
        c = query[2]
        if cnt % 2 == 0:
            if f == "1":
                # s = c + s
                left.append(c)
            else:
                # s += c
                right.append(c)
        else:
            if f == "1":
                # s += c
                right.append(c)
            else:
                # s = query[2] + s
                left.append(c)

left = left[::-1]
right = "".join(right)
left = "".join(left)
ans = "".join([left, s, right])
# print(right, s, left)
if cnt % 2 != 0:
    ans = ans[::-1]

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

n, m = input().split()
n = int(n)
m = int(m)

result_list = []

# 正解した問題を入れるlist
done_list = []
correct = 0
pn = 0
done_list = []
pn_list = [0] * n

for i in range(m):
    a,b=input().split()
    
    if a in done_list:
        pass
    elif b == "WA":
        pn_list[int(a) - 1] += 1
    elif b == "AC":
        done_list.append(a)
        correct += 1
        pn += pn_list[int(a) - 1]

print(correct, pn)

### FIXED CODE ###

n, m = input().split()
n = int(n)
m = int(m)

# 正解した問題を入れるlist

correct = 0
pn = 0
done_list = [0] * n
pn_list = [0] * n

for i in range(m):
    a,b=input().split()
    
    if done_list[int(a)-1] == 0 and b == "AC":
        done_list[int(a)-1] += 1
        correct += 1
        pn += pn_list[int(a) - 1]
    elif b == "WA":
        pn_list[int(a) - 1] += 1

print(correct, pn)
### BUGGY CODE ###

a,b,k = map(int,input().split())

for i in range(k):
  if a > 0:
    a -= 1
  elif b > 0:
    b -=1
  else:
    break
    
print("{} {}".format(a,b))



### FIXED CODE ###

a,b,k = map(int,input().split())


if k <= a:
    a -= k

elif a < k < a+b:
  b -= (k - a)
  a = 0
elif k >= a+b:
  a = 0
  b = 0
    
    
print("{} {}".format(a,b))
### BUGGY CODE ###

from bisect import bisect_left

N = int(raw_input())
L = map(int, raw_input().split())

L.sort()
result = 0
for i, a in enumerate(L, 1):
    for j, b in enumerate (L[i:], i+1):
        k = bisect_left(L[j:], a + b)
        result += k
print result


### FIXED CODE ###

from bisect import bisect_left

N = int(raw_input())
L = map(int, raw_input().split())

L.sort()
result = 0
for i in xrange(N-2):
    a = L[i]
    for j in xrange(i+1, N-1):
        b = L[j]
        k = bisect_left(L, a + b, j + 1)
        result += k - (j + 1)
print result
### BUGGY CODE ###

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

counts = []
for border in range(N):
    # 入れ替える回数
    count = 0
    for i in range(N):
        if i < border:
            if S[i] == 'W':
                count += 1
        elif i > border:
            if S[i] == 'E':
                count += 1

    counts.append(count)

print(min(counts))

### FIXED CODE ###

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

countE = S.count('E')
countW = 0
min = countE + countW
for i in range(N):
    if S[i] == 'E':
        countE -= 1
    elif S[i] == 'W':
        countW += 1

    if countE + countW < min:
        min = countE + countW

print(min)
### BUGGY CODE ###

def g():
    N, M = map(int, input().split())
    xy = [list(map(int, input().split())) for _ in range(M)]
    memo = {}

    def g2(x):
        if x in memo:
            return memo[x]
        else:
            r = 0
            for xx, yy in xy:
                if x == xx:
                    r = max(r, g2(yy) + 1)
            memo[x] = r
        return r

    ans = [g2(i) for i in range(1, N + 1)]
    return max(ans)


if __name__ == '__main__':
    ans = g()
    print(ans)

### FIXED CODE ###

def g():
    from collections import defaultdict
    import sys

    sys.setrecursionlimit(10 ** 6)
    N, M = map(int, input().split())
    xy = defaultdict(list)
    memo = {}
    for _ in range(M):
        x, y = map(int, input().split())
        xy[x].append(y)

    def g2(x):
        if x in memo:
            return memo[x]
        else:
            r = 0
            for ny in xy[x]:
                r = max(r, g2(ny) + 1)
            memo[x] = r
        return r

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


if __name__ == '__main__':
    ans = g()
    print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from collections import defaultdict, deque

n, m = map(int, input().split())
G = defaultdict(set)
U = 10**6
seen = set()
for _ in range(m):
  p, q, c = map(int, input().split())
  G[p+U*c].add((q+U*c, 0))
  G[q+U*c].add((p+U*c, 0))
  G[p+U*c].add((p-U, 0))
  G[q+U*c].add((q-U, 0))
  G[p-U].add((p+U*c, 1))
  G[q-U].add((q+U*c, 1))
que = deque()
que.append((1-U, 0))
while que:
  v, cnt = que.popleft()
  if v in seen:
    continue
  if v == n-U:
    print(cnt)
    exit()
  seen.add(v)
  for nv, cost in G[v]:
    if cost == 0:
      que.appendleft((nv, cnt+cost))
    else:
      que.append((nv, cnt+cost))
print(-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import defaultdict, deque

n, m = map(int, input().split())
G = defaultdict(set)
U = 10**6
seen = set()
for _ in range(m):
  p, q, c = map(int, input().split())
  G[p+U*c].add((q+U*c, 0))
  G[q+U*c].add((p+U*c, 0))
  G[p+U*c].add((p-U, 0))
  G[q+U*c].add((q-U, 0))
  G[p-U].add((p+U*c, 1))
  G[q-U].add((q+U*c, 1))
que = deque()
que.append((1-U, 0))
while que:
  v, cnt = que.popleft()
  if v in seen:
    continue
  if v == n-U:
    print(cnt)
    exit()
  seen.add(v)
  for nv, cost in G[v]:
    if cost == 0:
      que.appendleft((nv, cnt+cost))
    else:
      que.append((nv, cnt+cost))
print(-1)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
from itertools import product
from heapq import heappop, heappush
import numpy as np


def small_dp(N,k,X):
    if k == 0:
        return N
    if k == 1:
        return X[0][1]*(N//X[0][0]) + N%X[0][0]
    if k == 2:
        return max(X[1][1]*i + X[0][1]*((N-i*X[1][0])//X[0][0]) + (N-i*X[1][0])%X[0][0] for i in range(N//X[1][0]+1))
    if k == 3:
        M = np.arange(N+1)
        dp0 = X[0][1]*(M//X[0][0]) + M%X[0][0]
        d = X[1][1]*(M//X[1][0]) + M%X[1][0]
        dp1 = [np.max(dp0[w::-1] + d[:w+1]) for w in range(N,-1,-1)]
        return np.max(dp1 + X[2][1]*(M//X[2][0]) + M%X[2][0])

def solve():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    
    for C in ((A,B), (B,A)):
        *X, = filter(lambda c: int.__sub__(*c)<0, zip(*C))
        N = small_dp(N, len(X), X)
    res = N

    return str(res)

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


### FIXED CODE ###

# -*- coding: utf-8 -*-
from itertools import product
from heapq import heappop, heappush

def small_dp(N,A,B):
    *X, = filter(lambda c: int.__sub__(*c)<0, zip(A,B))
    k = len(X)
    if k == 0:
        return N
    if k == 1:
        return X[0][1]*(N//X[0][0]) + N%X[0][0]
    if k == 2:
        c = 0
        for i in range(N//X[0][0]+1):
            j = (N-i*X[0][0])//X[1][0]
            c = max(X[0][1]*i + X[1][1]*j + (N-i*X[0][0])%X[1][0], c)
        return c
    if k == 3:
        if (N//X[1][0]+1)*(N//X[0][0]+1) <= 10**6 :
            return max(X[0][1]*i + max(X[1][1]*j + X[2][1]*((N-i*X[0][0]-j*X[1][0])//X[2][0]) + ((N-i*X[0][0]-j*X[1][0])%X[2][0]) for j in range((N-i*X[0][0])//X[1][0]+1)) for i in range(N//X[0][0]+1))
        else:
            import numpy as np
            dp = np.zeros(N+1, dtype=int)
            for w in range(1,N+1):
                dp[w] = max(dp[w-X[i][0]]+X[i][1] if w>=X[i][0] else w for i in range(k))
            N = dp[-1]
            return N

def solve():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    res = small_dp(small_dp(N, A, B), B, A)

    return str(res)

if __name__ == '__main__':
    print(solve())
### BUGGY CODE ###

import sys
from sys import stdin
sys.setrecursionlimit(200002)
input = stdin.readline

INF = 10000000000000
class Vertice:
  def __init__(self, num):
    self.num = num
    self.connected = []
    self.edge = []
    self.pos = INF
    
def DFS(vertice):
  judge = True
  connected_num = len(vertice.connected)
  for i in range(connected_num):
    con = vertice.connected[i]
    if con.pos == INF:
      con.pos = vertice.pos + vertice.edge[i]
      judge = DFS(con)
    elif con.pos != vertice.pos + vertice.edge[i]:
      judge = False
    if judge == False:
      break
  return judge
 
N, M = map(int, input().split())
L, R, D = ([None for i in range(M)] for j in range(3))
vertices = [Vertice(i) for i in range(N)]
for i in range(M):
  L[i], R[i], D[i] = map(int, input().split())
for i in range(M):
  if not vertices[R[i] - 1] in vertices[L[i] - 1].connected:
    vertices[L[i] - 1].connected.append(vertices[R[i] - 1])
    vertices[R[i] - 1].connected.append(vertices[L[i] - 1])
    vertices[L[i] - 1].edge.append(D[i])
    vertices[R[i] - 1].edge.append(-D[i])
judge = True
for i in range(N):
  if vertices[i].pos == INF:
    vertices[i].pos = 0
    judge = DFS(vertices[i])
    if judge == False:
      break
if judge:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys
sys.setrecursionlimit(2000002)

def DFS(i, pos, connected, distances):
  if pos[i] == None:
    pos[i] = 0
  size = len(connected[i])
  for j in range(size):
    if pos[connected[i][j]] == None:
      pos[connected[i][j]] = pos[i] + distances[i][j]
      if DFS(connected[i][j], pos, connected, distances) == False:
        return False
    elif pos[connected[i][j]] != pos[i] + distances[i][j]:
      return False
  return True

N, M = map(int, input().split())
pos = [None for i in range(N + 1)]
connected = [[] for i in range(N + 1)]
distances = [[] for i in range(N + 1)]
for i in range(M):
  l, r, d = map(int, input().split())
  connected[l].append(r)
  distances[l].append(d)
  connected[r].append(l)
  distances[r].append(-d)
judge = True
for i in range(1, N + 1):
  if pos[i] == None:
    judge = DFS(i, pos, connected, distances)
    if judge == False:
      break
if judge:
  print('Yes')
else:
  print('No')
### BUGGY CODE ###

K, S = map(int, input().split())


count = 0

for i in range(K + 1):
    for j in range(K + 1):
        for k in range(K + 1):
            if i + j + k == S:
                count += 1
print(count)

### FIXED CODE ###

K, S = map(int, input().split())

count = 0

for i in range(K + 1):
    for j in range(K + 1):

        if 0 <= S - i - j <= K:
            count += 1
print(count)
### BUGGY CODE ###

N,M=map(int,input().split())
A=list(map(int,input().split()))
A = sorted(A,reverse=True)
for i in range(M):
    A[0] =A[0]//2
    m = max(A)
    i = A.index(max(A))
    if m != A[0]:
        A[i] = A[0]
        A[0] = m
print(sum(A))


### FIXED CODE ###

#from operator import itemgetter
#from collections import Counter
import heapq
#N = int(input())
N, M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
#A = [int(input()) for i in range(N)]

heapq.heapify(A)

for i in range(M):
    max = heapq.heappop(A)
    heapq.heappush(A, max*(-1)//2*(-1))
print(-sum(A))
### BUGGY CODE ###

A, B, N = map(int, input().split())
ans = []
old = 0
count = 0
for a in range(N, -1, -1):
    count += 1
    new = int(A*a/B) - A*int(a/B)
    ans.append(new)

print(max(ans))


### FIXED CODE ###

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

x = min(B-1, N)

ans = int(A*x/B) - A*int(x/B)

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

import sys

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

def calcSum(n, A):
    return n

def main():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))

    l = [0] * (N + 1)
    for i in range(K, N + 1):
        pi = 1
        if (K == i):
            for j in range(i - K + 1, i + 1):
                pi *= A[j - 1]
        else:
            # print("A[i - K]=")
            # print(A[i - K])
            # print("A[i - 1]=")
            # print(A[i - 1])
            pi = l[i - 1] * A[i - 1] / A[i - K - 1] 
            # pi = l[i - 1] / A[j - K]
        l[i] = pi

        if (i != K):
            # print(l[i - 1])
            # print(l[i])
            if (l[i - 1] < l[i]):
                print("Yes")
            else:
                print("No")
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

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

def calcSum(n, A):
    return n

def main():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))

    for i in range(K + 1, N + 1): # K + 1 から N までのループ
        if (A[i - K - 1] < A[i - 1]):
            print("Yes")
        else:
            print("No")
    return

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

N, K = map(int, input().split())
p = input().split()
ex = [0 for i in range(N)]
E=0
S=0

for i in range(N):
    p[i] = int(p[i])
    

X=N-K+1

for i in range(X):
    newS = 0
    for j in range(K):
        newS += p[i+j]

    if newS > S:
        S = newS

E=(S+K)/2

print(E)



    


### FIXED CODE ###

N, K = map(int, input().split())
p = input().split()
bubun = [0 for i in range(N)]
sums= [0 for i in range(N+K)]
E=0
S=0

for i in range(N):
    p[i] = int(p[i])
    


sums[0] = p[0]
for i in range(N-1):
    sums[i+1] = sums[i] + p[i+1]

for i in range(N):
    if i == 0:
        bubun[i] = sums[K-1]
    else:
        bubun[i] = sums[i+K-1]-sums[i-1]

for i in range(N):

    if bubun[i] > S:
        S = bubun[i]


E=(S+K)/2

print(E)
### BUGGY CODE ###

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

ans=1
for i in range(1,n):
    s2=s[:i+1]
    #print(max(s2))

    if s[i]<=min(s2):
        ans+=1
    
print(ans)


### FIXED CODE ###

n=int(input())
s=list(map(int,input().split()))
 
ans=0
smin=s[0]
for i in range(n):
    if s[i]<=smin:
        ans+=1
        smin=s[i]
    
print(ans)
### BUGGY CODE ###

#coding: utf-8
import math
m,n = map(int,input().split())
ans = 1

# GCD(Grate Common Divisier) を求める
def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)

gcd_cnt = gcd(m,n)
# print(gcd_cnt)

# GCDの約数を素因数分解する
flg = 0
i = 2
while i <= gcd_cnt:
    # print(str(i)+str(',')+str(gcd_cnt))
    if gcd_cnt % i == 0:
        flg = 1
        gcd_cnt = gcd_cnt // i
    else:
        if flg == 1:
            ans +=1
            flg = 0
        i+=1 
if flg == 1:
    ans += 1

# if m % 2 == 0 and n % 2 == 0:
#     div.append(2)

# for i in range(1,m+1):
#     # print(i)
#     if m % i == 0 and n % i == 0:
#         ans += 1
#         # m = m / i
#         # n = n / i
#         div.append(i)
#         # for j in range(2,len(div)):
#         #     if i % div[j] == 0:
#         #         flg = 1
#         #         break
#         # if flg == 0:
#         #     div.append(i)
#         # else:
#         #     flg = 0
    
# print(" ".join(map(str,div)))
# div.sorted(reversed=True)

# for j in range(1,div[0]):
#     div[0] % j


# # print(len(div))
print(ans)


### FIXED CODE ###

#coding: utf-8
from fractions import gcd
import math

# GCDの約数を素因数分解する
def primeFactor(n):
    flg = 0
    count = 0
    tmp = math.sqrt(n)
    i = 2

    if n == 1:
        return 1

    while i <= tmp:
        # print(str(i)+str(',')+str(gcd_cnt))
        if n % i == 0:
            if flg == 0:
                flg = 1
                count += 1
            n = n // i
        else:
            flg = 0
            i += 1
    # if flg == 1:
    #     count += 1
    # print(str('素数=')+str(count)+str(' n=')+str(n)+str(' i=')+str(i))
    if n > 1:
        count += 1
    # 1を足す
    count += 1
    return count


# # print(len(div))
m,n = map(int,input().split())
p = gcd(m,n)
# print(str('gcd=')+ str(p))
ans = primeFactor(p)
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, K = map(int, input().split())

    while True:
        x = abs(N-K)
        if abs(x) > abs(N):
            break
        N = x
    
    print(N)


if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, K = map(int, input().split())

    if 2 * N < K:
        return N

    R = N % K
    
    if R < abs(R - K):
        return R
    else:
        return abs(R - K)


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

# EDPC A Frog 1
N, K = map(int, input().split())
H = list(map(int,input().split()))

cost = [float("inf")]*N
cost[0] = 0
cost[1] = abs(H[1]-H[0])

for i in range(2,N):
    for k in range(1,K+1):
        if i - k < 0:
            break
        if cost[i] > cost[i-k]+abs(H[i]-H[i-k]):
            cost[i] = cost[i-k]+abs(H[i]-H[i-k])

print(cost[N-1])

### FIXED CODE ###

# EDPC B Frog 2
N, K = map(int, input().split())
H = list(map(int,input().split()))

cost = [float("inf")]*N
cost[0] = 0
cost[1] = abs(H[1]-H[0])

for i in range(2,N):
    for k in range(1,min(K,i)+1):
        cost[i] = min(cost[i], cost[i-k]+abs(H[i]-H[i-k]))

print(cost[N-1])
### BUGGY CODE ###

N=int(input())
c=list(input())
x=0
for i in range(N):
  if c[i]=="W":
    for j in range(N):
      if i==N-1-j:
        break
      elif c[N-1-j]=="R":
        x+=1
        c[N-1-j]="W"
        break
print(x)

### FIXED CODE ###

N=int(input())
c=list(input())
x=0
M=N
for i in range(N):
  if c[i]=="W":
    for j in range(N):
      if i==M-1-j:
        M=i
        break
      elif c[M-1-j]=="R":
        x+=1
        c[M-1-j]="W"
        M=M-j
        break
  if i==M:
    break
print(x)
### BUGGY CODE ###

from queue import Queue

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

for i in range(m):
  l,r,d = map(int,input().split())
  e[l].append([r,d])
  e[r].append([l,-d])
#print(e)

c = [0]*(n+1) #チェック用
p = [0]*(n+1) #位置

flag = True
k = 1
while k < n:
  if c[k] == 2:
    k += 1
    continue
  q = Queue()
  q.put(k)
  p[k] = 0
  c[k] = 1
  while not q.empty():
    x = q.get()
    c[x] = 2
    for t in e[x]:
      y = t[0]
      d = t[1]
      if c[y] == 0:
        p[y] = p[x] + d
        c[y] = 1
        q.put(y)
      elif c[y] == 1:
        if not p[y] == p[x] + d:
          print("No")
          quit()
      else:
        w = 1
print("Yes")  

### FIXED CODE ###

n,m = map(int,input().split())
c = list(range(n+1)) #色
a = [] #色ごとのリスト
for i in range(n+1):
  a.append([i])
b = [1]*(n+1) #色ごとの頂点数
p = [0]*(n+1) #位置
#print(a)
for i in range(m):
  x,y,d = map(int,input().split())
  u = c[x]
  v = c[y]
  if b[u] < b[v]:
    x,y = y,x
    u,v = v,u
    d = -d
  if u != v:
    l = d + p[x] - p[y]
    for t in a[v]:
      c[t] = u
      p[t] += l
    a[u] += a[v]
    a[v] = []
    b[u] += b[v]
    b[v] = 0
  else:
    if not p[y]-p[x] == d:
      #print(p)
      print("No")
      quit()
print("Yes")
### BUGGY CODE ###

S = list(input())
num_query = int(input())

for i in range(num_query):
    query = input().split()
    if len(query) == 1:
        S = S[::-1]
    else:
        if query[1] == "1":
            S = list(query[2]) + S
        else:
            S.append(query[2])

print("".join(S))


### FIXED CODE ###

S = input()
num_query = int(input())

rev_flag = False
head = []
tail = []
for i in range(num_query):
    query = input().split()
    if len(query) == 1:
        if rev_flag == True:
            rev_flag = False
        else:
            rev_flag = True
    else:
        if rev_flag == False:
            if query[1] == "1":
                head.append(query[2])
            else:
                tail.append(query[2])
        else:
            if query[1] == "1":
                tail.append(query[2])
            else:
                head.append(query[2])

head = "".join(head)
head = head[::-1]
tail = "".join(tail)
ans = head + S + tail

if rev_flag == True:
    ans = ans[::-1]

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

def main():
    N = int(input())
    nums = [1] * (N + 1)
    s = 0
    for i in range(2, N+1):
        tmp = i
        while tmp <= N:
            nums[tmp] += 1
            tmp += i
    for i in range(1, N+1):
        s += i * nums[i]
    print(s)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    nums = [1] * (N + 1)
    s = 0
    for i in range(2, N+1):
        tmp = i
        while tmp <= N:
            nums[tmp] += 1 
            tmp += i
    for i in range(1, N+1):
        s += i * nums[i]
    print(s)


if __name__ == '__main__':
    main()