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

import itertools
import heapq
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
b = np.abs(a)
b = sorted(a,reverse = True)
b_k = b[k-1] 
a_new = [a[_] for _ in range(len(a)) if np.abs(a)[_] >= b_k]
a_new.sort()
D = [[a_new[i+j-k] for j in range(k)] for i in range(len(a_new))]
A = (functools.reduce(operator.mul,D[_]) for _ in range(len(D)))
l_max = max(A)
waru = 10**9 + 7
print(l_max % waru)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
### BUGGY CODE ###

N, Q = list(map(int, input().split()))
S = input()
for q in range(Q):
    l, r = list(map(int, input().split()))
    print(S[l-1:r].count('AC'))

### FIXED CODE ###

N, Q = list(map(int, input().split()))
S = input()
pre = [0]*N
for i in range(1, len(S)):
    if S[i] == 'C' and S[i-1] == 'A':
        pre[i] = pre[i-1] + 1
    else:
        pre[i] = pre[i-1]
for q in range(Q):
    l, r = list(map(int, input().split()))
    l-=1
    r-=1
    print(pre[r] - pre[l])
### BUGGY CODE ###

n=int(input())
s=sorted([''.join(sorted(input())) for i in range(n)])
a=list(set(s))
cnt=0
for i in a:
  j=s.count(i)
  cnt+=j*(j-1)//2
print(cnt)

### FIXED CODE ###

n=int(input())
s=sorted([''.join(sorted(input())) for i in range(n)])

c=[]
i=0
while i<n-1:
  cnt=0
  while i<n-1 and s[i]==s[i+1]:
    cnt+=1
    i+=1
  c+=[cnt+1]
  i+=1
ans=0
for i in c:
  if i>1:
    ans+=i*(i-1)//2
print(ans)
### BUGGY CODE ###

B, W = map(int,input().split())
Mod = 10**9+7
magick = 500000004

inv_t = [0]+[1]
for i in range(2,B+W+1):
   inv_t += [inv_t[Mod % i] * (Mod - int(Mod / i)) % Mod]

consts_B, consts_W = [0]*(B-1)+ [1], [0]*(W-1)+[1]
for i in range(B+W):
  if i >= B: consts_B += [consts_B[-1]*(i)*inv_t[i-B+1]%Mod]
  if i >= W: consts_W += [consts_W[-1]*(i)*inv_t[i-W+1]%Mod]

p, q = 0, 0
inv = 1
for i in range(B+W):
  print((1-p+q)*magick%Mod)
  inv *= magick%Mod
  p += consts_B[i]*inv
  q += consts_W[i]*inv

### FIXED CODE ###

B, W = map(int,input().split())
Mod = 10**9+7
magick = 500000004

inv_t = [0]+[1]
inv_2 = [0]+[magick]
for i in range(2,B+W+1):
  inv_t += [inv_t[Mod % i] * (Mod - int(Mod / i)) % Mod]
  inv_2 += [inv_2[-1]*magick % Mod]

consts_B, consts_W = [0]*(B-1)+ [1], [0]*(W-1)+[1]
for i in range(B+W):
  if i >= B: consts_B += [consts_B[-1]*(i)*inv_t[i-B+1]%Mod]
  if i >= W: consts_W += [consts_W[-1]*(i)*inv_t[i-W+1]%Mod]

p, q = 0, 0
for i in range(B+W):
  print((1-p+q)*magick%Mod)
  p += consts_B[i]*inv_2[i+1]
  q += consts_W[i]*inv_2[i+1]
### BUGGY CODE ###

l = [[],[],[],[],[],[],[],[],[],[],[]]

N = int(input())

for i in range(N):
  x = input()
  if x not in l[len(x)]:
    l[len(x)].append(x)

l2 = 0
for i in range(11):
  l2 += len(l[i])

print(l2)



### FIXED CODE ###

myset = set()

N = int(input())

for i in range(N):
  x = input()
  myset.add(x)
    
print(len(myset))
### BUGGY CODE ###

import sys

def lcs_count(A,B):
    dp = [list(0 for _ in range(l2+1)) for _ in range(l1+1)]
    # create table
    for i in range(1,l1+1):
        for j in range(1,l2+1):
            if A[i-1] == B[j-1]:
                dp[i][j] = dp[i-1][j-1] + 1
            else:
                dp[i][j] = max(dp[i-1][j],dp[i][j-1])
    return dp

