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

N,K,L = map(int, input().split())


class UFT:
    def __init__(self, N):
        self.UFdata = [-1] * (N+1)
        self.rank   = [0]  * (N+1)
        self.connected_num = [1] * (N+1)

    def find(self,x):
        UFdata = self.UFdata
        while UFdata[x] != -1:
            x = UFdata[x]
        return x

    def unite(self,x,y):
        UFdata = self.UFdata
        rank = self.rank
        connected_num = self.connected_num
        find = self.find

        x = find(x)
        y = find(y)
        if x != y:
            if rank[x] < rank[y]:
                UFdata[x] = UFdata[y]
                x,y = y,x
            if rank[x] == rank[y]:
                rank[x] += 1
            UFdata[y] = x       
            connected_num[x] += connected_num[y]
            

UF1 = UFT(N)
UF2 = UFT(N)
ans = [1] * (N+1)
MAP= [ [0] * (N+1) for _ in range(N+1)]

for i in range(K):
    p,q = map(int, input().split())
    mn, mx = min(p,q), max(p,q)
    if UF1.find(p) != -1 and UF1.find(p) != UF1.find(q)  or UF1.find(p) == UF1.find(q) == -1:
        UF1.unite(p,q)

    

for i in range(L):
    p,q = map(int, input().split())
    mn, mx = min(p,q), max(p,q)

    if UF1.find(p) != -1 and UF1.find(p) == UF1.find(q) :
        UF2.unite(mn, mx)

ans = []
for i in range(1,N+1):
    ans.append (  UF2.connected_num[ UF2.find( i) ] )

# print(" ".join( map(lambda x: str(x), connected_num[1:])))
print(" ".join( map(lambda x: str(x), ans)))


### FIXED CODE ###

N,K,L = map(int, input().split())


class UFT:
    def __init__(self, N):
        self.UFdata = [-1] * (N+1)
        self.rank   = [0]  * (N+1)

    def find(self,x):
        UFdata = self.UFdata
        while UFdata[x] != -1:
            x = UFdata[x]
        return x

    def unite(self,x,y):
        UFdata = self.UFdata
        rank = self.rank 
        find = self.find

        x = find(x)
        y = find(y)
        if x != y:
            if rank[x] < rank[y]:
                x,y = y,x
            if rank[x] == rank[y]:
                rank[x] += 1
            UFdata[y] = x       
            

UF1 = UFT(N)
UF2 = UFT(N)
ans = [1] * (N+1)
# MAP= [ [0] * (N+1) for _ in range(N+1)]
import sys
input = sys.stdin.readline
#PQ = [ [int(j) for j in input().split()] for _ in range(K)]
#RS = [ [int(j) for j in input().split()] for _ in range(L)]

for i in range(K):
    p,q = map(int,input().split())
    UF1.unite(p,q)
for i in range(L):
    p,q = map(int,input().split())#RS[i]
    UF2.unite(p, q)
counter=[]
from collections import defaultdict
cntdic =defaultdict(int)
for i in range(1,N+1):
  counter.append(UF1.find(i)+UF2.find(i)*10**6)
  cntdic[counter[-1]]+=1 

ans = [0]*(N+1)
for i in range(1,N+1):
    ans[i] = cntdic[counter[i-1]]

del ans[0]
# print(" ".join( map(lambda x: str(x), connected_num[1:])))
print(" ".join( map(lambda x: str(x), ans)))
### BUGGY CODE ###

import sys
n = int(input())
print(0, flush=True)
s = input()
if s == "Vacant":
    sys.exit()
s = s[0]
l = 0
r = n
ls = s
rs = s

def nibun(l, r, m, ls, rs, s):
    if ((m-l) % 2 == 0 and ls == s) or\
        ((m-l) % 2 == 1 and ls != s):
        return 1
    else:
        return 0

for ii in range(21):
    m = (l+r)//2
    print(m, flush=True)
    s = input()
    if s == "Vacant":
        break
    s = s[0]
    if nibun(l, r, m, ls, rs, s) == 0:
        r = m
        rs = s
    else:
        l = m
        ls = s

    


### FIXED CODE ###

import sys
n = int(input())
print(0, flush=True)
s = input()
if s == "Vacant":
    sys.exit()
l = 0
r = n
ls = s
rs = s

