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

n, m, q = map(int, input().split())
import numpy as np
Arr = np.zeros((n+1)**2, dtype=np.int).reshape((n+1, n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

A = np.array(Arr)
for i in range(q):
  left, right = map(int, input().split())
  train_num = np.sum(A[left:right+1, left:right+1], axis=None, dtype=np.int)
  print(train_num)

### FIXED CODE ###

n, m, q = map(int, input().split())
Arr = []
for i in range(n+1):
  Arr.append([0] * (n+1))
for i in range(m):
  l, r = map(int, input().split())
  Arr[l][r] += 1
#print(Arr)

B = []
for i in range(n+1):
  B_line = [0]
  for j in range(1, n+1):
    B_line.append(B_line[-1] + Arr[i][j])
  B.append(B_line)
#print(B)
  
for x in range(q):
  left, right = map(int, input().split())
  train_num = 0
  for i in range(left, right+1):
    train_num += B[i][right] - B[i][left-1]
  print(train_num)
### BUGGY CODE ###

from collections import defaultdict
from operator import itemgetter

n, a, b = map(int, input().split())
ppp = list(map(int, input().split()))
qqq = list(map(itemgetter(0), sorted(enumerate(ppp, start=1), key=itemgetter(1))))

dp = {0: 0}
for i in qqq:
    ndp = defaultdict(lambda: 1000000000000000)
    tmp_min_cost = 1000000000000000
    for j, cost in sorted(dp.items()):
        if cost >= tmp_min_cost:
            continue
        tmp_min_cost = cost
        if j < i:
            ndp[i] = min(ndp[i], cost)
            ndp[j] = min(ndp[j], cost + b)
        else:
            ndp[j] = min(ndp[j], cost + a)
    dp = ndp

print(min(dp.values()))


### FIXED CODE ###

from bisect import bisect
from operator import itemgetter

n, a, b = map(int, input().split())
ppp = map(int, input().split())
qqq = [i for i, p in sorted(enumerate(ppp, start=1), key=itemgetter(1))]
INF = 10 ** 15

dp = [(0, 0)]
for i in qqq:
    ndp = []
    s = bisect(dp, (i,))
    tmp_min = INF
    for j, cost in dp[:s]:
        cost += b
        ndp.append((j, cost))
        tmp_min = cost
    stay_cost = dp[s - 1][1]
    if tmp_min > stay_cost:
        ndp.append((i, stay_cost))
        tmp_min = stay_cost
    for j, cost in dp[s:]:
        cost += a
        if tmp_min > cost:
            ndp.append((j, cost))
            tmp_min = cost
    dp = ndp

print(dp[-1][1])
### BUGGY CODE ###

from collections import deque

def main():
  n, m = map(int, input().split())
  ab = (map(int, input().split()) for i in range(m))
  
  ggg = [[0] * (n+1) for i in range(n+1)]
  ff = [0] * (n+1)
  
  for a, b in ab:
    ggg[a][b] = 1
    ggg[b][a] = 1
    
  qq = deque()
  qq.append((1, 1))
  
  while qq:
    a, f = qq.popleft()
    for b in range(1, n+1):
      if ggg[a][b] and not ff[b]:
        ff[b] = a
        qq.append((b, a))
  
  rr = ff[2:]
  y = all(rr)
  
  print('Yes' if y else 'No')
  if y:
    for r in rr:
      print(r)

if __name__ == '__main__':
  main()


### FIXED CODE ###

from collections import deque

def main():
  n, m = map(int, input().split())
  ab = (map(int, input().split()) for i in range(m))
  
  ggg = [[] for i in range(n+1)]
  ff = [0] * (n+1)
  
  for a, b in ab:
    ggg[a].append(b)
    ggg[b].append(a)
    
  qq = deque()
  qq.append(1)
  ff[1] = 1
  
  while qq:
    a = qq.popleft()
    for b in ggg[a]:
      if not ff[b]:
        ff[b] = a
        qq.append(b)
  
  rr = ff[2:]
  y = all(rr)
  
  print('Yes' if y else 'No')
  if y:
    for r in rr:
      print(r)

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

def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    import numpy as np
    n,k=map(int,input().split())
    a=[0]*n
    a=np.array(a)
    MOD=998244353
    for i in range(k):
      l,r=map(int,input().split())
      a[l-1:r]=1
    dp=[0]*n*2
    dp[0]=1
    dp=np.array(dp)
    for i in range(1,n):
      if dp[i-1]==0:
        continue
      else:
        dp[i:i+n]+=dp[i-1]*a
        dp[i:i+n]%=MOD
    print(dp[n-1])
    
if __name__ == '__main__':
    resolve()

### FIXED CODE ###

def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    n,k=map(int,input().split())
    MOD=998244353
    lr=[list(map(int,input().split())) for _ in range(k)]
    dp=[0]*(n+1)
    dpsum=[0]*(n+1)
    dp[1]=1
    dpsum[1]=1
    for i in range(2,n+1):
      for l,r in lr:
        li=i-r
        ri=i-l
        if r<0:continue
        li=max(1,li)
        dp[i]+=dpsum[ri]-dpsum[li-1]
      dpsum[i]=(dpsum[i-1]+dp[i])%MOD
    print(dp[n]%MOD)
    
if __name__ == '__main__':
    resolve()
### BUGGY CODE ###

import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1, k+1):
            ans += gcd_list([a,b,c])
print(ans)

### FIXED CODE ###

import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def calc_same_num(s):
    if s[0]==s[1] and s[1]==s[2]:
        return 1
    elif s[0]==s[1] or s[1]==s[2]:
        return 3
    else:
        return 6
    
k = int(input())
sum_check = 0
a,b,c = 1,1,1
ans = 0
while a<=k and b<=k and c<=k:
    gcd = gcd_list([a,b,c])
    ans += gcd*calc_same_num([a,b,c])
    if c<k:
        c += 1
    elif b<k:
        b += 1
        c = b
    else:
        a += 1
        b = a
        c = a
print(ans)
### BUGGY CODE ###

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

    AA = []
    num = []
    for A in A:
        if (A in AA)==False:
            AA.append(A)
            num.append(1)
        else:
            num[AA.index(A)] += 1

    count = 0
    num.sort()
    num = num[::-1]
    if len(num)<=K:
        return 0
    else:
        for i in range(K,len(num)):
            count += num[i]
        return count


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

### FIXED CODE ###

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

    num = [0 for _ in range(200000)]
    s = 0
    for A in A:
        num[A-1] += 1

    count = 0
    num.sort()
    for i in range(200000-K):
        count += num[i]
    return count

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

from heapq import heappush, heappop
from operator import itemgetter
import sys
input = sys.stdin.readline
#参考
#https://atcoder.jp/contests/abc128/submissions/15199101
class PseudoSet():
    def __init__(self):
        self.s = []  # set
        self.e = []  # erase candidate

    def insert(self, x):
        heappush(self.s, x)

    def erase(self, x):
        heappush(self.e, x)

    def get_min(self):
        while self.e and self.e[0] == self.s[0]:
            _ = heappop(self.s)
            _ = heappop(self.e)
        return self.s[0] if len(self.s) > 0 else None

def main():
    n,q=map(int, input().split())
    event = []
    end = []
    for i in range(n):
        s,t,x=map(int, input().split())
        event.append([s-x,1,x])
        event.append([t-x,0,x])

    for i in range(q):
        d = int(input())
        event.append([d,2,i])
    event.sort(key = itemgetter(0,1))
    res = [-1]*q
    ps = PseudoSet()
    for time,type,x in event:
        if(type==1):
            ps.insert(x)
        elif(type==0):
            ps.erase(x)
        else:
            k = ps.get_min()
            if k is not None:
                res[x]=k
    print(*res,sep="\n")

if __name__ == '__main__':
    main()


### FIXED CODE ###

from heapq import heappush, heappop
from operator import itemgetter
import sys
input = sys.stdin.readline
#参考
#https://atcoder.jp/contests/abc128/submissions/15199101
class PseudoSet():
    def __init__(self):
        self.s = []  # set
        self.e = []  # erase candidate

    def insert(self, x):
        heappush(self.s, x)

    def erase(self, x):
        heappush(self.e, x)

    def get_min(self):
        while self.e and self.e[0] == self.s[0]:
            _ = heappop(self.s)
            _ = heappop(self.e)
        return self.s[0] if len(self.s) > 0 else None

def main():
    n,q=map(int, input().split())
    event = []
    end = []
    for i in range(n):
        s,t,x=map(int, input().split())
        event.append([s-x,1,x])
        event.append([t-x,0,x])

    for i in range(q):
        d = int(input())
        event.append([d,2,i])
    event.sort(key = itemgetter(0,1))
    res = [-1]*q
    ps = PseudoSet()
    for time,type,x in event:
        if(type==1):
            ps.insert(x)
        elif(type==0):
            ps.erase(x)
        else:
            k = ps.get_min()
            if k is not None:
                res[x]=k
    print(*res,sep="\n")

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

N, K = map(int, input().split())
P = [int(i) for i in input().split()]

max_sum = 0
for i in range(N-K+1):
    max_sum = max(max_sum, sum(P[i:i+K]))
    
print((max_sum + K) / 2)

### FIXED CODE ###

N, K = map(int, input().split())
P = [int(i) for i in input().split()]

E = [0 for i in range(N+1)]
for i in range(N):
    E[i+1] = E[i] + (P[i] + 1) / 2
    
ans = 0
for i in range(N-K+1):
    ans = max(ans, E[i+K] - E[i])

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

#!/usr/bin/python3

import sys
from bisect import bisect_left

sys.setrecursionlimit(1000000)

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

nbs = [ [] for _ in range(n) ]

for i in range(n - 1):
    (u, v) = map(int, input().split())
    nbs[u - 1].append(v - 1)
    nbs[v - 1].append(u - 1)


mlen =  [ 0 ] * n
dp = [ float('inf') ] * n

def getmlen(cur, p, ctail):
    idx = bisect_left(dp, a[cur])
    ov = dp[idx]
    if ctail < idx:
        ctail = idx

    dp[idx] = a[cur]
    mlen[cur] = ctail + 1
    
    for ch in nbs[cur]:
        if ch == p:
            continue

        getmlen(ch, cur, ctail)
    dp[idx] = ov

getmlen(0, -1, 0)

for i in range(n):
    print(mlen[i])


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
from bisect import bisect_left
 
N = int(input())
a = [int(i) for i in input().split()]
vec = [[] for _ in range(N)]
for _ in range(N - 1) :
  u, v = map(int, input().split())
  vec[u - 1].append(v - 1)
  vec[v - 1].append(u - 1)
 
lis = [a[0]]
ret = [0] * N
def dfs(cur, pre) :
  for nex in vec[cur] :
    if nex == pre : continue
    if a[nex] > lis[-1] :
      lis.append(a[nex])
      ret[nex] = len(lis)
      dfs(nex, cur)
      lis.pop()
    else :
      pos = bisect_left(lis, a[nex])
      v = lis[pos]
      lis[pos] = a[nex]
      ret[nex] = len(lis)
      dfs(nex, cur)
      lis[pos] = v
 
dfs(0, -1)
 
ret[0] = 1
for i in range(N) :
  print(ret[i])
### BUGGY CODE ###

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

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


# 迷路　BFS
def bfs(sx, sy):
    d = deque()
    d.append((sx, sy, distance[sx][sy]))
    ans = distance[sx][sy]
    v = distance[sx][sy]
    check[sx][sy] = 0

    while len(d):
        x, y, dis = d.popleft()
        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]

            if 0 <= nx < n and 0 <= ny < n:
                # 更新できるマスは更新
                if distance[nx][ny] > dis:
                    distance[nx][ny] = dis
                    d.append((nx, ny, dis + check[nx][ny]))

    return ans



