Harryxun/stf_run huggingface dataset:
N = int(input())
D = list(map(int, input().split()))

diff = [0]*13
D.sort()
for i in range(N):
    diff[D[i]] += 1
    if diff[i] > 2:
        print(0)
        exit(0)
if diff[0] > 0:
    print(0)
    exit(0)
else:
    diff2 = [diff[12 - i] for i in range(1, N-1)]

ans = [0]
for i in range(N):
    if i % 2 == 0:
        ans.append(D[i])
    else:
        ans.append(24 - D[i])

ans = [abs(ans[i+1] - ans[i]) for i in range(N-1)]

print(min(ans))


### FIXED CODE ###

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


D.sort()
ans = [0]
ans = [D[i]
       for i in range(N) if i % 2 == 0] + [24 - D[i] for i in reversed(range(N)) if i % 2 == 1]

ans = [0] + ans + [0]

ans = [abs(ans[i+1] - ans[i]) for i in range(N+1)]

print(min(ans))
n = int(input())
dat =list(input().split())

for i in dat:
	i = int(i)

dat.sort(reverse=True)

asum = 0
bsum = 0

for i in range(n):
     if i % 2 == 0:
         asum = asum + dat[i]
     else:
         bsum = bsum + dat[i]
		
print(asum-bsum)

### FIXED CODE ###

n = int(input())
dat = list(input().split())

dat = list(map(int,dat))

dat.sort(reverse=True)

asum = 0
bsum = 0

for i in range(n):
	if i % 2 == 0:
		asum = asum + dat[i]
	else:
		bsum = bsum + dat[i]
		
print(asum-bsum)
import math

r = import()

print ("%f %f" % (math.pi*r*r, 2*math.pi*r))

### FIXED CODE ###

import math

r = input()

print("%f %f" % (math.pi * r ** 2, 2 * math.pi * r))
a, b = map(int, input().split())
if a == "H" and b == "H":
    print("H")
elif a == "D" and b == "D":
    print("H")
else:
    print("D")

### FIXED CODE ###

a, b=input().split()
if a=='H':
  print(b)
else:
  if b=='D':
    print('H')
  else:
    print('D')
d_cnt =(int(x) for x in input().split()) 

if d_cnt//4==0 or d_cnt//7==0 or d_cnt//11:
  print('Yes')
else:
  print('No')

  

### FIXED CODE ###