def nibun(l, r, m, ls, rs, s):
    if ((m-l) % 2 == 0 and ls == s) or\
        ((m-l) % 2 == 1 and ls != s):
        return 1
    else:
        return 0

for ii in range(21):
    m = (l+r)//2
    print(m, flush=True)
    s = input()
    if s == "Vacant":
        break
    if nibun(l, r, m, ls, rs, s) == 0:
        r = m
        rs = s
    else:
        l = m
        ls = s
### BUGGY CODE ###

import math
n=int(input())
ans=0
for i in range(1,n+1):
	ans+=((math.floor(n/i)*(math.floor(n/i)+1))/2)*i
print(int(ans))

### FIXED CODE ###

import math
n=int(input())
ans=0
for i in range(1,n+1):
	x=math.floor(n/i)
	ans+=(x*(x+1)*i)/2
print(int(ans))
### BUGGY CODE ###

def main():
    N, K = input_ints()
    A = input_int_list_in_line()

    hyouten = 1

    for i in range(K):
        hyouten *= A[i]
    
    for i in range(N-K):
        new_hyouten = hyouten / A[i] * A[i+K]

        if hyouten < new_hyouten:
            print('Yes')
        else:
            print('No')
        
        hyouten = new_hyouten



def input_ints():
    line_list = input().split()

    if len(line_list) == 1:
        return int(line_list[0])
    else:
        return map(int, line_list)


def input_int_list_in_line():
    return list(map(int, input().split()))


def input_int_tuple_list(n: int):
    return [tuple(map(int, input().split())) for _ in range(n)]


main()


### FIXED CODE ###

def main():
    N, K = input_ints()
    A = input_int_list_in_line()

    for i in range(N-K):
        if A[i] < A[i+K]:
            print('Yes')
        else:
            print('No')


def input_ints():
    line_list = input().split()

    if len(line_list) == 1:
        return int(line_list[0])
    else:
        return map(int, line_list)


def input_int_list_in_line():
    return list(map(int, input().split()))


def input_int_tuple_list(n: int):
    return [tuple(map(int, input().split())) for _ in range(n)]


main()
### BUGGY CODE ###

from collections import deque

h, w = map(int, input().split())
ch, cw = map(int, input().split())
ch -= 1
cw -= 1
Dh, Dw = map(int, input().split())
Dh -= 1
Dw -= 1
s = []
for _ in range(h):
    s.append(list(input()))

def is_valid_point(ph, pw):
    if 0 <= ph < h and 0 <= pw < w and s[ph][pw] == '.':
        return True
    else:
        return False

dh = (1, 0, -1, 0)
dw = (0, 1, 0, -1)

inf = 10 ** 18
dist = [[inf] * w for _ in range(h)]
dist[ch][cw] = 0

q = deque([(ch, cw)])
while q:
    ph, pw = q.popleft()
    for k in range(4):
        nh, nw = ph + dh[k], pw + dw[k]
        if is_valid_point(nh, nw):
            if dist[ph][pw] < dist[nh][nw]:
                dist[nh][nw] = dist[ph][pw]
                q.appendleft((nh, nw))
    for nh in range(ph - 2, ph + 3):
        for nw in range(pw - 2, pw + 3):
            if is_valid_point(nh, nw):
                if dist[ph][pw] + 1 < dist[nh][nw]:
                    dist[nh][nw] = dist[ph][pw] + 1
                    q.append((nh, nw))

if dist[Dh][Dw] == inf:
    print(-1)
else:
    print(dist[Dh][Dw])


### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
ch, cw = map(int, input().split())
ch -= 1
cw -= 1
Dh, Dw = map(int, input().split())
Dh -= 1
Dw -= 1
s = []
for _ in range(h):
    s.append(list(input()))

def is_valid_point(ph, pw):
    if 0 <= ph < h and 0 <= pw < w and s[ph][pw] == '.':
        return True
    else:
        return False

dh = (1, 0, -1, 0)
dw = (0, 1, 0, -1)

inf = 10 ** 18
dist = [[inf] * w for _ in range(h)]
dist[ch][cw] = 0

q = deque([(ch, cw)])
while q:
    ph, pw = q.popleft()
    for k in range(4):
        nh, nw = ph + dh[k], pw + dw[k]
        if is_valid_point(nh, nw):
            if dist[ph][pw] < dist[nh][nw]:
                dist[nh][nw] = dist[ph][pw]
                q.appendleft((nh, nw))
    for nh in range(ph - 2, ph + 3):
        for nw in range(pw - 2, pw + 3):
            if is_valid_point(nh, nw):
                if dist[ph][pw] + 1 < dist[nh][nw]:
                    dist[nh][nw] = dist[ph][pw] + 1
                    q.append((nh, nw))

