Harryxun/stf_run huggingface dataset:
import sys
H, W, M = map(int, input().split())
lis =[]
Hlis = [0]*H
Mlis = [0]*M
for _ in range(M):
    Ch, Cm = map(int, input().split())
    Hlis[Ch-1] += 1
    Mlis[Cm-1] += 1
    lis.append([Ch, Cm])

Hmax = max(Hlis)
Hidx = [i+1 for i, v in enumerate(Hlis) if v == Hmax]
Mmax = max(Mlis)
Midx = [i+1 for i, v in enumerate(Mlis) if v == Mmax]

for i in range(len(Hidx)):
    for j in range(len(Midx)):
        if [[Hidx, Midx]] not in lis:
            print(Hmax+Mmax)
            sys.exit()
else:
    print(Hmax + Mmax -1)

### FIXED CODE ###

import sys
H, W, M = map(int, input().split())
lis =set()
Hlis = [0]*H
Wlis = [0]*W
for _ in range(M):
    Ch, Cm = map(int, input().split())
    Hlis[Ch-1] += 1
    Wlis[Cm-1] += 1
    lis.add((Ch, Cm))

Hmax = max(Hlis)
Hidx = [i+1 for i, v in enumerate(Hlis) if v == Hmax]
Wmax = max(Wlis)
Widx = [i+1 for i, v in enumerate(Wlis) if v == Wmax]

for i in range(len(Hidx)):
    for j in range(len(Widx)):
        if (Hidx[i], Widx[j]) not in lis:
            print(Hmax+Wmax)
            sys.exit()
else:
    print(Hmax + Wmax -1)
def search(ans, s, ar, si = 0, ari = 0):
    if si+ari == n:
        if not(ari == 0) and not(si == 0):
            ans.append(abs(sum(s)-sum(ar)))
        return

    s.append(a[si+ari])
    search(ans,s,ar,si+1,ari)
    s.pop()

    ar.append(a[si+ari])
    search(ans,s,ar,si,ari+1)
    ar.pop()

n = int(input())
a = list(map(int,input().split()))
ans = []
s = []
ar = []
search(ans,s,ar)
print(min(ans))


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
s = sum(a)
ans = float("inf")
x = 0

for i in range(n-1):
    x += a[i]
    ans = min(ans,abs(s-2*x))

print(ans)
L,R,d = (input().split())
count = 0
for i range(L,R+1):
  if i%d==0:
    count = count + 1
print("count")

### FIXED CODE ###

L,R,d = (input().split())
L = int(L)
R = int(R)
d = int(d)
count = 0
for i in range(L,R+1):
  if i%d==0:
    count = count + 1
print(count)
print(sum(c is d for c, d in input(), input()))

### FIXED CODE ###

s,t=input(),input()
print(sum(c is d for c,d in zip(s,t)))
a, b = map(int, input().split())