N = int(input())
f = False
for i in range(N//4+1):
    for j in range(N//7+1):
        if i*4 + j*7 == N:
            f = True
            break
if f:
    print("Yes")
else:
    print("No")
a, b , c ,d = map(int, input().split())



if b<c:
    print("0")
elif a<c and (c<b and b<d):
    print(b-c)
elif (a<c and c<n) and (a<d and d<b):
    print(d-c)
elif (c<a and a<d) and (c<b and b<d):
    print(b-a)
elif (c<a and a<d) and (c<b and d<b):
    print(d-a)
elif d<a:
    print("0")



### FIXED CODE ###

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



mi = min(b,d )
ma = max(a,c)

print(max(0,mi - ma))
def main():
  n = int(input())
  s = [input() for i in range(n)]
  nums = [1000 for i in range(26)]
  for i in range(26):
      for j in range(n):
          nums[i] = min(nums[i],s[j].count((chr)(97 + i)))

  for i in range(n):
    while nums[i] > 0:
        print((chr)(97 + i),end = "")
        nums[i] -= 1
  print("")

main()

### FIXED CODE ###

def main():
  n = int(input())
  s = [input() for i in range(n)]
  nums = [1000 for i in range(26)]
  for i in range(26):
      for j in range(n):
          nums[i] = min(nums[i],s[j].count((chr)(97 + i)))

  for i in range(26):
    while nums[i] > 0:
        print((chr)(97 + i),end = "")
        nums[i] -= 1
  print("")

main()
import math
a, b, x = map(int, input().split())

y = 2 * x / (a*a) - b
print(90 - math.degrees(math.atan(a/(b-y))))

### FIXED CODE ###

import math
a, b, x = map(int, input().split())

if a * a * b == x:
    print(0)
# 台形の場合
elif a * a * b < 2 * x:
    y = 2 * x / (a*a) - b
    print(90 - math.degrees(math.atan(a/(b-y))))

else:
    y = 2 * x / a / b
    print(90 - math.degrees(math.atan(y/b)))
N,K = map(int,input().split())
P = [int(input()) for i in range(N)]
Q = []*N
for i in range(N):
  Q[i] = (P[i]+1)/2
R = 0
for j in range(K):
  R += Q[j]
for k in range(N-K):
  R = R - Q[k] + Q[k+K]
  ans = max(R)
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
P = list(map(int,input().split()))
for i in range(N):
  P[i] = (P[i]+1)/2
now = sum(P[:K])
ans = now
for j in range(N-K):
  now = now - P[j] + P[j+K]
  ans = max(ans,now)
print(ans)
S=input()
if S="SUN":
  print("0")
elif S="MON":
  print("1")
elif S="TUE":
  print("2")
elif S="Wed":
  print("3")
elif S="THU":
  print("4")
elif S="FRI":
  print("5")
elif S="SAT":
  print("6")


### FIXED CODE ###

S=input()
if S=="SUN":
  print(7)
elif S=="MON":
  print(6)
elif S=="TUE":
  print(5)
elif S=="WED":
  print(4)
elif S=="THU":
  print(3)
elif S=="FRI":
  print(2)
elif S=="SAT":
  print(1)
import sys

N = int(sys.stdin.readline().rstrip())
S = sys.stdin.readline().rstrip()
Q = int(sys.stdin.readline().rstrip())
k = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]

def counter(S, ki):
  count = 0
    for i in range(0, len(S)): 
      for j in range( i+2, len(S)):
        if j - i <=1 or j - i >= ki:
          continue
        for l in range(i+1, j):
          if (S[i], S[l], S[j]  ) == ('D', 'M', 'C'):
            count += 1
  return count
  
for ki in k:
  print(counter(S, ki))

### FIXED CODE ###

import sys
N = int(sys.stdin.readline().rstrip())
a = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]
d = [abs(sum(a)/float(N) - ai) for ai in a]

if len(set(d))==1:
  print(0)
else:
  print(d.index(min(d)))
s = input()
s=list(s)
zeroc=0
onec=0
for i in s:
  if i == "0":
    zeroc++
  if i == "1":
    onec++
print(min(zeroc,onec)*2)


### FIXED CODE ###

s = input()
s=list(s)
zeroc=0
onec=0
for i in s:
  if i == "0":
    zeroc+=1
  if i == "1":
    onec+=1
print(min(zeroc,onec)*2)
N, M = map(int, input().split())

mod = 1000000007

f = [] # 素因数分解(指数部のみ)

for p in range(2, M): # 素因数分解
    e = 0
    while M%p == 0:
        e += 1
        M /= p
    
    if e>0:
        f.append(e)
    
    if M == 1:
        break