if dist[Dh][Dw] == inf:
    print(-1)
else:
    print(dist[Dh][Dw])
### BUGGY CODE ###

from functools import reduce
from fractions import gcd

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

def gcd_list(nums):
    return reduce(gcd, nums)

ans = -1

for i in range(N-1):
    g = gcd_list(A[:i] + A[i+1:])
    if g > ans:
        ans = g

g = gcd_list(A[:N-1])
if g > ans:
    ans = g

print(ans)


### FIXED CODE ###

def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

N = int(input())
A = list(map(int, input().split()))
divisors = sorted(make_divisors(A[0]) + make_divisors(A[1]), reverse=True)

ans = 0
for d in divisors:
    ok_cnt = 0
    for a in A:
        if a % d == 0:
            ok_cnt += 1
    if ok_cnt >= N-1:
        ans = d
        break
print(ans)
### BUGGY CODE ###

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

for i in range(K):
    B = [0] * N
    for j in range(N):
        l = max(0,j-A[j])
        r = j+A[j]+1
        B[l] += 1
        if r < N:
            B[r] -= 1
    for j in range(1, N):
        B[j] += B[j-1]

    A = B

    if sum(A) == N**2:
        break

print(*A)

### FIXED CODE ###

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

for i in range(K):
    B = [0] * N
    for j in range(N):
        l = max(0,j-A[j])
        r = j+A[j]+1
        B[l] += 1
        if r < N:
            B[r] -= 1
    for j in range(1, N):
        B[j] += B[j-1]

    A = B

    if sum(A) == N**2:
        break

print(*A)
### BUGGY CODE ###

'use strict'
import math
N, M = map(int, input().split())
goods_price_list = list(map(int, input().split()))

for i in range(M):
  max_index = goods_price_list.index(max(goods_price_list))
  goods_price_list[max_index] = math.floor(goods_price_list[max_index]/2)

print(sum(goods_price_list))

### FIXED CODE ###

'use strict'
import heapq

N, M = map(int, input().split())
goods_price_list = [-int(_) for _ in input().split()]

heapq.heapify(goods_price_list)