def lcs_string(dp):
    string = []
    for i,j in zip([m for m in range(l1,0,-1)],[n for n in range(l2,0,-1)]):
        if dp[i][j] > dp[i-1][j-1]:
            string.insert(0,chr(s[i-1]+97))
    print("".join(string))

s = [ord(a)-97 for a in list(sys.stdin.readline().rstrip())]
t = [ord(b)-97 for b in list(sys.stdin.readline().rstrip())]
l1 = len(s)
l2 = len(t)

DP = lcs_count(s,t)
lcs_string(DP)







### FIXED CODE ###

import sys

s = [ord(a)-97 for a in list(sys.stdin.readline().rstrip())]
t = [ord(b)-97 for b in list(sys.stdin.readline().rstrip())]
len_s = len(s)
len_t = len(t)

dp = [[0] * (len_t+1) for i in range(len_s+1)]
for i in range(len_s):
    for j in range(len_t):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

strings = []
while len_s > 0 and len_t > 0:
    if s[len_s-1] == t[len_t-1]:
        len_s -= 1
        len_t -= 1
        strings.insert(0,chr(s[len_s]+97))
    elif dp[len_s][len_t-1] > dp[len_s-1][len_t]:
        len_t -= 1
    else:
        len_s -= 1

print("".join(strings))
### BUGGY CODE ###