def pw(a, e):
    if e == 1:
        return a
    p = pw(a, e // 2)
    if e%2 == 1:
        return p * p % mod a % mod
    else:
        return p * p % mod

# fact, inv の計算
fact = [1] * 100040
inv = [1] * 100040
for k in range(1, 100040):
    fact[k] = fact[k-1] * k % mod
    inv[k] = pw(fact[k], mod-2)

ans = 1
for e in f:
    ans = ans * fact[e+N-1] % mod * inv[e] % mod * inv[N-1] % mod # N_H_e (重複組合せ)

print(ans)


### FIXED CODE ###

from collections import Counter

mod = 1000000007

# nの素因数分解

def prime(n):
    d = Counter()
    i = 2
    while i*i <= n:
        while n%i == 0:
            n //= i
            d[i] += 1
        i += 1
    if n > 1:
        d[n] += 1
    return d

# xのn乗を計算する
def mod_pow(x, n):
    if n == 0:
        return 1
    elif n % 2 == 0:
        half_x = mod_pow(x, n // 2)
        return half_x * half_x % mod
    else:
        return x * mod_pow(x, n-1) % mod

fact = [1] * 100100
inv = [1] * 100100
for k in range(1, 100100):
    fact[k] = fact[k-1] * k % mod
    inv[k] = mod_pow(fact[k], mod-2)

def nCr(n, r):
    return fact[n] * inv[r] % mod * inv[n-r] % mod

def solve():
    N, M = map(int, input().split())
    p = prime(M)
    s = 1
    for i in p.values():
        s *= nCr(i + N - 1, N - 1)
        s %= mod
    print(s)

solve()
da = list(map(int,input().split()))
k = [[0 for i in range(2)]for j in range(10001)]
i = 0
su = 0
j = 0
while da[0] != 0 and da[1] != 0:

	i = 0
	su = 0
	j = 0
	for i in range(da[0]):
		k[i][0],k[i][1] = list(map(int,input().split()))
		su += k[i][0] * k[i][1]

	sorted(k,key = lambda x: x[1],reverse = True)
	while da[1] != 0:
		if da[1] >= k[j][0]:
			su -= k[j][0] * k[j][1]
			da[1] -= k[j][0]
			j += 1

		else:
			su -= da[1] * k[j][1]
			da[1] = 0

	print(su)

	da = list(map(int,input().split()))
	if da[0] == 0 and da[1] == 0:
		break
	k = [[0 for i in range(2)]for j in range(10001)]



### FIXED CODE ###

da = list(map(int,input().split()))

k = [[0 for i in range(2)]for j in range(10001)]
i = 0
su = 0
j = 0

while da[0] + da[1] != 0:
	i = 0
	su = 0
	j = 0
	for i in range(da[0]):
		k[i][0],k[i][1] = map(int,input().split())


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

	while j != i + 1:
		if da[1] > k[j][0]:
			da[1] -= k[j][0]
			j += 1
		elif da[1] <= k[j][0] and da[1] > 0:
			su += (k[j][0] - da[1]) * k[j][1]
			da[1] = 0
			j += 1
		else:
			su += k[j][0] * k[j][1]
			j += 1

	print(su)

	da = list(map(int,input().split()))

	k = [[0 for i in range(2)]for j in range(10001)]
x,y,z = map(int,input().split())
swap(x,z)
swap(x,y)
print(x,y,z)

### FIXED CODE ###

x,y,z = map(int,input().split())
x,y = y,x
x,z = z,x
print(x,y,z)
def composite(d,n,s): for a in (2,3,5,7): p = False if pow(a,d,n) == 1: continue for i in range(s): if pow(a, 2**i * d, n) == n-1: p = True break if not p: return True return False def is_prime(n): if n in (2,3,5,7): return True elif 0 in (n%2,n%3,n%5,n%7): return False else: d,s = n-1, 0 while not d%2: d,s = d>>1,s+1 return not composite(d,n,s) r = [] n = int(input()) for i in range(n): n = int(input()) if is_prime(n): r.append(n) print(len(r)) 


### FIXED CODE ###

n = int(input())
mlist = []
plist = [2]
for i in range(3,10000):
    count = 0
    for k in plist:
        if (i%k != 0):
            count += 1
        else:
            break
    if (count == len(plist)):
        plist.append(i)
def check(m):
    for p in plist:
        if (m <= p):
            return True
        if m%p == 0:
            return False     ##한번이라도 False가 return되면 False가 되기에 prime인지 아닌지 check가능
    return True

count = 0
for i in range(n):
    m = int(input())
    if check(m):
        count += 1
        
print(count)
def resolve():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    def dfs(n, i, j, d, k):
        if k >= K or (i == N and j == M):
            return n
        if d == 1 and i < N and k + A[i] <= K:
            k += A[i]
            l = dfs(n + 1, i + 1, j, d, k)
            r = dfs(n + 1, i + 1, j, -d, k)
            return max(l, r)
        elif d == -1 and j < M and k + B[j] <= K:
            k += B[j]
            l = dfs(n + 1, i, j + 1, d, k)
            r = dfs(n + 1, i, j + 1, -d, k)
            return max(l, r)
        else:
            return n

    print(dfs(0, 0, 0, 1, 0))

resolve()

### FIXED CODE ###

def resolve():
    import numpy as np

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

    A = np.insert(np.cumsum(A), 0, 0)
    B = np.insert(np.cumsum(B), 0, 0)

    ans = 0
    j = M
    for i in range(N + 1):
        if A[i] > K:
            break
        while A[i] + B[j] > K:
            j -= 1

        ans = max(ans, i + j)

    print(ans)

resolve()
import math

A, B = list(map(int, input().split()))
print(A * B // math.gcd(A, B))

### FIXED CODE ###

from fractions import gcd

A, B = map(int, input().split())

print(A * B // gcd(A, B))
from math import*
from bisect import*
n,*t=map(int,open(0).read().split())
m=int(log2(n))+1
x=t[:n]
l=t[n]
d=[[bisect(x,y+l)-1for y in x]]+[[0]*n for _ in range(m)]
for i in range(m):
    for j in range(n):
        d[i+1][j]=d[i][d[i][j]]
for a,b in zip(t[n+2::2],t[n+3::2]):
    a-=1
    b-=1
    if b<a:a,b=b,a
    c=1
    for i in range(m,-1,-1):
        if d[i][a]<b:
            a=d[i][a]
            c+=2**i
    print(c)

### FIXED CODE ###

from math import*
from bisect import*
n,*t=map(int,open(0).read().split())
m=int(log2(n))+1
x=t[:n]
l=t[n]
d=[[bisect(x,y+l)-1for y in x]]+[[0]*n for _ in range(m)]
for i in range(m):
    for j in range(n):
        d[i+1][j]=d[i][d[i][j]]
for a,b in zip(t[n+2::2],t[n+3::2]):
    a-=1
    b-=1
    if b<a:a,b=b,a
    c=1
    for i in range(m,-1,-1):
        if d[i][a]<b:
            a=d[i][a]
            c+=2**i
    print(c)
a,b,h,m = list(map(int, input().split()))

hh=360*(60*h+m)/(60*12)
mm=360*(m/60)
rad=hh-mm
if rad > 180:
    rad=360-rad
print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(rad))))


### FIXED CODE ###

import math
a,b,h,m = list(map(int, input().split()))

hh=360*(60*h+m)/(60*12)
mm=360*(m/60)
rad=hh-mm
if rad > 180:
    rad=360-rad
print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(rad))))
a, b  = map(int, input().split())