print(((b-a)+1)*(b-a)//2-b)


### FIXED CODE ###

n = int(input())

if n <= 999:
    print("ABC")
else:
    print("ABD")
N =int(input())
S =N
count = 1
t = 13
for i in range(t):
    if S > 26**(t-i):
        a = S // 26**(t-i)
        S -= a*26**(t-i)
        count += 1


A=["*"]*count
#print(A)
for i in range(len(A)):
    a = N // 26**(len(A)-i-1) 
    if a ==27:
        A[i] = 26
        N-=26 * 26**(len(A)-i-1)
    else:
        A[i] = a
        N -= a * 26**(len(A)-i-1)
    
    
#print(A)
B =[]
for i in A:
    if i != "*":
        B.append(chr(96+i))
    
print("".join(B))

### FIXED CODE ###

N = int(input())
ans=""
for i in range(1,99):
    if N <= 26**i:
        N -= 1
        for j in range(i):
            ans += chr(ord('a')+ N % 26)
            #print(N, N % 26,ans)
            N //= 26
            
        break
    else:
        N -= 26**i
    #print(N)
print(ans[::-1])
import math 
K=int(input())
A=[]
for i in range(K):
  for j in range(K):
    for k in range(K):
      s=gcd(i,j,k)
      A.append(s)
print(sum(A)


### FIXED CODE ###

import math
K=int(input())
ans=0
for a in range(1,K+1):
  for b in range(1,K+1):
    ans_=math.gcd(a,b)
    for c in range(1,K+1):
      ans+=math.gcd(ans_,c)
print(ans)
n,k = map(int,input().split())
ai = [int(i) for i in input().split()]

tmp = format(k, 'b')

lng = len(tmp)

li = [0]*(lng)
ai_li = [0]*lng

for i in range(n):
    ai_li[i] = format(ai[i], '0'+str(lng)+'b')

add_enb_flag = False

for i in range(lng):
    cnt = 0
    for j in range(n):
        if ai_li[j][i] == '1':
            cnt += 1
    if cnt >= n // 2:
        if tmp[i] == "1":
            add_enb_flag = True
        li[i] = 0
    elif tmp[i] == '1' or add_enb_flag == True:
        li[i] = 1
    else:
        li[i] = 0

k_m = 0
bai = 1

for i in range(lng):
    k_m += li[n-i-1] *bai
    bai *= 2

        
ans = 0
for i in range(n):
    ans += k_m^ai[i]
    
print(ans)

### FIXED CODE ###

n,k = map(int,input().split())
ai = [int(i) for i in input().split()]

tmp = format(max(k,max(ai)), 'b')

lng = len(tmp)
tmp = format(k, '0'+str(lng)+'b')

li = [0]*(lng)
ai_li = [0]*(n)

for i in range(n):
    #print(i)
    #print(ai[i])
    #print(format(ai[i], '0'+str(lng)+'b'))
    ai_li[i] = format(ai[i], '0'+str(lng)+'b')

add_enb_flag = False

for i in range(lng):
    cnt = 0
    for j in range(n):
        if ai_li[j][i] == '1':
            cnt += 1
    #print(cnt,i)
    if cnt >= (n+1) // 2:
        if tmp[i] == "1":
            add_enb_flag = True
        li[i] = 0
    elif tmp[i] == '1' or add_enb_flag == True:
        li[i] = 1
    else:
        li[i] = 0
k_m = 0
bai = 1

for i in range(lng):
    k_m += li[lng-i-1] *bai
    bai *= 2

#print(k_m,ai_li,tmp,li)
        
ans = 0
for i in range(n):
    ans += k_m^ai[i]
    
print(ans)
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
# print(a)
# print(b)
# print(c)
n = int(input())
d = [int(input()) for i in range(n)]
# print(d)

if (a[0]in d) and (a[1]in d) and(a[2]in d):
    print("Yes")
    exit()
if (b[0]in d)and(b[1]in d)and(b[2]in d):
    print("Yes")
    exit()
if (c[0]in d)and(c[1]in d)and(c[2]in d):
    print("Yes")
    exit()
if (a[2]in d)and(b[1]in d)and(c[0]in d):
    print("Yes")
    exit()
if (a[0]in d)and(b[1]in d)and(c[2]in d):
    print("Yes")
    exit()
if (a[0]in d)and(b[0]in d)and(c[0]in d):
    print("Yes")
    exit()
if (a[2]in d)and(b[2]in d)and(c[2]in d):
    print("Yes")
    exit()
else:
    print("No")


### FIXED CODE ###

import math
import string


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


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


n = int(input())
if n % 2 == 0:
    print((n//2))
else:
    print((n//2)+1)
n = int(input())
s = input()
 
r = s.count('R')
g = s.count('G')
b = s.count('B')
 
ans = r*g*b
 
for i in range(n):
  for j in range(i+1, n, 2):
    if s[i] != s[j] and s[i] != s[(i+j)/2] and s[(i+j)/2] != s[j]:
      count -= 1
print(count)

### FIXED CODE ###

n = int(input())
s = input()
 
r = s.count('R')
g = s.count('G')
b = s.count('B')
 
ans = r*g*b
 
for i in range(n):
  for j in range(i+2, n, 2):
    if s[i] != s[j] and s[i] != s[int((i+j)/2)] and s[int((i+j)/2)] != s[j]:
      ans -= 1
print(ans)
import sys
readline = sys.stdin.readline
N, M = map(int, readline().split())

def check(Edge, Dim):
    N = len(Edge)
    if any(d&1 for d in Dim):
        return 'No'
    if max(Dim) > 4:
        return 'Yes'
    dc4 = Dim.count(4)
    if dc4 <= 1:
        return 'No'
    if dc4 >= 3:
        return 'Yes'
    a = Dim.index(4)
    st = (a+1)%N
    used = set([a, st])
    stack = [st]
    while stack:
        vn = stack.pop()
        for vf in Edge[vn]:
            if vf not in used:
                stack.append(vf)
                used.add(vf)
    if len(used) == N:
        return 'No'
    return 'Yes'
Edge = [[] for _ in range(N)]
Dim = [0]*N

for _ in range(M):
    a, b = map(int, readline().split())
    a -= 1
    b -= 1
    Edge[a].append(b)
    Edge[b].append(a)
    Dim[a] += 1
    Dim[b] += 1

print(check(Edge, Dim))

### FIXED CODE ###

from sys import exit
N = int(input())
B = list(map(int, input().split()))
ctr = 0
ans = []
for _ in range(N):
    ctr = 0
    for i, b in enumerate(B, 1):
        if i == b:
            ctr = i
    ans.append(ctr)
    if ctr == 0:
        print(-1)
        exit()
    B = B[:ctr-1] + B[ctr:]
print('\n'.join([str(s) for s in ans][::-1]))
s = input()
if s[:2] == '00' or s[2:] == '00':
    print('NA')
elif s[:2] > 12 and 0 <= s[2:] <= 12:
    print('YYMM')
elif 0 <= s[:2] <= 12 and 0 <= s[2:] <= 12:
    print('AMBIGUOUS')
else:
    print('MMYY')


### FIXED CODE ###

s = input()

f = (0 < int(s[:2]) < 13)
s = (0 < int(s[2:]) < 13)
ans = 'NA'
if f and s:
    ans = 'AMBIGUOUS'
elif s:
    ans = 'YYMM'
elif f:
    ans = 'MMYY'
print(ans)
def ncr(n, r):
    if n < r: return 0
    r = min(r, n-r)
    numer = functools.reduce(operator.mul, range(n, n-r, -1), 1)
    denom = functools.reduce(operator.mul, range(1, r+1), 1)
    return numer / denom

def solve():
    n, k = map(int, input().split())
    for i in range(1,k+1):
        ans = (ncr(k-1, i-1) * ncr(n-k+1, i)) % (10**9+7)
        print(int(ans))
    return 0

if __name__ == "__main__":
    solve()


### FIXED CODE ###

import math
import collections
import fractions
import itertools
import functools
import operator

def ncr(n, r):
    if n < r: return 0
    r = min(r, n-r)
    if r == 0:
        return 1
    numer = functools.reduce(operator.mul, range(n, n-r, -1), 1)
    denom = functools.reduce(operator.mul, range(1, r+1), 1)
    return numer // denom % (10 ** 9 + 7)

def solve():
    n, k = map(int, input().split())
    for i in range(1,k+1):
        ans = (ncr(k-1, i-1) * ncr(n-k+1, i)) % (10**9+7)
        print(int(ans))
    return 0

if __name__ == "__main__":
    solve()
N = int(input())
M = 10
ans = 0

if N % 2 == 0
  while N > M:
    ans += N//M
    M *= 5
print(ans)

### FIXED CODE ###

N = int(input())
M = 10
ans = 0

if N % 2 == 0:
  while N >= M:
    ans += N//M
    M *= 5
print(ans)
import numpy as np
(n, m) = list(map(int, input().split()))
a = np.array(list(map(int, input().split()))).astype("int64") 
a = np.cumsum(a)
a %= m
count = np.sum(a == 0)
(unique, counts) = np.unique(a, return_counts=True) 

### FIXED CODE ###

import numpy as np
(n, m) = list(map(int, input().split()))
a = np.array(list(map(int, input().split()))).astype("int64") 
a = np.cumsum(a)
a %= m
count = np.sum(a == 0)
a.sort()
tc = 1
for i in range(1, n):
    if a[i - 1] == a[i]:
        tc += 1
    else:
        count += tc * (tc - 1) // 2
        tc = 1
else:
    count += tc * (tc - 1) // 2
print(count)
mozi=input()
if mozi == a or mozi == i or mozi == u or mozi == e or mozi == o:
   print("vowel")
else:
   print("consonant")

### FIXED CODE ###

mozi=input()
if mozi == 'a' or mozi == 'i' or mozi == 'u' or mozi == 'e' or mozi == 'o':
   print('vowel')
else:
   print('consonant')
# -*- coding: utf-8 -*-

from heapq import heappush, heappop
def io_generator():
	return input()

#+++++++++++++++++++
	
class Foo(object):
	def __init__(self, value, state):
		self.state = state
		self.value = value

	def __lt__(self, other):
		return self.value > other.value

def get_c(aa,ab,ac, amm):
	if ac < amm[2]-1:
		ret=[[aa,ab,ac+1]]
	else:
		ret=[]
		
	if ab<amm[1]-1:# and ab >= ac:
		ret.append([aa,ab+1,ac])
	
	if aa<amm[0]-1:# and aa >= ab and aa >= ac:
		ret.append([aa+1,ab,ac])
	return ret
	
def gv(al,bl,cl,s):
	return al[s[0]]+bl[s[1]]+cl[s[2]]
	
def main(io):
	x,y,z,k=map(int, io().split())
	ml=[x,y,z]
	al =list(map(int, io().split()))
	al.sort(reverse=True)
	bl =list(map(int, io().split()))
	bl.sort(reverse=True)
	cl =list(map(int, io().split()))
	cl.sort(reverse=True)
	init=[0,0,0]
	ggv=lambda l : gv(al,bl,cl,l)
	
	qq = []
	heappush(qq,Foo(ggv(init), init))
	
	ol=set()
	ol.add(init)
	
	for _ in range(k):
		ff=heappop(qq)
		vv=ff.value
		cs=ff.state
		nc=get_c(cs[0],cs[1],cs[2],ml)
		print(vv)
		for ns in nc:
			if ns in ol:
				continue
			else:
				heappush(qq, Foo(ggv(ns), ns))
				ol.add(ns)
	return 1

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	#print (main(io))
	main(io)

### FIXED CODE ###

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

from heapq import heappush, heappop
def io_generator():
	return input()

#+++++++++++++++++++
	
class Foo(object):
	def __init__(self, value, state):
		self.state = state
		self.value = value

	def __lt__(self, other):
		return self.value > other.value

def get_c(aa,ab,ac, amm):
	if ac < amm[2]-1:
		ret=[[aa,ab,ac+1]]
	else:
		ret=[]
		
	if ab<amm[1]-1:# and ab >= ac:
		ret.append([aa,ab+1,ac])
	
	if aa<amm[0]-1:# and aa >= ab and aa >= ac:
		ret.append([aa+1,ab,ac])
	return ret
	
def gv(al,bl,cl,s):
	return al[s[0]]+bl[s[1]]+cl[s[2]]
	
def lss(l):
	return '_'.join([str(i) for i in l])
	
def main(io):
	x,y,z,k=map(int, io().split())
	ml=[x,y,z]
	al =list(map(int, io().split()))
	al.sort(reverse=True)
	bl =list(map(int, io().split()))
	bl.sort(reverse=True)
	cl =list(map(int, io().split()))
	cl.sort(reverse=True)
	init=[0,0,0]
	ggv=lambda l : gv(al,bl,cl,l)
	
	qq = []
	heappush(qq,Foo(ggv(init), init))
	
	ol=set()
	ol.add(lss(init))
	
	for _ in range(k):
		ff=heappop(qq)
		vv=ff.value
		cs=ff.state
		nc=get_c(cs[0],cs[1],cs[2],ml)
		print(vv)
		for ns in nc:
			if lss(ns) in ol:
				continue
			else:
				heappush(qq, Foo(ggv(ns), ns))
				ol.add(lss(ns))
	return 1

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	#print (main(io))
	main(io)
yukichi_num = 0
ichiyou_num = 0
a,b = map(int,input().split())
while (b >= 10000) and (a > 0):
    b -=10000
    yukichi_num += 1
    a -= 1
while (b >= 5000) and(a > 0):
    b -= 5000
    ichiyou_num += 1
    a -= 1
if (b//1000) <= a:
    print('{0} {1} {2}'.format(yukichi_num,ichiyou_num,int(b/1000)))
else:
    print('-1 -1 -1')

### FIXED CODE ###

a = input()
print("2018"+a[4::])
n,a,b = (int(x) for x input().split())
ans = 0

def k(N):
    sum = 0
    while N>0:
        sum += N%10
        N = N//10
    return sum

for i in range(1,n+1):
    if a<=k(i)<=b:
        ans +=i
print(ans)


### FIXED CODE ###

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

def k(N):
    sum = 0
    while N>0:
        sum += N%10
        N = N//10
    return sum

for i in range(1,n+1):
    if a<=k(i)<=b:
        ans +=i
print(ans)
a=list(input())
b=list(input())
c=list(input())
next=a[0]
del a[0]
while True:
    if next=="a":
        next=a[0]
        del a[0]
    if next=="b":
        next=b[0]
        del b[0]
    if next=="c":
        next=c[0]
        del c[0]
    if len(a)==0 and next=="a":
        print("A")
        break
    if len(b)==0 and next=="b":
        print("B")
        break
    if len(c)==0 and next=="c":
        print("C")
        break

### FIXED CODE ###

sa=list(input())
sb=list(input())
sc=list(input())
owner="a"
while True:
    if owner=="a":
        if len(sa):
            owner=sa[0]
            del sa[0]
        else:
            break
    elif owner=="b":
        if len(sb):
            owner=sb[0]
            del sb[0]
        else:
            break
    else:
        if len(sc):
            owner=sc[0]
            del sc[0]
        else:
            break
if owner=="a":
    print("A")
elif owner=="b":
    print("B")
else:
    print("C")
import sys
input = sys.stdin.readline
#####segfunc######
def segfunc(x,y):
    if x == y == None:
        return set()
    if x == None:
        return y
    if y == None:
        return x
    return x | y
def init(init_val):
    #set_val
    for i in range(len(init_val)):
        seg[i+num-1]=set([init_val[i]])   
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return set()
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
n = int(input())
s = list(input())
ide_ele = None
num =2**(n-1).bit_length()
seg=[ide_ele]*(2*num - 1)
init(s)
for i in range(int(input())):
    a,b,c = input().split()
    if a == "1":
        update(int(b)-1, set([c]))
    else:
        if b == c:
            print(1)
        else:
            print(len(query(int(b)-1,int(c))))

### FIXED CODE ###

import sys
input = sys.stdin.readline
#####segfunc######
def segfunc(x,y):
    return x | y

def init(init_val):
    #set_val
    for i in range(len(init_val)):
        seg[i+num-1]=init_val[i]   
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
n = int(input())
s = list(input())[:-1]
ide_ele = 0
num =2**(n-1).bit_length()
seg=[ide_ele]*(2*num - 1)
s = [2 ** (ord(i) - ord('a')) for i in s]
init(s)
q = int(input())
for i in range(q):
    tmp = input()
    a,b,c = tmp[:-1].split()
    if a == "1":
        update(int(b)-1, 2 ** (ord(c) - ord('a')))
    else:
        if b == c:
            print(1)
        else:
            tmp = query(int(b)-1, int(c))
            tmp = format(tmp, 'b')
            print(tmp.count('1'))
h, w = map(int, input().split())
a = []
delrow = []
delcol = []


for i in range(h):
    a.append(list(input()))

for i in range(h):
    print(set(a[i]))
    if set(a[i]) == {"."}:
        delrow.append(i)

for i in range(w):
    print(set(a[0:w][i]))
    if set(a[0:w][i]) == {"."}:
        delcol.append(i)
        
for i in delrow [::-1]: #行を削除
    del a[i]
for i in delcol [::-1]: #列を削除
    for j in range(len(a)):
        del a[j][i]

for i in range(len(a)):
    print(*a[i], sep="")

### FIXED CODE ###

h, w = map(int, input().split())
a = []
delrow = []
delcol = []
cnt = 0

for i in range(h):
    a.append(list(input()))

for i in range(h):
    for j in range(w):
        if a[i][j] != ".":
            break
        else:
            cnt += 1
        if cnt == w:
            delrow.append(i)
    cnt = 0

for i in range(w):
    for j in range(h):
        if a[j][i] != ".":
            break
        else:
            cnt += 1
        if cnt == h:
            delcol.append(i)
    cnt = 0

for i in delrow [::-1]: #行を削除
    del a[i]
for i in delcol [::-1]: #列を削除
    for j in range(len(a)):
        del a[j][i]

for i in range(len(a)):
    print(*a[i], sep="")
N = int(input())
A_list = list(map(int,input().split()))
output = 1
for i in range(N):
    output *= A_list[i]
    if (output > 10 ** 18):
        print(-1)
        flug = 1
        break
if(flug != 1):
    print(output)

### FIXED CODE ###

N = int(input())
A_list = list(map(int,input().split()))
output = 1
flug = 0

if 0 in A_list:
    print(0)
    flug = 1
if flug != 1:
    for i in range(N):
        output *= A_list[i]
        
        if (output > 10 ** 18):
            print(-1)
            flug = 1
            break
if(flug != 1):
    print(output)
results=[]
while True:
    a=input().split("\"")
    if a[0]==".":
        break
    b=input().split("\"")
    count1=0
    count2=0
    for i in range(int(len(a))):
        if(i%2==1):
            for (k,l) in zip(a[i],b[i]):
                if(k!=l):
                    count1+=1
        else:
            for k,l in zip(a[i],b[i]):
                if(k!=l):
                    count2+=1
    if len(a) != len(b):
        results.append(2)
    else:
        if count1==0 and count2==0:
            results.append(0)
        elif count1==1 and count2==0:
            results.append(1)
        else:
            results.append(2)
for i in results:
    if i==0:
        print("IDENTICAL")
    if i==1:
        print("CLOSE")
    if i==2:
        print("DIFFERENT")
    



### FIXED CODE ###

results=[]
while True:
    a=input().split("\"")
    if a[0]==".":
        break
    b=input().split("\"")
    count1=0
    count2=0
    if len(a) != len(b):
        results.append(2)
    else:
        for i in range(len(a)):
            if(i%2==1):
                if len(a[i]) != len(b[i]):
                    count1+=1
                else:
                    for k,l in zip(a[i],b[i]):
                        if(k!=l):
                            count1+=1
            else:
                if len(a[i]) != len(b[i]):
                    count2+=1
                else:
                    for k,l in zip(a[i],b[i]):
                        if(k!=l):
                            count2+=1           
        if count1==0 and count2==0:
            results.append(0)
        elif count1==1 and count2==0:
            results.append(1)
        else:
            results.append(2)
for i in results:
    if i==0:
        print("IDENTICAL")
    if i==1:
        print("CLOSE")
    if i==2:
        print("DIFFERENT")
from fractions import gcd
from functools import reduce

def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

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

    v = lcm(A)
    S = 0
    for i in range(N):
        S += v // A[i]

    print(round(S % (1e9 + 7)))

main()


### FIXED CODE ###

import sys
from fractions import gcd
from functools import reduce

sys.setrecursionlimit(2147483647)

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

    lcm = lcm_list(A)
    S = 0
    for i in range(N):
        S += lcm // A[i]

    print(round(S % (round(1e9) + 7)))

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

A = sorted(A)

fac = [1]*(A[-1]+1)

for i in range(2,len(fac)) :
    fac[i] = i * fac[i-1]

ans1 = A[-1]
ans2 = 0

c = 0

for i in range(N) :
    a = A[i]
    calc = fac[ans1]//(fac[a] * fac[ans1-a])

    if c < calc :
        ans2 = a
        c = calc

print(ans1,ans2)


### FIXED CODE ###

import bisect

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

A = sorted(A)

ans1 = A[-1]

ind = bisect.bisect_left(A, ans1/2)


c = float("inf")
for i in range(max(0,ind-1), min(N-1,ind+2)) :
    calc = abs(ans1/2 - A[i])
    if calc < c :
        ans2 = A[i]
        c = calc
print(ans1,ans2)
N = int(input())
A = input().split(' ')

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

A.sort()
A.reverse()

flag = 0
for term in A:

    count = 0

    for i in range(N):
        if(A[i] % term != 0):
            count += 1
        if(count == 2):
            break

    if(count <= 1):
        flag = 1
        break

if(flag == 1):
    print(term)
else:
    for term in reversed(range(0, A[-1])):

        count = 0

        for i in range(N):
           if(A[i] % term !=0):
                count += 1
            if(count == 2):
                break

        if(count <= 1):
            break

    print(term)

### FIXED CODE ###

def gcd(a, b):
    if(a == 0):
        return b
    if(b == 0):
        return a

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

def L(end_i, A):
    if(end_i == 0):
        return 0
    
    a = 0
    for i in range(end_i):
        a = gcd(a, A[i])
    return a


def R(start_i, A, N):
    if(start_i == N - 1):
        return 0

    a = 0
    for i in range(start_i + 1, N):
        a = gcd(a, A[i])
    return a


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

left = [0] * N
right = [0] * N

for i in range(1, N):
    left[i] = gcd(left[i - 1], A[i - 1])
#print(left)

for i in reversed(range(0, N - 1)):
    right[i] = gcd(A[i + 1], right[i + 1])
#print(right)

M = []
for i in range(N):
    M.append(gcd(left[i], right[i]))
#print(M)

print(max(M))
n = int(input())
a = map(int,input())
count = 0;
while true:
	for i in a :
  		if i%2!=0:
          break
        else :
          a[i] = a%i
    count++
    
print(str(count))
          
    

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split(' ')))
count = 0;
flag =True
while True:
    for i in a :
        if i % 2 != 0 :
            flag=False
            break
    if flag :
        a = list(map(lambda x: x/2 , a))
        count=count+1
    else:
        break
    
print(str(count))