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

N,K = map(int,input().split(' '))
A = list(map(int,input().split(' ')))
sum_score = A[0]
for i in range(1,K):
    sum_score *= A[i]
cnt = 0
for k in range(K-1,N):
    prev_sum_score = int(sum_score)
    if k + 1 > N - 1:
        break
    sum_score /= A[cnt]
    sum_score *= A[k+1]
    cnt += 1
    if prev_sum_score >= int(sum_score):
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

N,K = map(int,input().split(' '))
A = list(map(int,input().split(' ')))
cnt = 0
for k in range(K,N):
    if A[k] > A[cnt]:
        print("Yes")
    else:
        print("No")
    cnt += 1
### BUGGY CODE ###

import fractions

K=200
sum=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            sum+=fractions.gcd(i,fractions.gcd(j,k))
print(sum)

### FIXED CODE ###

import math

K=int(input())
sum=0

for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      sum+=math.gcd(math.gcd(i,j),k)

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

def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n= int(arr_data[0][0])

arr=[int(arr_data[1][x]) for x in range(n)]

arr = [i for i in arr if i % 2==0]

cnt=0

#1つでも偶数が存在する場合　trueでループ処理対象
#奇数は処理対象外にしてもよい

while len(arr)>0:
    
    if any(x % 4 == 0 for x in arr):

        val=max(list(filter(lambda x : x%4 ==0, arr)))        
        idx=arr.index(val)

        #奇数は計算しなくて良い計算するだけ無駄
        arr=[x*3 for x in arr]
        arr[idx]//=6
    
    elif any(x % 2 == 0 for x in arr):
    
        val=max(list(filter(lambda x : x%2 ==0, arr)))        
        idx=arr.index(val)
        
        #奇数は計算しなくて良い計算するだけ無駄
        arr=[x*3 for x in arr]
        arr[idx]//=6

    arr = [i for i in arr if i % 2==0]
    cnt+=1

print(cnt)

### FIXED CODE ###

def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n= int(arr_data[0][0])

arr=[int(arr_data[1][x]) for x in range(n)]
arr01 = [x for x in arr if x % 4 ==0] 
arr02 = [x for x in arr if x % 4 !=0 and x % 2==0] 

cnt=0
if len(arr)>0:

    for i in arr01:

        while i % 2==0:

            i//=2
        
            cnt+=1
    
    cnt+=len(arr02)
   
print(cnt)
### BUGGY CODE ###

N, M, R = [int(_) for _ in input().split()]
r = [int(_) - 1 for _ in input().split()]

from collections import defaultdict
from itertools import permutations

INF = 10**10

D = [[INF] * N for _ in range(N)]

for i in range(M):
    a, b, c = [int(_) for _ in input().split()]
    D[a-1][b-1] = c
    D[b-1][a-1] = c

result = INF

# warshall_floyd
for i in range(N):
    for j in range(N):
        for k in range(N):
            D[j][k] = min(D[j][k], D[j][i] + D[i][k])

for xs in permutations(r):
    r = 0
    for i in range(R - 1):
        st, ed = xs[i], xs[i + 1]
        r += D[st][ed]
    result = min(result, r)

print(result)


### FIXED CODE ###

N, M, R = [int(_) for _ in input().split()]
r = [int(_) - 1 for _ in input().split()]

from collections import defaultdict
from itertools import permutations

INF = 10**10

D = [[INF] * N for _ in range(N)]

for i in range(M):
    a, b, c = [int(_) for _ in input().split()]
    D[a-1][b-1] = c
    D[b-1][a-1] = c

result = INF

# warshall_floyd
for i in range(N):
    for j in range(N):
        for k in range(N):
            D[j][k] = min(D[j][k], D[j][i] + D[i][k])

for xs in permutations(r):
    r = 0
    for i in range(R - 1):
        st, ed = xs[i], xs[i + 1]
        r += D[st][ed]
    result = min(result, r)

print(result)
### BUGGY CODE ###

n =int(input())
A = {0}
for i in range(n):
  a = {int(input())}
  if i==0:
    A = A|a
  else:
    A = A^a