def s():
  from sys import stdin
  read=stdin.buffer.readline
  n=int(read())
  l=list(map(int,read().split()))
  f=l[0]
  mod=10**9+7
  def gcd(s,d):
    return gcd(d,s%d) if d else s
  for i in l:
    f=i*f//gcd(i,f)
  ans=sum([f//x%mod for x in l])%mod
  print(ans)
  
if __name__=="__main__":s()


### FIXED CODE ###

def s():
  from sys import stdin
  read=stdin.buffer.readline
  n=int(read())
  l=list(map(int,read().split()))
  f=l[0]
  mod=10**9+7
  def gcd(s,d):
    s,d=max(s,d),min(s,d)
    while  d:
      s,d=d,s%d
    return s
  for i in l:
    f=i*f//gcd(i,f)
  ans=0
  for iu in l:
    b,u,v=mod,1,0
    while b:
      t=iu//b;iu,b=b,iu%b;u-=t*v;u,v=v,u
    ans+=(f*u%mod)%mod
    ans%=mod
  print(ans)
  
if __name__=="__main__":s()
### BUGGY CODE ###

N = int(input())
A = [0 for i in range(N)]

color = 1
A[0] = int(input())

for i in range(N - 1):
        a = int(input())
        num = -1
        for j in range(color):
                if A[j] < a:
                        num = j + 1
                        A[j] = a
                        break

        if num == -1:
                A[color] = a
                color += 1

print(color)

### FIXED CODE ###

N = int(input())
A = [-1 for i in range(N)]

color = 1
A[0] = int(input())


def search(A, color, a):
        left = 0
        right = color - 1
        signal = 0
        while left < right:
                mid = (left + right) // 2
                if A[mid] == a - 1:
                        return mid
                        signal = 1
                elif a <= A[mid]:
                        left = mid + 1
                else:
                        right = mid
        if signal == 0:
                return left


for i in range(N - 1):
        
        a = int(input())
        num = search(A, color, a)
        if num == color - 1 and a <= A[num]:
                A[color] = a
                color += 1
        else:
                A[num] = a

print(color)
### BUGGY CODE ###

def examB():
    N = I()
    ansC = [(i+1) for i in range(N)]
    k = 0
    while(True):
        cur = []
        for i in ansC:
            if i % 2 == 0:
                cur.append(i // 2)
        ansC = cur
        k +=1
        if len(ansC)==1:
            break
    ans = 2**k
    print(ans)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()


### FIXED CODE ###

def examB():
    N = I()
    ansC = [(i+1) for i in range(N)]
    k = 0
    while(len(ansC)>=2):
        cur = []
        for i in ansC:
            if i % 2 == 0:
                cur.append(i // 2)
        ansC = cur
        k +=1
        if len(ansC)==1:
            break
    ans = 2**k
    print(ans)

import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()
### 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ずらして一個前のところに
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


### 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())
# N, K = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(N - 1)]

ans = [-1] * N
W = [[0 for __ in range(N)] for _ in range(N)]
P = [set() for _ in range(N)]
for l in L:
    u, v, w = l
    W[u - 1][v - 1] = w
    P[u - 1].add(v - 1)
    P[v - 1].add(u - 1)

ans[0] = 0
F = [0] * (N + 1)
it = 0
po = 1
already = {0}
for _ in range(N + 1):
    if it > po:
        break
    u = F[it]
    it += 1
    for v in (P[u] - already):
        w = W[u][v] if u < v else W[v][u]
        ans[v] = ans[u] if w % 2 == 0 else 1 - ans[u]
        F[po] = v
        already.add(v)
        po += 1

res = ""
for a in ans:
    res += "{}\n".format(a)
print(res)


### FIXED CODE ###

import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def f(N):
    res = 0
    while N != 0:
        b = format(N, "b").count("1")
        N %= b
        res += 1
    return res


def main():
    N = int(input())
    F = [[] for _ in range(N)]

    for _ in range(N - 1):
        u, v, w = read_values()
        u -= 1
        v -= 1
        F[u].append((v, w % 2))
        F[v].append((u, w % 2))

    D = [0] * N
    stack = [(0, 0, -1)]

    while stack:
        a, d, p = stack.pop()
        D[a] = d % 2

        for b, w in F[a]:
            if b == p:
                continue
            stack.append((b, (d + w) % 2, a))
    
    for d in D:
        print(d)


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

num_limit = int(input())
for i in range(1,num_limit+1):
    xyz_count = 0
    j_limit = int(i ** 0.5)
    for j in range(1,j_limit+1):
        if i <= j**2:
            break
        for k in range(1,j + 1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k > l:
                        xyz_count += 3
                    else:
                        xyz_count += 1
    print(xyz_count)

### FIXED CODE ###

num_limit = int(input())
num_list = [0] * num_limit
j_limit = int(num_limit ** 0.5)
for j in range(1,j_limit+1):
    for k in range(1,j + 1):
        for l in range(1,k+1):
            if num_limit >= j**2 + k**2 + l**2 + j*k + k*l + l*j:
                if j > k:
                    if k > l:
                        num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 6
                    else:
                        num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 3
                elif k > l:
                    num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 3
                else:
                    num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 1
for i in num_list:
    print(i)
### BUGGY CODE ###

a=int(input())
li = list(map(int,input().split()))
 
n=1
for i in li:
    n=n*i
 
if(n>1000000000000000000):
    print("-1")
else:
    print(n)

### FIXED CODE ###

a=int(input())
li = list(map(int,input().split()))
 
n=1
if(0 in li):
	print(0)
else:
	for i in li:
		n=n*i
		if(n>1000000000000000000):
			n=-1
			break
	print(n)
### BUGGY CODE ###

S = input()
S = S[::-1]

mod = 10**9 + 7

dp = [1] + [0]*12

for i, s in enumerate(S):
  if s == '?':
    R = [j*10**i % 13 for j in range(1, 10)]
    _dp = dp.copy()
    for r in R:
      dp = [(a1+a2)%mod for a1, a2 in zip(dp, _dp[-r:] + _dp[:-r])]
      
  else:
    s = int(s)
    r = s*10**i % 13
    dp = dp[-r:] + dp[:-r]

print(dp[5])

### FIXED CODE ###

S = input()
S = S[::-1]
N = len(S)

mod = 10**9 + 7

dp = [[1] + [0]*12] + [[0]*13 for i in range(N)]

digit = 1
for i, s in enumerate(S):
  if s == '?':
    R = [j*digit % 13 for j in range(10)]
    for j in range(13):
      for r in R:
        dp[i+1][(j+r)%13] = (dp[i+1][(j+r)%13] + dp[i][j]) % mod
      
  else:
    s = int(s)
    r = s*digit % 13
    dp[i+1] = dp[i][-r:] + dp[i][:-r]
  
  digit *= 10
  digit %= 13

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

def main():
    quantity, A, B = map(int, input().split())
    l = list(input())
    ans = []
    
    for i in range(quantity):
        if l[i] == 'a' and ans.count('Yes') < (A + B):
            ans.append('Yes')
            continue
        elif l[i] == 'b' and ans.count('Yes') < (A + B):
            check = 0
            for x in range(len(ans)):
                if ans[x] == 'Yes':
                    check = check + 1
            if check <= B:
                ans.append('Yes')
                continue
        ans.append('No')
    
    for y in ans:
        print(y)

main()

### FIXED CODE ###

def main():
    quantity, A, B = map(int, input().split())
    l = list(input())
    yes = 0
    abroad = 0

    for i in range(quantity):
        if l[i] == 'a':
            if yes < (A + B):
                print('Yes')
                yes = yes + 1
            else:
                print('No')
        
        if l[i] == 'b':
            abroad = abroad + 1
            if yes < (A + B) and abroad <= B:
                print('Yes')
                yes = yes + 1

            else:
                print('No')
        
        if l[i] == 'c':
            print('No')

main()
### BUGGY CODE ###

import copy
L = list(map(int, input().split())) # N, M, K=map(int,input().split())
N=L[0]
M=L[1]
K=L[2]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
P=[(0,0)]
R=[0]
c=0
while c!=N+M or Q!=[]:
    Q=[]
    S=[]
    c=c+1
    n=len(P)
    for i in range(n):
        a=P[i][0]
        b=P[i][1]
        if a<N and ((a+1,b) not in Q):
            C=R[i]+A[a]
            if C<=K:
                Q.append((a+1,b))
                S.append(C)
        if b<M  and ((a,b+1) not in Q):
            C=R[i]+B[b]
            if C<=K:
                Q.append((a,b+1))
                S.append(C)
    if Q!=[]:
        P=copy.copy(Q)
        R=copy.copy(S)
    else:
        c=c-1
        break
print(c)

### FIXED CODE ###

N, M, K=map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
LA = [0]
LB = [0]
for i in range(N):
    C=LA[i]+A[i]
    if C>K:
        N=i
        break
    else:
        LA.append(C)
for j in range(M):
    C=LB[j]+B[j]
    if C>K:
        M=j
        break
    else:
        LB.append(C)
r=N
for i in range(N+1):
    u=0
    for j in range(r-N+i,M+1):
        if LA[N-i]+LB[j]>K:
            r=max(r,N-i+j-1) # 最大のrを求めたいので結果をrefineする場合だけで回す
            u=1
            break
    if u==0:
        r=max(r,N-i+M)
        break
print(r)
### BUGGY CODE ###

def cnt(str):
    rtn = 1
    for i in range(1, len(str)):
        if str[i] == str[0]:
            rtn += 1
        else:
            break
    return rtn

S = input()
T = input()
q = int(input())
ans = []
for _ in range(q):
    a, b, c, d = map(int, input().split())
    si = S[a - 1: b]
    ti = T[c - 1: d]
    ls = len(si)
    for c in list(si):
        if c == ti[0]:
            ls += 1
    while 0 < len(ti):
        ls *= 2
        lt = cnt(ti)
        ti = ti[lt:]
        while ls <= lt:
            ls *= 4
        ls -= lt
    if ls % 3 == 0:
        ans.append('YES')
    else:
        ans.append('NO')

for yn in ans:
    print(yn)


### FIXED CODE ###

S = input()
T = input()
q = int(input())
ans = []

cnt = 0
sbs = [0]
for c in S:
    if c == 'B':
        cnt += 1
    sbs.append(cnt)
cnt = 0
tbs = [0]
for c in T:
    if c == 'B':
        cnt += 1
    tbs.append(cnt)

for _ in range(q):
    a, b, c, d = map(int, input().split())
    sb = sbs[b] - sbs[a - 1]
    tb = tbs[d] - tbs[c - 1]
    sa = (b - a) + sb
    if tb % 2 == 0:
        ta = (d - c - tb) + tb // 2
    else:
        ta = (d - c - tb) + (tb + 3) // 2
    if (sa - ta) % 3 == 0:
        ans.append('YES')
    else:
        ans.append('NO')

for yn in ans:
    print(yn)
### BUGGY CODE ###

n, m = list(map(int, input().split()))
results = []
if m:
    results = [input().split() for _ in range(m)]
ac = {}
wa = {}
cnt_ac = 0
cnt_wa = 0
for res in results:
    if res[1] == "AC" and not res[0] in ac.keys():
        cnt_ac += 1
        ac[res[0]] = "AC"
        if res[0] in wa.keys():
            cnt_wa += wa[res[0]]
    elif not res[0] in ac.keys():
        if res[0] in wa.keys():
            wa[res[0]] += 1
        else:
            wa[res[0]] = 1
print(cnt_ac, cnt_wa)

### FIXED CODE ###

N,M=map(int,input().split())
AC=[0]*N
WA=[0]*N
wa=0
for i in range(M):
  p,s=input().split()
  p=int(p)-1
  if AC[p]==0 and s=="AC":
  	AC[p]=1
  	wa+=WA[p]
  WA[p]+=1
print(sum(AC),wa)
### BUGGY CODE ###

N=int(input())
S=input()
minimum=3*pow(10, 5)
east=[]
for i in range(N):
    east.append([S[:i].count('E'), S[i+1:].count('E')])
for i in range(N):
    X=S[:i]
    Y=S[i+1:]
    candidate = len(X)-east[i][0]+east[i][1]
    minimum = min(candidate, minimum)
print(minimum)


### FIXED CODE ###

N=int(input())
S=input()
minimum=3*pow(10, 5)
east=[0]
for i in range(1,N+1):
    if S[i-1]=='E':
        east.append(east[i-1]+1)
    else:
        east.append(east[i-1])
for i in range(N):
    candidate = i-east[i]+(east[N]-east[i+1])
    minimum = min(candidate, minimum)
print(minimum)
### BUGGY CODE ###

N = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
C = [int(c) for c in input().split()]
ans = 0

for i in range(N):
  for j in range(N):
    for k in range(N):
      if A[i] < B[j] < C[k]:
        ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
A = sorted([int(a) for a in input().split()])
B = [int(b) for b in input().split()]
C = sorted([int(c) for c in input().split()])
ans = 0

import bisect
for i in range(N):
  b = B[i]
  end_A = bisect.bisect_left(A, b)
  start_C = bisect.bisect_right(C, b)
  ans += end_A * (N - start_C)

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

import sys

N = []
ns = sys.stdin.readlines()
for n in ns:
    N.append(int(n))
ml = max(N)
P = [2]
for x in range(2, ml+1):
    flag = True
    for d in P:
        flag = flag and (x % d != 0)
    if flag == True:
        P = P + [x]
for m in N:
    print(len([p for p in P if p<=m]))

### FIXED CODE ###

import sys
MAX = 1000000

A = tuple(range(2, MAX))
B = tuple()
while True:
    if (A[0])**2 > MAX:
        break
    B = B + (A[0],)
    A = tuple(x for x in A if x % A[0] != 0)
B = B + A

Lines = sys.stdin.readlines()
for line in Lines:
    print(len([x for x in B if x <= int(line)]))
### BUGGY CODE ###

r,g,b,n = map(int, input().split())
max_y = n//g
max_z = n//b

count = 0
for y in range(max_y + 1):
    for z in range(max_z + 1):
        x_before = n - g*y - b*z 
        if( (x_before % r == 0) and (x_before / r) >=0 ):
            count += 1
print(count)

### FIXED CODE ###

def counter(r,g,b,n):
    count = 0
    max_y = n//g
    max_z = n//b

    for y in range(max_y + 1):
        for z in range(max_z + 1):
            x_before = n - g*y - b*z
            if( (x_before / r) < 0 ):
                break
            if( (x_before % r == 0) ):
                count += 1
    return count

r,g,b,n = map(int, input().split())
print(counter(r,g,b,n))
### BUGGY CODE ###

N, K = map(int, input().split())
L = []
for _ in range(K):
  a, b = map(int, input().split())
  L.append((a,b))
L.sort()
DP = [0]*N
DP[0]=1
for i in range(1, N):
  for l in L:
    for j in range(l[0], l[1]+1):
      if i>=j: 
        DP[i] += DP[i-j]
        DP[i] %= 998244353
      else:
        break
    else:
      continue
    break
print(DP[-1])

### FIXED CODE ###

N, K = map(int, input().split())
L = []
for _ in range(K):
  a, b = map(int, input().split())
  L.append((a,b))
L.sort()
DP_1 = [0]*N
DP_2 = [0]*(N+1)
DP_1[0], DP_2[1] = 1, 1
mod = 998244353
for i in range(1, N):
  for l in L:
    if l[0]>i:
      break
    elif l[1]>i:
      DP_1[i] += DP_2[i-l[0]+1]
      DP_1[i] %= mod
    elif l[1]<=i:
      DP_1[i] += DP_2[i-l[0]+1]-DP_2[i-l[1]]
      DP_1[i] %= mod
  DP_2[i+1] = DP_2[i] + DP_1[i]
  DP_2[i+1] %= mod
print(DP_1[-1]%mod)
### BUGGY CODE ###

from fractions import gcd
from functools import reduce
MOD = 10**9+7
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)  

n = int(input())
aa = list(map(int,input().split()))
           
l = lcm(*aa)        
aal = [l//ai % MOD for ai in aa] 

print(sum(aal) % MOD)

### FIXED CODE ###

from fractions import gcd
from functools import reduce
MOD = 10**9+7
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)  

n = int(input())
aa = list(map(int,input().split()))
           
l = lcm(*aa)        
ans = 0
for ai in aa:
  ans += l//ai

print(ans % MOD)