distance = [[min(i, j, n - i - 1, n - j - 1) for i in range(n)] for j in range(n)]
check = [[1] * n for i in range(n)]
anss=0
for i in p:
    x = (i - 1) // n
    y = (i - 1) % n
    anss+=bfs(x, y)

print(anss)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

distance = [[min(i, j, n - i - 1, n - j - 1) for i in range(n)] for j in range(n)]
check = [[1] * n for i in range(n)]
p = [((i - 1) // n, (i - 1) % n) for i in p]

def move(x,y,nx,ny):
    if distance[nx][ny] > distance[x][y] + check[x][y]:
        distance[nx][ny] = distance[x][y] + check[x][y]
        d.append((nx,ny))

ans = 0
for i, j in p:
    ans += distance[j][i]
    d=[]
    d.append((j,i))
    check[j][i] = 0
    while len(d):
        x, y = d.pop()
        if x!=0:
            move(x,y,x-1,y)
        if x!=n-1:
            move(x,y,x+1,y)
        if y!=0:
            move(x,y,x,y-1)
        if y!=n-1:
            move(x,y,x,y+1)

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

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

cnt = 0
for i in range(M):
    A+=[List[i][1]]*List[i][0]
    cnt+=List[i][0]


print(sum(sorted(A)[cnt:]))

### FIXED CODE ###

from heapq import heappop, heappush, heapify

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

List = sorted(List, reverse=True, key=lambda x: x[1])

heapify(A)

i = 0
while i<M:
    m = heappop(A)
    heappush(A, m)
    tmp = List[i][1]
    cnt = List[i][0]
    while (0<cnt) and (m<tmp):
            m = heappop(A)
            heappush(A, tmp)
            tmp = List[i][1]
            cnt-=1
    i+=1

print(sum(A))
### BUGGY CODE ###

import bisect
n,m = map(int,input().split())
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))