for i in range(M):
  heapq.heappush(goods_price_list, -((-heapq.heappop(goods_price_list) // 2)))

print(-sum(goods_price_list))
### BUGGY CODE ###

import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import deque

h,w = li()
a = [list(lc()) for _ in range(h)]

que = deque()

dist = [[-1]*w for _ in range(h)]

for i, ai in enumerate(a):
    for j, aij in enumerate(ai):
        if aij == "#":
            que.append((0, (i, j)))
            dist[i][j] = 0
        
drs = [0,1,0,-1]
dcs = [1,0,-1,0]

while que:
    cur, (r,c) = que.popleft()
    dist[r][c] = cur
    
    for dr, dc in zip(drs, dcs):
        if 0 <= r+dr < h and 0 <= c+dc < w:
            if dist[r+dr][c+dc] == -1:
                dist[r+dr][c+dc] = cur + 1
                que.append((cur+1, (r+dr, c+dc)))
                
ans = 0
for di in dist:
    for dij in di:
        ans = max(ans, dij)
print(ans)

### FIXED CODE ###

import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import deque

h,w = li()
a = [list(lc()) for _ in range(h)]

que = deque()

dist = [[-1]*w for _ in range(h)]

for i, ai in enumerate(a):
    for j, aij in enumerate(ai):
        if aij == "#":
            que.append((0, (i, j)))
            dist[i][j] = 0
        
drs = [0,1,0,-1]
dcs = [1,0,-1,0]

while que:
    cur, (r,c) = que.popleft()
    dist[r][c] = cur
    
    for dr, dc in zip(drs, dcs):
        if 0 <= r+dr < h and 0 <= c+dc < w:
            if dist[r+dr][c+dc] == -1:
                dist[r+dr][c+dc] = cur + 1
                que.append((cur+1, (r+dr, c+dc)))
                
ans = 0
for di in dist:
    for dij in di:
        ans = max(ans, dij)
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

# 整数の入力
a = int(input())
# スペース区切りの整数の入力
strs = input().split()

vilist = []
for i in range(a):
    vilist.append((int(strs[i]), i))
vilist = sorted(vilist, key=lambda vi: vi[0], reverse=True)

# dp[x][y]をx人を左から活性度順に並べて、y人を右から活性度順に並べた状態のスコア最大値とする
dp = []
for i in range(a + 1):
    ls = []
    for j in range(a + 1):
        ls.append(0)
    dp.append(ls)

# dp[i][j]を考える
for i in range(a+1):
    for j in range(a+1-i):
        # k = (i + j - 1)番目の人
        k = i + j - 1
        if i == 0 and j == 0:
            continue

        if j == 0 and i > 0:
            dp[i][0] = dp[i-1][0] + vilist[k][0] * abs(vilist[k][1] - i + 1)
        elif i == 0 and j > 0:
            dp[0][j] = dp[0][j-1] + vilist[k][0] * abs(a - j - vilist[k][1])
        else:
            # dp[i][j] = max(dp[i][j],
            #                dp[i-1][j] + vilist[k][0] * abs(vilist[k][1] - i + 1),
            #                dp[i][j-1] + vilist[k][0] * abs(a - j - vilist[k][1]))
            dp[i][j] = max(dp[i-1][j] + vilist[k][0] * abs(vilist[k][1] - i + 1),
                           dp[i][j-1] + vilist[k][0] * abs(a - j - vilist[k][1]))

max_v = 0
for x in dp:
    max_x = max(x)
    if max_v < max_x:
        max_v = max_x

print(max_v)

### FIXED CODE ###

# -*- coding: utf-8 -*-


def main():

    # 整数の入力
    a = int(input())
    # # スペース区切りの整数の入力
    nums = list(map(int, input().split()))

    vilist = []
    for i in range(a):
        vilist.append((nums[i], i))
    vilist = sorted(vilist, key=lambda vi: vi[0])

    # dp[x][y]をx人を左から活性度順に並べて、y人を右から活性度順に並べた状態のスコア最大値とする
    dp = []
    for i in range(a):
        dp.append([0]*(a-i))

    # dp = [[0] * a for i in range(a)]

    # cnt = 0
    # dp[i][j]を考える
    for k in range(a-1):
        vi = vilist.pop()
        v = vi[0]
        p = vi[1]
        vi_z = vilist[0]
        vz = vi_z[0]
        pz = vi_z[1]

        for i in range(k + 2):
            # cnt += 1
            j = k - i + 1
            # if i == 0 and j == 0:
            #     continue

            # 最後の値は場所が特定できるのでそのまま計算させる
            if k == a - 2:
                if j == 0:
                    dp[i][0] = dp[i-1][0] + v * abs(p - i + 1) + vz * abs(pz - i)
                elif i == 0:
                    dp[0][j] = dp[0][j-1] + v * abs(a - j - p) + vz * abs(a - j - 1 - pz)
                else:
                    dp[i][j] = max(dp[i-1][j] + v * abs(p - i + 1) + vz * abs(pz - i),
                                   dp[i][j-1] + v * abs(a - j - p) + vz * abs(pz - i))
            else:
                if j == 0:
                    dp[i][0] = dp[i-1][0] + v * abs(p - i + 1)
                elif i == 0:
                    dp[0][j] = dp[0][j-1] + v * abs(a - j - p)
                else:
                    dp[i][j] = max(dp[i-1][j] + v * abs(p - i + 1),
                                   dp[i][j-1] + v * abs(a - j - p))

    # print(cnt)
    print(max([max(x) for x in dp]))


main()
### BUGGY CODE ###

n, q = map(int, input().split())
s = input()
l = [0]*q; r = [0]*q

for i in range(q):
    l[i], r[i] = map(int, input().split())

cum = [0]*n
for i in range(n-1):
    if s[i] == 'A' and s[i+1] == 'C':
        cum[i] = 1

for i in range(q):
    print(sum(cum[l[i]-1:r[i]-1]))



### FIXED CODE ###

n, q = map(int, input().split())
s = input()
t = [0]*(n+1)

for i in range(n):
	t[i+1] = t[i] + (1 if s[i:i+2]=='AC' else 0)

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

N, K = map(int, input().split())
p = input().split()
p = [((int(i)+1)/2) for i in p]
SUM_P = 0
for i in range(N-K+1):
    cand = sum(p[i:i+K])
    if  SUM_P < cand:
        SUM_P = cand
    else:
        pass
print(SUM_P)

### FIXED CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
SUM_P=sum(p[0:K])
all_sum_p=[SUM_P]
for i in range(N-K):
    SUM_P=SUM_P-p[i]+p[i+K]
    all_sum_p.append(SUM_P)
print((max(all_sum_p)+K)/2)
### BUGGY CODE ###

N, K, Q = list(map(int, input().split()))
A = []
for a in range(Q):
    A.append(int(input()))

points = [K for x in range(N)]
for i in A:
    points = list(map(lambda x: x-1, points))
    points[i-1] += 1

for point in points:
    if point <= 0:
        print('No')
    else:
        print('Yes')

### FIXED CODE ###

N, K, Q = list(map(int, input().split()))
points = [K for x in range(N)]
points = list(map(lambda x: x-Q, points))
for i in range(Q):
    s = int(input())
    points[s-1] += 1

for point in points:
    if point <= 0:
        print('No')
    else:
        print('Yes')
### BUGGY CODE ###

import sys
x=int(input())
a=0
while True:
  for i in range(-64,64):
    if a**5-i**5==x:
      print(a,i)
      sys.exit()
  a+=1

### FIXED CODE ###

import sys
x=int(input())
a=0
while True:
  for i in range(-64,a):
    if a**5-i**5==x:
      print(a,i)
      sys.exit()
  a+=1
### BUGGY CODE ###

def washall_floyd(graph):
    num_v = len(graph)
    for k in range(num_v):
        for i in range(num_v):
            for j in range(num_v):
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])
    return graph


n, m, r = map(int, input().split())
r_list = list(map(int, input().split()))
graph = [[float("inf") for _ in range(n)] for _ in range(n)]
for i in range(m):
    a, b, c = map(int, input().split())
    graph[a - 1][b - 1] = c
    graph[b - 1][a - 1] = c

graph = washall_floyd(graph)
result = float("inf")
import itertools
permi = itertools.permutations(r_list)
for per in permi:
    r = 0
    start = per[0] - 1
    for p in per[1:]:
        end = p - 1
        r += graph[start][end]
        start = p - 1
    result = min(r, result)
print(result)


### FIXED CODE ###

def washall_floyd(graph):
    num_v = len(graph)
    for k in range(num_v):
        for i in range(num_v):
            for j in range(num_v):
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])
    return graph