for i in range(10000):
  if i * 0.08 == a and i * 0.1 == b:
    print(i)
    exit(0)
else:
  print(-1)
    
    


### FIXED CODE ###

s = input()
if s == 'AAA' or s == 'BBB':
  print('No')
else:
  print('Yes')
app, ap_chip = map(int,list(input().split()))


ap_chip += app*3


print(int(ap_chip%2)


### FIXED CODE ###

app, ap_chip = map(int,list(input().split()))


ap_chip += app*3


print(int(ap_chip/2))
N=int(input())
A=list(map(int,input().split()))

def GCD(L):
  while(len(L)>1):
    a=min(L)
    M=map(lambda x: x%a, L)
    L=[a]+list(filter(lambda x: x!=0, M))
  return a

cogcd=[ 0 for i in range(N)]

for i in range(N):
  cogcd[i]=GCD(A[:i]+A[i+1:])

print(max(cogcd))

### FIXED CODE ###

A,B,T=map(int,input().split())
print(int(T/A)*B)
n = int(input())
R = [int(input()) for i in range(n)]
profit= R[1] - R[0]
for i in range(n):
    for j in range(i+1,n):
        tmp = R[j]-R[i]
        if profit < tmp:
            profit = tmp
         
print(max(profit))

### FIXED CODE ###

n = int(input())
R = [int(input()) for i in range(n)]
profit= R[1] - R[0]
mn = R[0]
R.pop(0)
for i in R:
    if profit < i - mn:
        profit = i - mn
        if 0 > i - mn:
            mn = i
    elif mn > i:
        mn = i

print(profit)
money=input()
sum=input()
money500=500*money
if money500>=sum:
    print('Yes')
else:
    print('No')
return 0

### FIXED CODE ###

money,sum=map(int,input().split())
money500=500*money
if money500>=sum:
    print('Yes')
else:
    print('No')
a, b, c = list(map(int, input.split()))

if a == b == c:
  print('No')
elif a != b and a != c and b != c:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

a, b, c  = (int(x) for x in input().split())
 
if a == b == c:
  print('No')
elif a != b and a != c and b != c:
  print('No')
else:
  print('Yes')
l,r = map(int,input().split())

m = [-1]*(r-l+1)

if (r-l+1)>=2019:
    print(0)
else:
    for i in range(r-l+1):
        m[i] = (l+i)%2019
    sm = sorted(m)
    print(sm[0]*sm[1])

### FIXED CODE ###

l,r = map(int,input().split())

if (r-l+1)>=2019:
    print(0)
else:
    ans = (l*(l+1))%2019
    for j in range(l,r+1):
        for i in range(l,j):
            if ((i*j)%2019)<ans:
                ans = (i*j)%2019
    print(ans)
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
s = input()

r = s.count('R')
g = s.count('G')
b = n - r - g
ans = comb(n, 3) - ( comb(r, 2) + comb(g, 2) + comb(b, 2) ) * (n-2) + ( comb(r, 3) + comb(g, 3) + comb(b, 3) ) * 2
for i in range(n):
    d = 1
    j = i + d
    k = j + d
    while k < n:
        t = s[i] + s[j] + s[k]
        if t.count('R') == t.count('G') == 1:
            ans -= 1
        d += 1
        j += 1
        k += 2
print(ans)

### FIXED CODE ###

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
s = input()

r = s.count('R')
g = s.count('G')
b = n - r - g
ans = comb(n, 3) - ( comb(r, 2) + comb(g, 2) + comb(b, 2) ) * (n-2) + ( comb(r, 3) + comb(g, 3) + comb(b, 3) ) * 2
for i in range(n):
    d = 1
    j = i + d
    k = j + d
    while k < n:
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
        d += 1
        j += 1
        k += 2
print(ans)
n = int(input())
s = input()
a = 0
f = 0
for i in range(n-1):
    if s[i] == '#' and s[i + 1] =='.':
        a += 1
        f = 1
    if s[i] == '.' and s[i + 1] == '.' and f == 1:
        a += 1
    if s[i] == '.' and s[i + 1] == '#':
        f = 0
print(a)



### FIXED CODE ###

a, b, c = map(int, input().split())
if (a <= c and c <= b) or (a >= c and c >= b):
    print("Yes")
else:
    print("No")
import math
a, b = map(int, input().split())
a = math.ceil(a / 0.08)
b = math.ceil(b / 0.1)
tmp_a = set([i for i in range(a, a+13)])
tmp_b = set([i for i in range(b, b+10)])
if len(tmp_a & tmp_b) == 0:
    print(-1)
else:
    print(min(tmp_a & tmp_b))

### FIXED CODE ###

n, a, b = map(int, input().split())
q, m = divmod(n, a+b)
print(a * q + min(m, a))
n,m = map(int,input().split())
ab = [[] for i in range(1,m+1)]
for i in range(n):
    a,b = map(int,input().split())
    ab[a].append(b)
ab = {i:sorted(ab[i],reverse=True) for i in ab}
print(ab)
ans = 0
for i in range(m)[::-1]:
    rem = m - i
    #print("rem=",rem,"ab[rem]=",ab[rem])
    mx = 0
    fl = -1
    for j in range(1,m-i+1):
        #print("j=",j)
        if ab[j] and mx < ab[j][0]:
            mx = ab[j][0]
            fl = j
            #print("fl=",fl)
    ans += mx
    if fl > 0: del ab[fl][0]
    #print(ans)
print(ans)


### FIXED CODE ###

from heapq import *
n,m = map(int,input().split())
t = [[] for i in range(10**5+1)]
for i in range(n):
    a,b = map(int,input().split())
    t[a].append(b)

ans = 0
h = []
for i in range(1,m+1):
    #print(i,"日目")
    for j in t[i]:
        heappush(h, -j)
        #print("heappush",j)
    if h:
        a = -heappop(h)
        #print("heappop",a)
        ans += a
print(ans)
N=int(input())
aa=list(map(int,input().split()))
s=list[]
for i in range(N):
  s[i]=1/s[i]
  s.attend(s[i])
Q=sum(s)  
print(1/Q)  

### FIXED CODE ###

N=int(input())
aa=list(map(int,input().split()))
for i in range(N):
  aa[i]=1/aa[i]
Q=sum(aa)
print(1/Q)
import math

N = int(input())

sn = math.sqrt(N) // 1
i = 0

for i in range(1, sn + 1):
  if N % i == 0:
    break

print(int(i + (N / i) - 2))

### FIXED CODE ###

import math

N = int(input())

sn = int(math.sqrt(N) // 1)
ans = N

for i in range(1, sn + 1):
  if N % i == 0:
    ans = min(ans, int(i + (N / i) - 2))

print(ans)
# ABC138D - Ki (entirely global namespace)
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def dfs(v: int, p: int) -> None:
    for u in T[v]:
        if u != p:  # p: parent -> skip
            cnt[u] += cnt[v]  # cumulative sum
            dfs(u, v)


# Ai (A[i][0]) may be not a parent of Bi (A[i][1])
N, Q = tuple(map(int, input().split()))  # vertices and queues
E = tuple(tuple(map(int, input().split())) for _ in range(N - 1))
P = tuple(tuple(map(int, input().split())) for _ in range(Q))
T = [[] for _ in range(N + 1)]  # tree, (N+1: 1-idx -> 0-idx)
for a, b in E:
    T[a] += [b]
    T[b] += [a]
cnt = [0] * (N + 1)
for p, x in P:
    cnt[p] += x  # increase vertex p by x
dfs(1, -1)
print(*cnt[1:])


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC138D - Ki
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def dfs(v, p, tree, cnt):
    for u in tree[v]:
        if u != p:
            cnt[u] += cnt[v]
            dfs(u, v, tree, cnt)


def main():
    N, Q = tuple(map(int, input().split()))
    A = tuple(tuple(map(int, input().split())) for _ in range(N - 1))
    P = tuple(tuple(map(int, input().split())) for _ in range(Q))
    T = [[] for _ in range(N + 1)]  # T[i] := children of vertex i
    cnt = [0] * (N + 1)
    for a, b in A:  # set tree relations
        T[a] += [b]
        T[b] += [a]
    for p, x in P:  # increment on roots
        cnt[p] += x
    dfs(1, -1, T, cnt)
    print(*cnt[1:])


if __name__ == "__main__":
    main()
def gcd(a,b):
	if b==0:
		return a
	else:
		return gcd(b,a%b)

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

n=int(input())
a=[int(i) for i in input().split()]
tmp=1
for i in a:
	tmp=lcm(i,tmp)
mod=1e9+7
ans=int(0)
for i in a:
	ans=(ans+tmp//i)%mod
print(int(ans))

### FIXED CODE ###

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

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

n=int(input())
a=[int(i) for i in input().split()]
tmp=1
for i in a:
	tmp=lcm(i,tmp)
mod=1000000007
print(sum(tmp//i for i in a)%mod)
a,b,c=map(int,input().split())
if c-a-b>0 and (c-a-b)**2>4*a*b:
  print("Yes")
else:
  print("No')

### FIXED CODE ###

a,b,c=map(int,input().split())
if c-a-b>0 and (c-a-b)**2>4*a*b:
  print("Yes")
else:
  print("No")
a,b = map(int,input().split())
k = [2,5,5,4,5,6,3,7,6]
c = list(map(int,input().split()))
cc = [[0,0] for i in range(b)]
ccc = [[0,0] for i in range(b)]
c.sort(reverse = True)
for i in range(b):
	cc[i] = [c[i],k[c[i]-1]]
	ccc[i]= [c[i],k[c[i]-1]]

cc.sort(key = lambda x:x[1])
ccc.sort(reverse = True)
p = a // cc[0][1]
q = a % cc[0][1]
co = [cc[0][0] for i in range(p)]
for i in range(p):
	for j in range(b):
		if ccc[j][0] > cc[0][0] and q >= ccc[j][1] - cc[0][1]:
			co[i] = ccc[j][0]
			q -= ccc[j][1] - cc[0][1]
			break
	if q == 0:
		break

for i in range(p):
	for j in range(b):
		if q >= cc[j][1] - k[co[-(i+1)]-1] and cc[j][1] > k[co[-(i+1)]-1]:
			q -= cc[j][1] - k[co[-(i+1)]-1]
			co[-(i+1)] = cc[j][0]
	if q == 0:
		break
if q != 0:
	for i in range(a):
		if c[0][1] != c[i][1]:
			p = a // cc[i][1]
			q = a % cc[i][1]
			co = [cc[i][0] for j in range(p)]
			for i in range(p):
				for j in range(b):
					if ccc[j][0] > cc[0][0] and q >= ccc[j][1] - cc[0][1]:
						co[i] = ccc[j][0]
						q -= ccc[j][1] - cc[0][1]
					break
				if q == 0:
					break

			for i in range(p):
				for j in range(b):
					if q >= cc[j][1] - k[co[-(i+1)]-1] and cc[j][1] > k[co[-(i+1)]-1]:
						q -= cc[j][1] - k[co[-(i+1)]-1]
						co[-(i+1)] = cc[j][0]
				if q == 0:
					break

			break


co.sort(reverse = True)

co = map(str,co)
aaa = ''.join(co)
print(aaa)


### FIXED CODE ###

a,b = map(int,input().split())
k = [2,5,5,4,5,6,3,7,6]

c = list(map(int,input().split()))

c.sort()
cc = [[c[i],k[c[i]-1]] for i in range(b)]
ccc = [[c[i],k[c[i]-1]] for i in range(b)]
dp = [-1 for i in range(a+1)]
dp[0] = 0
cc.sort(key = lambda x:x[1])
for j in range(b):
	for i in range(a+1):
		if i-cc[j][1] >= 0 and dp[i-cc[j][1]] >= 0:
			dp[i] = max(dp[i-cc[j][1]]+1,dp[i])
ccc.reverse()
k = a
co = ''
for i in range(dp[a]):
	for j in range(b):
		if k-ccc[j][1] >= 0 and dp[k-ccc[j][1]] == dp[k] - 1:
			co += str(ccc[j][0])
			k -= ccc[j][1]
			break
print(co)
import re
import sys
S = input()
T = input()
w = 0
if not re.match(r'^[a-z]+$', S) or not re.match(r'^[a-z]+$', T) or len(S) != len(T) or (10 ** 5 * 2) < len(S):
  sys.exit()
if S != T:
  i = 0
  for l in S:
    if l != T[i]:
      w = w + 1
    i = i + 1
print(w)

### FIXED CODE ###

import re
import sys
try:
  a = int(input())
  if not 1 <= a <= 10:
    sys.exit()
  print(a+(a**2)+(a**3))
except:
  sys.exit()
# , = map(int, input.split())
#  = int(input())
x,a,b = map(int, input().split())
print((x - a) % b)

### FIXED CODE ###

# , = map(int, input.split())
#  = int(input())

x = int(input())
a = int(input())
b = int(input())
print((x - a) % b)
x, n = map(int, input().split())
p = list(map(int, input().split()))
mem = []
mind = 100
for i in range(1, 100+1):
    if i not in p:
        t = abs(x-i)
        if t < mind:
            mem.append([i, t])
            mind = t
mem = sorted(mem, key=lambda x: (x[1], x[0]))
print(mem[0][0])


### FIXED CODE ###

x, n = map(int, input().split())
p = list(map(int, input().split()))
mem = []
mind = 100
for i in range(-100, 200):
    if i not in p:
        t = abs(x-i)
        if t < mind:
            mem.append([i, t])
            mind = t
mem = sorted(mem, key=lambda x: (x[1], x[0]))
print(mem[0][0])