lis = [[]for i in range(m)]

for i in range(n):
    if ab[i][0]<=m:
        lis[ab[i][0]-1].append(ab[i][1])

pys = []
sum = 0
for i in range(m):
    tmp = lis[i]
    for j in tmp:
        bisect.insort(pys,j)
    if pys:
        sum+=pys.pop(-1)

print(sum)


### FIXED CODE ###

#import bisect
import heapq
from collections import deque
n,m = map(int,input().split())
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))

lis = [[]for i in range(m)]

for i in range(n):
    if ab[i][0]<=m:
        lis[ab[i][0]-1].append(ab[i][1])

pys = []
heapq.heapify(pys)
sum = 0
for i in range(m):
    tmp = lis[i]
    if tmp:
        for j in tmp:
            heapq.heappush(pys,-j)
    if pys:
        sum-=heapq.heappop(pys)

print(sum)
### BUGGY CODE ###

import heapq
N = int(input())
A = []

for _ in range(N):
    A.append((-1)*(int(input())))

B = A.copy()

heapq.heapify(B)
max_1 = 0 - heapq.heappop(B)
max_2 = 0 - heapq.heappop(B)

if max_1 == max_2:
    for _ in range(N):
        print(max_1)
        
else:
    for i in range(N):
        if i == A.index(-max_1):
            print(max_2)
        else:
            print(max_1)

    