n, m, r = map(int, input().split())
r_list = list(map(int, input().split()))
graph = [[float("inf") for _ in range(n)] for _ in range(n)]
for i in range(m):
    a, b, c = map(int, input().split())
    graph[a - 1][b - 1] = c
    graph[b - 1][a - 1] = c

graph = washall_floyd(graph)
result = float("inf")
import itertools
permi = itertools.permutations(r_list)
for per in permi:
    r = 0
    start = per[0] - 1
    for p in per[1:]:
        end = p - 1
        r += graph[start][end]
        start = p - 1
    result = min(r, result)
print(result)
### BUGGY CODE ###

N = int(input())
L = list(map(int, input().split()))
import itertools 
combi = itertools.combinations(L, 3)
wa = 0
for c in combi:
    l = list(c)
    m = max(l)
    l.remove(m)
    if(m < sum(l)):
        wa += 1   
print(wa)

### FIXED CODE ###

N = int(input())
L = list(map(int, input().split()))
L.sort()
wa = 0
import bisect
for i in range(N-1,1,-1):
    for j in range(i-1,0,-1):
        diff = L[i]-L[j]
        k = bisect.bisect_right(L, diff)
        wa += j-k if j-k > 0 else 0           
            
print(wa)
### BUGGY CODE ###

a, b, c, d = map(int, input().split())

cd = c * d
count = 0

a_d, a_m = divmod(a, cd)
b_d, b_m = divmod(b, cd)

left = cd * (a_d+1)
if left > b:
	left = b

for i in range(a, left):
	if i % c != 0 and i % d != 0:
		count += 1

right = cd * b_d

if right >= left + cd:
	count2 = 0
	for i in range(left, left + cd):
		if i % c != 0 and i % d != 0:
			count2 += 1
	
	count += count2 * (b_d - a_d - 1)
 