print(len(A)-1)


### FIXED CODE ###

n =int(input())
A = set()
for i in range(n):
  A ^= {int(input())}
print(len(A))
### BUGGY CODE ###

N, Q = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)

ans = [0]*N

for i in range(Q):
    p, x = map(int, input().split())
    ans[p-1] += x
    queue = [p-1]
    while queue:
        par = queue.pop(0)
        if G[par]:
            for i in G[par]:
                ans[i] += x
                queue.append(i)

print(*ans)


### FIXED CODE ###

N, Q = map(int, input().split())
G = [[] for _ in range(N)]
ans = [0]*N

for _ in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

for _ in range(Q):
    p, x = map(int, input().split())
    ans[p-1] += x

judge = [False]*N
judge[0] = True
queue = [0]
while queue:
    a = queue.pop()
    for i in G[a]:
        if not judge[i]:
            judge[i] = True
            ans[i] += ans[a]
            if G[i]:
                queue.append(i)

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

from collections import deque
N, X, Y = map(int, input().split())
X-=1;Y-=1
d = [[] for _ in range(N)]
for i in range(N):
  if i == 0:
    d[i].append(i+1)
  elif i == N-1:
    d[i].append(i-1)
  else:
    d[i].append(i+1)
    d[i].append(i-1)
  if i == X:
    d[i].append(Y)
  elif i == Y:
    d[i].append(X)
#print(d)
INF = float("inf")
ans = [0 for _ in range(N)]
for i in range(N):
  reach = [INF for _ in range(N)]
  reach[i] = 0
  Q = deque([])
  Q.append(i)
  while Q:
    v = Q.popleft()
    for u in d[v]: #vから行ける地点を調べる。
      if reach[u] != INF:
        continue
      reach[u] = reach[v] + 1
      ans[reach[u]] += 1
      Q.append(u)

for i in range(1,N):
  temp = ans[i]//2
  print(temp)
      

### FIXED CODE ###

n, x, y = map(int, input().split())

ans = {}
for i in range(n-1):
  ans[i+1] = 0
  
for i in range(n):
  for j in range(i+1,n):
    if i <= x-1:
      if j <= x-1:
      	t=j-i
      	ans[t] += 1
      elif j <= y-1:
      	t = min(j-i, (x-1)-i + 1 + (y-1) -j)
      	ans[t] += 1
      else: #j > y-1
      	t = (x-1)-i + 1 + j -(y-1)
      	ans[t] += 1
    elif i < y-1:
      if j < y-1:
      	t = min(j-i, i-(x-1) + 1 + (y-1) -j)
      	ans[t] += 1
      else: #j >= y-1:
      	t = min(j-i, i-(x-1) + 1 + j - (y-1))
      	ans[t] += 1
    elif i >= y-1:
      t=j-i
      ans[t] += 1
    else:
      print("error")

for i in range(1,n):
  print(ans[i])
### BUGGY CODE ###

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

pre = [[] for _ in range(n)]
p = []

for i in range(m):
    p.append(list(map(int, input().split())))
    pre[p[i][0] - 1].append(p[i][1])

for i in range(m):
    pref = "{:0>6}".format(p[i][0])

    years = pre[p[i][0] - 1]
    years.sort()

    y = years.index(p[i][1]) + 1
    year = "{:0>6}".format(y)
    print(pref + year)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n, m = map(int, input().split())
p = [list(map(int, input().split()+[i])) for i in range(m)]

p.sort()
cnt = 0
pre = -1

for city in p:
    if city[0] == pre:
        cnt = cnt + 1
    else:
        pre = city[0]
        cnt = 1

    city.append("{:0>6}{:0>6}".format(city[0], cnt))

p.sort(key = lambda x: x[2])

for city in p:
    print(city[3])
### BUGGY CODE ###

R, G, B, N = map(int, input().split())

ans = 0
for r in range(0, N+1):
    balls = R*r
    if N < balls:
        break
    for g in range(0, N+1):
        balls = R*r + G*g
        if N < balls:
            break
        left = N - balls
        if left % B == 0:
            ans += 1