### FIXED CODE ###

import heapq
N = int(input())
A = []

for _ in range(N):
    A.append((-1)*(int(input())))

B = A.copy()

heapq.heapify(B)
max_1 = 0 - heapq.heappop(B)
max_2 = 0 - heapq.heappop(B)

if max_1 == max_2:
    for _ in range(N):
        print(max_1)
        
else:
    index = A.index(-max_1)
    
    for i in range(index):
        print(max_1)

    print(max_2)

    for i in range(N - index - 1):
        print(max_1)
### BUGGY CODE ###

from collections import defaultdict


N = int(input())
A = list(map(int, input().split())) 
MOD = 10**9 + 7
def gcd(a,b):
  x = max([a,b])
  y = min([a,b])
  while y:
    x, y = y, x % y
  return x

# x * y = lcm(x, y) // gcd(x, y)より
def lcm(x, y):
  return x * y // gcd(x, y)

l = 1
for a in A:
    l = lcm(l, a)

ans = 0
for i in range(N):
    ans += l // A[i]
    ans %= MOD

print(ans)


"""
def primes(num):
    if num == 1:
        d = defaultdict(int)
        d[1] = 1
        return d

    i = 2
    d = defaultdict(int)
    while i * i <= num:
        while num % i == 0:
            num //= i
            d[i] += 1
        i += 1
    if num > 1:
        d[num] += 1

    return d

d = primes(A[0])

for a in A[1:]:
    tmp_d = primes(a)
    dk = set(d.keys())
    tmp_dk = set(tmp_d.keys())
    dk = dk | tmp_dk
    for k in dk:
        d[k] = max(d[k], tmp_d[k])

lcm = 1

for k in d.keys():
    lcm *= k**d[k] % MOD


ans = 0
for i in range(N):
    ans += (lcm // A[i])
    ans %= MOD

print(ans)
"""

### FIXED CODE ###

from fractions import gcd