if right >= left:
	for i in range(right, b+1):
		if i % c != 0 and i % d != 0:
			count += 1
#print("{} {} {} {}".format(a, left, right, b))
print(count)

### FIXED CODE ###

import fractions as math

a, b, c, d = map(int, input().split())

a -= 1
cd = (c * d) // math.gcd(c, d)

a_d_c = a // c
b_d_c = b // c

a_d_d = a // d
b_d_d = b // d

a_d_cd = a // cd
b_d_cd = b // cd

b_d = b_d_c + b_d_d - b_d_cd
a_d = a_d_c + a_d_d - a_d_cd

ans =  b - b_d - a + a_d

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

n = int(input())
l = [int(input()) for _ in [0]*n]
#最大値が2つある場合に注意しないといけない。
#最大値が2つ以上ある場合を先に処理
import sys
if l.count(max(l))>1:
  for i in range(n):
    print(max(l))
#O(n)の処理なら何回やってもいいくらいの気持ちでいく
else:
  s=set(l)
  m1 = max(s)
  s.remove(max(s))
  m2 = max(s)
  for i in l:
    if i == m1:
      print(m2)
    else:
      print(m1)

### FIXED CODE ###

n = int(input())
numlist = []
for i in range(n):
    numlist.append(int(input()))
argmax = numlist.index(max(numlist))
maxnum = max(numlist)
del numlist[argmax]
secondnum = max(numlist)
                       
for i in range(argmax):
    print (maxnum)
print (secondnum)
for i in range(argmax+1,n):
    print (maxnum)
### BUGGY CODE ###

import sys; readline = sys.stdin.readline
from collections import deque
sys.setrecursionlimit(1000000)

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

P = 10 ** 9 + 7

def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        r = a % b
        a, b = b, r
    
    return b

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


def q_lcm(q, a):
    for k in q:
        a = a // gcd(k, a)
        if a == 1:
            return a
    return a

q = deque()

q.append(1)

for a in A:
    x = q_lcm(q, a)
    if x != 1:
        q.append(x)

_lcm = 1
for x in q:
    _lcm = _lcm * x % P

def mod_mult(a, N):
    if N == 0:
        return 1
    if N % 2 == 0:
        x = mod_mult(a, N // 2)
        return x * x % P
    else:
        x = mod_mult(a, N // 2)
        return x * x * a % P

def mod_s(a, b):
    b_inv = mod_mult(b, P - 2)
    return a * b_inv % P

total = 0

for a in A:
    _s = mod_s(_lcm, a)
    total += _s
    total %= P

print(total)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
 
 
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
 
 
def lcm(a, b):
    return a * b // gcd(a, b)
 
 
tmp = A[0]
for i in range(1, N):
    tmp = lcm(tmp, A[i])
 
B = [0] * N
for i in range(N):
    B[i] = tmp // A[i]
 
print(sum(B) % mod)
### BUGGY CODE ###

import itertools

n = int(input())
A = list(map(int, input().split()))
ans = 0

for pair in itertools.combinations(A, 2):
    ans += (pair[0]*pair[1])
    ans %= 1000000007

print(ans)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
ans = 0
total = sum(A[1:])

for i in range(n-1):
    ans += A[i]*total
    total -= A[i+1]
    ans %= 1000000007

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


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


ansSet = set(A)
for i in range(1, N + 1):
    if i in ansSet:
        print(A.count(i))
    else:
        print(0)


### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))

C = Counter(A)


for i in range(1, N + 1):
    if i in C.keys():
        print(C[i])
    else:
        print(0)
### BUGGY CODE ###

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

n = int(input())
a = list(map(int, input().split()))
ans = []
for i in a:
    ans.append(i)
    ans.reverse()
ans = [str(i) for i in ans]
output = " ".join(ans)
print(output)


### FIXED CODE ###

import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce
import sys
sys.setrecursionlimit(4100000)

n = int(input())
a = list(map(int, input().split()))
ans = [-1] * (2 *10 ** 5 + 1)
left = False
right = False
if n % 2 == 0:
    left = True
else:
    right = True
start = n // 2
ans[start] = a[0]
for i in range(1, n):
    if left:
        ans[start - i] = a[i]
        start -= i
        left = False
        right = True
    else:
        ans[start + i] = a[i]
        start += i
        left = True
        right = False
for i in range(n):
    print(ans[i], " ", sep="", end="")