print(ans)


### FIXED CODE ###

R, G, B, N = map(int, input().split())

ans = 0
rsum = 0
for r in range(0, N+1):
    if N < rsum:
        break
    rgsum = rsum
    for g in range(0, N+1):
        if N < rgsum:
            break
        left = N - rgsum
        if left % B == 0:
            ans += 1
        rgsum += G
    rsum += R

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

import sys
from operator import itemgetter

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

if __name__ == "__main__":
    n = int(input())
    l = [list(map(int, input().split())) for i in range(n)]
    limits = set([ e[1] for e in l])

    is_possible = True
    for e in limits:
        if sum([i[0] for i in l if i[1] <= e]) > e:
            is_possible = False
            break

    print("Yes" if is_possible else "No")


### FIXED CODE ###

import sys
from operator import itemgetter

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

if __name__ == "__main__":
    n = int(input())
    l = [list(map(int, input().split())) for i in range(n)]
    l.sort(key=itemgetter(1))

    is_possible = True
    sum = 0
    for e in l:
        sum += e[0]
        if sum > e[1]:
            is_possible = False
            break

    print("Yes" if is_possible else "No")
### BUGGY CODE ###

INFTY = 10**12
def wf(H):
    d = [[INFTY for _ in range(N+1)] for _ in range(N+1)]
    for i in range(1,N+1):
        d[i][i] = 0
        if i in H:
            for x in H[i]:
                j,c = x[0],x[1]
                d[i][j] = c
    for k in range(1,N+1):
        for i in range(1,N+1):
            for j in range(1,N+1):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])
    return d
N,M,L = map(int,input().split())
G = {}
for _ in range(M):
    A,B,C = map(int,input().split())
    if A not in G:
        G[A] = []
    G[A].append((B,C))
    if B not in G:
        G[B] = []
    G[B].append((A,C))
d1 = wf(G)
F = {}
for i in range(1,N):
    for j in range(i+1,N+1):
        if d1[i][j]<=L:
            if i not in F:
                F[i] = []
            F[i].append((j,1))
            if j not in F:
                F[j] = []
            F[j].append((i,1))
d2 = wf(F)
Q = int(input())
for _ in range(Q):
    s,t = map(int,input().split())
    if d2[s][t]<INFTY:
        print(d2[s][t]-1)
    else:
        print(-1)


### FIXED CODE ###

INFTY = 10**12
def wf(H):
    d = [[INFTY for _ in range(N+1)] for _ in range(N+1)]
    for i in range(1,N+1):
        d[i][i] = 0
        if i in H:
            for x in H[i]:
                j,c = x[0],x[1]
                d[i][j] = c
    for k in range(1,N+1):
        for i in range(1,N+1):
            for j in range(1,N+1):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])
    return d
N,M,L = map(int,input().split())
G = {}
for _ in range(M):
    A,B,C = map(int,input().split())
    if A not in G:
        G[A] = []
    G[A].append((B,C))
    if B not in G:
        G[B] = []
    G[B].append((A,C))
d1 = wf(G)
F = {}
for i in range(1,N):
    for j in range(i+1,N+1):
        if d1[i][j]<=L:
            if i not in F:
                F[i] = []
            F[i].append((j,1))
            if j not in F:
                F[j] = []
            F[j].append((i,1))
d2 = wf(F)
Q = int(input())
for _ in range(Q):
    s,t = map(int,input().split())
    if d2[s][t]<INFTY:
        print(d2[s][t]-1)
    else:
        print(-1)
### BUGGY CODE ###

x = int(input())

def pcheck(n):
    for i in range(2, n):
        if n % i == 0:
            return True
    return False
while True:
    if pcheck(x) == True:
        a = x
    else:
        x += 1

print(a)


### FIXED CODE ###

x = int(input())

def pcheck(n):
    for i in range(2, n):
        if n % i == 0:
            return True
    return False
while True:
    if pcheck(x) == False:
        a = x
        break
    else:
        x += 1

print(a)
### BUGGY CODE ###