def main():
        
    N = int(input())
    A = list(map(int, input().split())) 
    MOD = 10**9 + 7


    l = 1

    for a in A:
        l = l * a // gcd(l, a)


    ans = 0
    for a in A:
        ans += (l // a)
    ans %= MOD

    print(ans)


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

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

A = [(a, i) for i, a in enumerate(A, 1)]
A.sort()

n2i = [0] * (N + 1)
for a, i in A:
    n2i[a] = i

def num2index(a):
    print(a)
    if a == 0:
        return 1
    else:
        return n2i[a] + 1

bit = [0] * (N + 1)

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

def bit_sum(bit, i):
    res = 0
    while i:
        res += bit[i]
        i -= i & -i
    return res
    
def bit_find_prev(i):
    if bit_sum(bit, i - 1) == 0:
        return 0
    else:
        ok = i - 1
        ng = 0
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            if bit_sum(bit, ok) - bit_sum(bit, mid):
                ng = mid
            else:
                ok = mid
        return ok

def bit_find_next(i):
    if bit_sum(bit, N) - bit_sum(bit, i) == 0:
        return N + 1
    else:
        ok = N
        ng = i
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            if bit_sum(bit, mid) - bit_sum(bit, ng):
                ok = mid
            else:
                ng = mid
        return ok
    
answer = 0
for a, i in A:
    bit_add(bit, i, 1)
    #print(i, bit_find_prev(i), bit_find_next(i))
    answer += (bit_find_next(i) - i) * (i - bit_find_prev(i)) * a

print(answer)

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline

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

left = [0] * N
tmp = []
for i, a in enumerate(A):
    cnt = 1
    while tmp:
        aa, c = tmp.pop()
        if aa < a:
            tmp.append((aa, c))
            break
        else:
            cnt += c
    tmp.append((a, cnt))
    left[i] = cnt
A =A [::-1]
right = [0] * N
tmp = []
for i, a in enumerate(A):
    cnt = 1
    while tmp:
        aa, c = tmp.pop()
        if aa < a:
            tmp.append((aa, c))
            break
        else:
            cnt += c
    tmp.append((a, cnt))
    right[i] = cnt
right = right[::-1]

A = A[::-1]
answer = 0
for i in range(N):
    answer += left[i] * right[i] * A[i]
    
print(answer)
### BUGGY CODE ###

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

c = 0
for i in range(len(b)):
  # print('倒せる数', b)
  # print('倒せる街にいるモンスターの数',a)
  for j in range(b[i]):
    if a[i] > 0:
      b[i] -= 1
      a[i] -= 1
      c += 1
    elif a[i] == 0 and a[i+1] > 0:
      b[i] -= 1
      a[i+1] -= 1
      c += 1

print(c)


### FIXED CODE ###

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

c = 0

for i in range(len(b)):
  if b[i] > a[i]:
    c += a[i]
    b[i] = b[i] - a[i]
    a[i] = 0
  else:
    c += b[i]
    a[i] = a[i] - b[i]
    b[i] = 0
  
  if a[i] == 0:
    if b[i] > a[i+1]:
      c += a[i+1]
      b[i] = b[i] - a[i+1]
      a[i+1] = 0
    else:
      c += b[i]
      a[i+1] = a[i+1] - b[i]
      b[i] = 0
  

print(c)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input())
S = [input() for _ in range(N)]
 
T = sorted(set(S))
t = len(T)
l = [S.count(T[i]) for i in range(t)]
  
for i in range(t):
  if l[i] == max(l):
    print(T[i])

### FIXED CODE ###

from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

S = Counter(S).most_common()
l = []
for i in S:
  if i[1] == S[0][1]: l.append(i[0])

l = sorted(l)
for i in l:
  print(i)
### BUGGY CODE ###

import math
N=int(input())
a=input().split()
A=[int(b) for b in a]
numbers=[0]*(2*10**5)
for a in range(1,N+1):
    kosuu=A.count(a)
    if kosuu<=1:
        pass
    else:
        numbers.insert(a-1,kosuu)
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
answers=[0]*(2*10**5)
for a in range(1,N+1):
    if numbers[a-1]>=2:
        b=combinations_count(numbers[a-1],2)
        answers[a-1]+=b
kotae=sum(answers)
for a in range(N):
    z=A[a]
    if answers[z-1]==0:
        print(0)
    else:
        answer=kotae-numbers[z-1]+1
        print(answer)


### FIXED CODE ###

import math
import sys
from collections import Counter
N=int(input())
a=sys.stdin.readline().split()
A=[int(b) for b in a]
numbers=[0]*N
count=Counter(A)
kotae=0
for a in range(N+1):
    b=count[a]
    kotae+=b*(b-1)//2
for a in A:
    print(kotae+1-count[a])
### BUGGY CODE ###