N=int(input())
"""
A*B+C=N
N-C=A*B

AB+C=Nの組み合わせは、N-1通り

"""
def factorization(n):
    def factor_sub(n, m):
        c = 0
        while n % m == 0:
            c += 1
            n /= m
        return c, n
    #
    buff = []
    c, m = factor_sub(n, 2)
    if c > 0: buff.append((2, c))
    c, m = factor_sub(m, 3)
    if c > 0: buff.append((3, c))
    x = 5
    while m >= x * x:
        c, m = factor_sub(m, x)
        if c > 0: buff.append((x, c))
        if x % 6 == 5:
            x += 2
        else:
            x += 4
    if m > 1: buff.append((m, 1))
    return buff
def divisor_num(n):
    a = 1
    for _, x in factorization(n):
        a *= x + 1
    return a

ans=0

for c in range(1,N):
    ab=divisor_num(N-c)
    ans+=(ab//2)*2+ab%2
print(ans)

### FIXED CODE ###

N=int(input())
#約数の個数メモ化

"""
A*B+C=N
N-C=A*B
AB+C=Nの組み合わせは、N-1通り
NlogNは
"""
ans=0
# 約数の個数を一斉取得
def getNumsOfDivisorsOfEachNumbers(n: int):
    # validation check
    if not isinstance(n, int):
        raise("[ERROR] parameter must be integer")
    if n < 0:
        raise("[ERROR] parameter must be not less than 0 (n >= 0)")
    nums = [0] * (n + 1) # 0-indexed
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            nums[j] += 1
    nums.pop(0)
    return nums


# 約数の個数を一斉取得
all_=getNumsOfDivisorsOfEachNumbers(N-1)
#c=1のとき、all_[N-1](N-1の約数)を見ればいい
for i in range(1,N):
    c=N-i
    ans+=(all_[i-1]//2)*2+all_[i-1]%2
print(ans)
### BUGGY CODE ###

f=input
n,s,q=int(f()),list(f()),int(f())
L=[[]*n for i in range(26)]
for i in range(n):
  L[ord(s[i])-97]+=[i]
from bisect import *
for i in range(q):
  a,b,c=input().split(); b=int(b)-1
  if a=='1':
    l=L[ord(s[b])-97]
    l.pop(bisect(l,b)-1)
    s[b]=c
    insort(L[ord(c)-97],b)
  else:
    t=0
    for l in L:
      m=bisect(l,b-1)
      if m<len(l) and l[m]<int(c): t+=1
    print(t)

### FIXED CODE ###

n=int(input())
l=list(input())
q=int(input())
bit=[[0]*(n+1) for i in range(26)]
def bit_sum(o,i):
  s=0
  while i:
    s+=bit[o][i]
    i-=i&-i
  return s
def bit_add(o,i,x):
  while i<=n:
    bit[o][i] += x
    i+=i&-i
for i in range(n):
  bit_add(ord(l[i])-97,i+1,1)
for i in range(q):
  a,b,c=input().split()
  b=int(b)-1
  if a=='1':
    bit_add(ord(l[b])-97,b+1,-1)
    l[b]=c
    bit_add(ord(c)-97,b+1,1)
  else:
    c=int(c)
    print(sum(1 for o in range(26) if bit_sum(o,c)-bit_sum(o,b)))
### BUGGY CODE ###

import itertools
K,S = map(int,input().split())
c = 0
for i in itertools.product(range(K+1), repeat=3):
  if sum(i) == S:
    c += 1
print(c)

### FIXED CODE ###

K,S = map(int,input().split())
c = 0
for i in range(K+1):
  for j in range(K+1):
      if 0 <= S-(i+j) <= K:
        c += 1
print(c)
### BUGGY CODE ###

import numpy as np
q = int(input())


p_max = 10**5+1
m = np.zeros(p_max, dtype=int)
for i in range(2, p_max):
    m[::i] += 1
# print(m)
ans = []
for _ in range(q):
    cnt = 0
    l, r = map(int, input().split())
    for i in range(l, r+1, 2):
        if m[i] == 1 and m[(i+1)//2] == 1:
            cnt += 1
    ans.append(cnt)


for i in range(q):
    print(ans[i])

### FIXED CODE ###

n_max = 10 ** 5 + 10
sieve = [0, 0] + [1]*n_max
m = 2
while m * m <= n_max:
    if sieve[m]:
        for n in range(2*m, n_max, m):
            sieve[n] = 0
    m += 1

ok = [0]*n_max
cums = [0]
for n in range(n_max):
    if sieve[n] and sieve[(n+1)//2]:
        ok[n] = 1
    cums.append(cums[-1]+ok[n])

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(cums[r+1]-cums[l])
### BUGGY CODE ###

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

print([x+y+z for z in range(k+1) for y in range(k+1) for x in range(k+1)].count(s))
            

### FIXED CODE ###

k,s = map(int, input().split())
print(len([s-y-z for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k]))
### BUGGY CODE ###

s = input()
k = int(input())

a = list(s)
a = [ord(i) for i in a]
b = sorted(a)
m = b[0]
n = 0
c = []
INF = 97+26
while True:
    a1 = [i for i in range(len(s)) if a[i] == m]

    for i in a1:
        j = 0
        while i+j < len(s) or j < k:
            if s[i:i+j+1] not in c:
                c.append(s[i:i+j+1])
            j += 1
    if len(c) >= k:
        break
    while b[n] == m:
        n += 1
    m = b[n]
c.sort()
print(c[k-1])


### FIXED CODE ###

s = input()
k = int(input())

a = list(s)
a = [ord(i) for i in a]
b = sorted(set(a))
c = []
INF = 97+26
for m in b:
    a1 = [i for i in range(len(s)) if a[i] == m]

    for i in a1:
        j = 0
        for j in range(k):
            if s[i:i+j+1] not in c:
                c.append(s[i:i+j+1])
                c.sort()
            if len(c) > 5:
                del c[-1]
            j += 1
            if i + j >= len(s):
                break
    if len(c) >= k:
        break

print(c[k-1])
### BUGGY CODE ###

'''
Created on 2020/09/15

@author: harurun
'''
import sys
pin=sys.stdin.readline


N,W=map(int,pin().split())
dp=[[0]*(W+1) for _ in [0]*(N+1)]

for i in range(1,N+1):
  w,v=pin().split()
  w=int(w)
  v=int(v)
  for j in range(W+1):
    if j-w>=0:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
    else:
      dp[i][j]=dp[i-1][j]
print(dp[N][W])
#解説AC

### FIXED CODE ###

'''
Created on 2020/09/15

@author: harurun
'''
import sys
pin=sys.stdin.readline


N,W=map(int,pin().split())
dp=[[0]*(W+1) for _ in [0]*(N+1)]

for i in range(1,N+1):
  w,v=pin().split()
  w=int(w)
  v=int(v)
  for j in range(W+1):
    if j-w>=0:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
    else:
      dp[i][j]=dp[i-1][j]
print(dp[N][W])
#解説AC
### BUGGY CODE ###

n=int(input())

d=[0]*(n+1)

for i in range(1,n+1):
    for j in range(i,n+1):
        if j%i==0:
            d[j]+=1
ans=0
for j in range(n+1):
    ans+=j*d[j]
print(ans)

### FIXED CODE ###

n=int(input())

def sum_k(n):
    return n*(n+1)//2

ans=0
for i in range(1,n+1):
    ans+=i*sum_k(n//i)

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

import sys
input = sys.stdin.readline

n, k, q = [int(w) for w in input().split()]

score = [k] * n

for i in range(q):
    a = int(input())
    score = [w - 1 for w in score]
    score[a - 1] += 1

for s in score:
    cond = s > 0
    print("Yes" if cond else "No")


### FIXED CODE ###

import sys
input = sys.stdin.readline

n, k, q = [int(w) for w in input().split()]


score = [0] * n

for i in range(q):
    a = int(input())
    score[a - 1] += 1


for s in score:
    print('Yes' if s + k - q > 0 else 'No')
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))
#from collections import deque

N, K = mi()
D = li()

r = [i for i in range(10) if i not in D]

if r[0]==0:
    #que = deque(r[1:])
    que = r[1:]
else:
    #que = deque(r)
    que = r

i = 0
while True:
    for num in r:
        new = que[i]*10 + num
        que.append(new)
    if que[-1] >= 10**6:
        break
    i += 1

ind = bisect.bisect_left(que, N)
#print(que)
#print(ind)
print(que[ind])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))
from collections import deque

N, K = mi()
D = li()

r = [i for i in range(10) if i not in D]

if r[0]==0:
    que = deque(r[1:])
else:
    que = deque(r)

i = 0
while True:
    for num in r:
        new = que[i]*10 + num
        que.append(new)
    if que[-1] >= 10**6:
        break
    i += 1

ind = bisect.bisect_left(que, N)
#print(que)
#print(ind)
print(que[ind])
### BUGGY CODE ###

N,K = map(int,input().split())
P_list = tuple(map(int,input().split()))
C_list = tuple(map(int,input().split()))

max_sum=-10**9
for i in range(N):
    m_sum=0
    k=i
    for j in range(K):
        m_sum += C_list[k]
        if m_sum > max_sum:
            max_sum=m_sum
        k=P_list[k]-1
print(max_sum)

### FIXED CODE ###

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

ans=-10**18
for i in range(n):
    start,count=i,1
    val=c[start]
    while p[start]-1 != i:
        start = p[start]-1
        count += 1
        val += c[start]
    start = i
    if val > 0:
        a = (k//count-1)*val
        ans=max(a,ans)
        num=count+k%count
    else:
        a=0
        num=min(k,count)
    for _ in range(num):
        a += c[start]
        start=p[start]-1
        ans=max(a,ans)
print(ans)
### BUGGY CODE ###

import unittest
import functools


class TestE(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think([2, 3, 4]), 13)

    def test_2(self):
        self.assertEqual(think([12, 12, 12, 12, 12]), 5)

    def test_3(self):
        self.assertEqual(think([1000000, 999999, 999998]), 996989508)

    def test_4(self):
        self.assertEqual(gcd(3, 2), 1)


def solve():
    a = read()
    result = think(a)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a):
    mode = 10 ** 9 + 7

    lcm_of_all_a = 1
    for e in a:
        lcm_of_all_a = lcm(lcm_of_all_a, e)

    result = 0
    for e in a:
        result += lcm_of_all_a * inverse(e, mode)
        result %= mode
    return result


def write(result):
    print(result)


def lcm(a, b):
    return (a * b) // gcd(a, b)


def gcd(a, b):
    if a < b:
        return gcd(b, a)

    while True:
        if a % b == 0:
            return b
        a, b = b, a % b


def inverse(x, mode):
    return pow(x, mode - 2, mode)


if __name__ == '__main__':
    # unittest.main()
    solve()

### FIXED CODE ###

import unittest
import functools


class TestE(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think([2, 3, 4]), 13)

    def test_2(self):
        self.assertEqual(think([12, 12, 12, 12, 12]), 5)

    def test_3(self):
        self.assertEqual(think([1000000, 999999, 999998]), 996989508)

    def test_4(self):
        self.assertEqual(gcd(3, 2), 1)


def solve():
    a = read()
    result = think(a)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a):
    mode = 10 ** 9 + 7

    lcm_of_all_a = 1
    for e in a:
        lcm_of_all_a = lcm(lcm_of_all_a, e)

    lcm_of_all_a %= mode
    result = 0
    for e in a:
        result += lcm_of_all_a * inverse(e, mode) % mode
        result %= mode
    return result


def write(result):
    print(result)


def lcm(a, b):
    return a // gcd(a, b) * b 


def gcd(a, b):
    if a < b:
        return gcd(b, a)

    while True:
        if a % b == 0:
            return b
        a, b = b, a % b


def inverse(x, mode):
    return pow(x, mode - 2, mode)


if __name__ == '__main__':
    # unittest.main()
    solve()