#ABC097C
s=str(input())
K=int(input())
s_all=[]
s_ans=[]
for i in range(len(s)):
    for j in range(len(s)-i):
        s_all.append(s[j:j+i+1])
sorted_s_all=sorted(s_all)
for i in range(len(sorted_s_all)):
    if i==0:
        s_ans.append(sorted_s_all[i])
    elif sorted_s_all[i]!=sorted_s_all[i-1]:
        now=sorted_s_all[i]
        before=sorted_s_all[i-1]
        s_ans.append(sorted_s_all[i])
print(str(s_ans[K-1]))

### FIXED CODE ###

#ABC097C
s=str(input())
K=int(input())
s_all=[]
s_ans=[]
for i in range(K):
    for j in range(len(s)-i):
        s_all.append(s[j:j+i+1])
sorted_s_all=sorted(s_all)
for i in range(len(sorted_s_all)):
    if i==0:
        s_ans.append(sorted_s_all[i])
    elif sorted_s_all[i]!=sorted_s_all[i-1]:
        now=sorted_s_all[i]
        before=sorted_s_all[i-1]
        s_ans.append(sorted_s_all[i])
print(str(s_ans[K-1]))
### BUGGY CODE ###

P=1000000007
def gcd(x,y):
  return (y if x%y==0 else gcd(y,x%y))
def lcd(x,y):
  return x*y//gcd(x,y)
N=int(input())
A=list(map(int,input().split()))
l=1
for a in A:
  l=lcd(a,l)
ans=0
for a in A:
  ans+=l//a
print(ans%P)



### FIXED CODE ###

P=1000000007
def power(x,p):
  if(p==0):
    return 1;
  if(p%2):
    return power(x,p-1)*x%P;
  a=power(x,p//2);
  return a*a%P;
def inv(x):
  return power(x,P-2);
N=int(input());A=list(map(int,input().split()));
#N=10000;A=[1000000 for i in range(N)];
L=[0 for i in range(max(A)+1)]
for a in A:
  t=a;i=2;
  while(i**2<=a):
    c=0;
    while(t%i==0):
      t//=i;c+=1;
    L[i]=max(L[i],c)
    i+=1;
  if(t!=1):
    L[t]=max(L[t],1)
    
l=1;
for i in range(2,len(L)):
  l=l*power(i,L[i])%P;
b=0;
for a in A:
  b=(b+inv(a))%P
print(l*b%P)
### BUGGY CODE ###

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
s = p + q + r
S = sorted(s, reverse = True)
i = 0
j = 0
ans = 0
a = 0
b = 0
c = 0
while i < (X + Y):
  if S[j] in r:
    c += 1
    r.remove(S[j])
    ans += S[j]
    i += 1
  elif S[j] in p and a < X:
    a += 1
    p.remove(S[j])
    ans += S[j]
    i += 1
  elif S[j] in q and b < Y:
    b += 1
    q.remove(S[j])
    ans += S[j]
    i += 1
  j += 1
print(ans)

### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse = True)
q = sorted(list(map(int, input().split())), reverse = True)
r = sorted(list(map(int, input().split())), reverse = True)
S = sorted(p[:X] + q[:Y] + r[:X+Y], reverse = True)
print(sum(S[:X+Y]))
### BUGGY CODE ###

n,m = map(int,input().split())
count_ac = 0
count_wa = 0
l = []
for i in range(m):
    t = tuple(input().split())
    l.append(t)
for i in range(1,n+1):
    if (str(i), 'AC') in l:
        idx = l.index((str(i), 'AC'))
        count_ac += 1
        count_wa += l[:idx].count((str(i),'WA'))

print(str(count_ac) + " " + str(count_wa))

### FIXED CODE ###

n,m = map(int,input().split())
ac = [0]*n
wa = [0]*n
for i in range(m):
    p,s = input().split()
    p = int(p)
    if ac[p-1]:
        continue
    if s == 'AC':
        ac[p-1] = 1
    else:
        wa[p-1] += 1
count_ac = 0
count_wa = 0
for i in range(n):
    count_ac += ac[i]
    if ac[i]:
        count_wa += wa[i]
print(str(count_ac) + " " + str(count_wa))
### BUGGY CODE ###

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

if len(h) <= k:
  ans = 0
else:
  while k > 0:
    h.remove(max(h))
    k -= 1
  ans = sum(h)
  
print(ans)

### FIXED CODE ###

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

h = sorted(h, reverse = True)
h = h[k:]
print(sum(h))