peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
s = list(input())
if len(set(s))==2 and ((s[0]==s[1] and s[2]==s[3]) or (s[0]==s[2] and s[1]==s[3]) or (s[0]==s[3] and s[1]==s[2])):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

a.insert(0, 0)
b = [0 for _ in range(N+1)]

b[-1] = a[-1]
for i in reversed(range(N+1)):
    sum = 0
    for j in range(2, N+1):
        if i*j <= N:
            sum += b[i*j]
        else:
            break
    if sum%2 == a[i]:
        b[i] = 0
    else:
        b[i] = 1

ans = [str(i+1) for i, x in enumerate(b[1:]) if x == 1]
print(len(ans))
if len(ans) != 0:
    print(" ".join(ans))
# Judge status: Wrong Answer
N = int(input())
from numpy import zeros
A = zeros((10,10))
 
for i in range(1,N+1):
  a = int(str(i)[0])
  b = int(str(i)[-1])
  A[a][b] += 1
 
cnt = 0
for _ in range(1,N+1):
  a = int(str(_)[0])
  b = int(str(_)[-1])
  cnt += A[b][a]
  
print(cnt)
# Judge status: Accepted
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
S=[input() for i in range(n)]
C = collections.Counter(S[0])
for i in range(2,n):
  C1 = collections.Counter(S[i])
  C = C & C1
s=[]
for ci,i in C.items():
  s+=[ci]*i
s.sort()
print(*s,sep="")
# Judge status: Accepted
n, m, q = [int(e) for e in input().split()]

import itertools as it
abcd=list()
for i in range(q):
    abcd.append([int(e) for e in input().split()])


all = it.combinations_with_replacement(range(1,m+1),n)

count=list()
num=0
for i in all:
    for j in abcd:
        if i[j[1]-1]-i[j[0]-1] == j[2]:
            num += j[3]
        else:
            pass
    count.append(num)
    num=0

print(max(count))
# Judge status: Wrong Answer
a,b,c,k = map(int,input().split())
ans = 0
if a <= k:
    ans += a
else:
    print(a)
    exit()
k = k - a
if b <= k:
    ans += 0
else:
    print(ans)
    exit()
k = k - b
ans += k*-1
print(ans)
# Judge status: Accepted
import math
S = int(input())

a = int(math.sqrt(S))
if S - a**2 > 0:
  a += 1
b = a**2 - S
c = 1
if b >= 10**8:
  s = int(math.sqrt(b))
  for i in range(s):
    if b % (s-i) == 0:
      b //= (s-i)
      c *= (s-i)
      break
print(0, 0, a, b, c, a)
# Judge status: Accepted
a,b,c = map(str,input().split())
s = list(b)
print('A'+str(b[0]+'C'))
# Judge status: Accepted
a,b=map(int,input().split())

if a*b%2==0:
  print('Even')
else:
  print('Odd')
# Judge status: Accepted
s = input()
t = input()

if len(s) + 1 != len(t):
    print("No")
elif s != t[:len(s)]:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
x = int(input())
c = x // 11
m = x % 11
cnt = 2 * c
if 0 < m < 7:
    cnt += 1
elif 6 < m:
    cnt += 2
print(cnt)
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))

def check(N, K, A, L):
    return sum(a // L for a in A) <= K

lo = 1
hi = max(A)+1
while lo < hi:
    m = (lo + hi)//2
    ok = check(N, K, A, m)
    if ok: # m 出来れるのでもっと小さく切れるか
        hi=m
    else:
        lo=m+1
print(min(max(A), lo))
# Judge status: Accepted
import math
N, D = map(int, input().split())
X = []
Y = []
ans = 0
for i in range(N):
    x,y = map(int, input().split())
    X.append(x)
    Y.append(y)

for i in range(N):
    if math.sqrt(X[i]** 2 + Y[i]** 2) <= D:
        ans += 1
print(ans)
# Judge status: Wrong Answer
a,b=input().split()
print(min(int(b*int(a)),int(a*int(b))))
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))
mx = 0
for i in range(N - 1):
    mx = max([mx, A[i+1] - A[i]])
mx = max([mx, A[0] + K - A[N-1]])
print(K-mx)
# Judge status: Accepted
a, b, x = map(int, input().split())

if a + b >= x and a <= x:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
def main():
    N=int(input())
    dp=[[0]*(3) for _ in range(N)]
    dp[0][0],dp[0][1],dp[0][2]=map(int,input().split())
    for i in range(1,N):
        a,b,c=map(int,input().split())
        dp[i][0]=a+max(dp[i-1][1],dp[i-1][2])
        dp[i][1]=b+max(dp[i-1][0],dp[i-1][2])
        dp[i][2]=c+max(dp[i-1][1],dp[i-1][0])
    print(max(dp[-1][0],dp[-1][1],dp[-1][2]))
main()
# Judge status: Accepted

def main():
    n = int(input())
    a = list(map(int, input().split()))
    div2 = 0
    div4 = 0
    notdiv4 = 0
    for ea in a:
        if ea % 4 == 0:
            div4 += 1
        elif ea % 2 == 0:
            div2 += 1
        else:
            notdiv4 += 1

    notdiv4 += div2 % 2
    if notdiv4 - 1 > div4:
        print('No')
    else:
        print('Yes')

if __name__ == '__main__':
    main()
# Judge status: Accepted
N, K = [int(i) for i in input().split()]
res = 0

for i in range(K, N + 2) :
	sum_lasti = i * (2 * N + 1 - i)/2 #初項 N + 1 - i 項数 i 公差1 末項 Nの等差数列の和
	sum_firsti = ( i * i - i )/ 2 #初項 0 項数 i 公差1 末項 i-1の等差数列の和
	
	res += sum_lasti - sum_firsti + 1

print(int(res%1000000007))
# Judge status: Accepted
x,y,z= map(int,input().split())
print(x*y//2)
# Judge status: Accepted
a,b,c=[int(i)for i in input().split()]
d=b//a
print(min(d,c))
# Judge status: Accepted
N, K = map(int, input().split())

treats = [False] * N
for _ in range(K):
	d = int(input())
	As = map(int, input().split())
	for A in As:
		treats[A - 1] = True

count = 0
for t in treats:
	if not t:
		count += 1

print(count)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
m = 1000
i = 0
while i < n - 1:
    for j in range(i + 1, n):
        if a[i] < a[j]:
            m = m // a[i] * a[j] + m % a[i]
        else:
            i = j
            break
print(m)
# Judge status: Accepted
n = int(input())
al = list(map(int, input().split()))

als = list(sorted(al))

x = als[n//2]
y = als[n//2-1]

for i in range(n):
    z = al[i]
    if z <=y:
        print(x)
    else:
        print(y)
# Judge status: Wrong Answer
def resolve():
    A, B = map(int, input().split())
    S = input()
    C = "1234567890"
    if S[A] == "-":
        S.replace(S[A], "0")
        for i in range(len(S)):
            if S[i] in C:
                continue
            else:
                print("No")
                exit()
        print("Yes")
        exit()
    else:
        print("No")
resolve()
# Judge status: Accepted
A,B,K = map(int,input().split())
if A+B<=K:
  print(0,0)
else:
  if A<=K:
    print(0,B-(K-A))
  else:
    print(A-K,B)
# Judge status: Wrong Answer
from collections import deque
import math
import os
import random
import re
import sys
#n=list(map(int, input().split()))
#n=map(int, input().split())

def main():
	din=int(input())
	ar=[1000,2000,3000,4000,5000]
	if din not in ar:
		print(din-1800)
	else:
		print(0)
		
main()

'''
if __name__ == '__main__':
    main()
'''
# Judge status: Wrong Answer
S = list(map(str,input()))

odd = ['R','U','D']
even = ['L','U','D']

for i in range(len(S)):
    if (i+1) == 0:
        if S[i] in odd:
            print('No')
            exit()
    elif (i+1) == 0:
        if S[i] in even:
            print('No')
            exit()
print('Yes')
# Judge status: Wrong Answer
k, a, b = map(int, input().split())

if k < (a + 2) or (b - a) <= 2:
    print(1 + k)
else:
    cnt = (k - (a - 1)) // 2
    mod = (k - (a - 1)) % 2
    ans = (b - a)*cnt + a + mod
    print(max(ans, k + 1))
# Judge status: Accepted
from math import pi
print(2*int(input())*pi)
# Judge status: Accepted
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
l = []
for i in range(n):
    k = (t-h[i]*0.006)
    l.append(abs(a-k))
print(l.index(min(l))+1)
# Judge status: Accepted
S, T = input().split()
A, B = map(int,input().split())
U = input()

dic = {}
dic[S] = A
dic[T] = B

dic[U] -= 1

print(dic[S],dic[T])
# Judge status: Wrong Answer
n = int(input())
f = [0]*21600
for x in range(1,60):
    for y in range(1,60):
        for z in range(1,60):
            f[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(f[i])
# Judge status: Accepted
import math
l=[]
l2=[]

l=list(map(str,input().split()))
d=int("".join(l))
for i in range(1,350):
 c=pow(i,2)
 l2.append(c)

if d in l2:
 print("Yes")
else :
 print("No")
# Judge status: Accepted
N = input()

if N[-1] in ['2', '4', '5', '7', '9']:
    print('hon')
elif N[-1] in ['0', '1', '6', '8']:
    print('pon')
else:
    print('bon')
# Judge status: Wrong Answer
from math import sqrt
from numba import njit
@njit
def divisors(n):
    divisors = []
    for i in range(1, int(sqrt(n))+1):
        q, r = divmod(n, i)
        if r == 0:
            divisors.append(i)
            if i != q:
                divisors.append(q)
    divisors.sort()
    return divisors

n, m = map(int, input().split())
ans = 1
for a in divisors(m)[1:-1]:
    if a*n <= m:
        ans = a
print(ans)
# Judge status: Wrong Answer
a=int(input())
b=int(input())
c=a+b
if c==3:
	print("2")
elif c==4:
	print("3")
else:
	print("1")
# Judge status: Accepted
from collections import Counter
s = input()

cnt = list(Counter(s).values())
if len(cnt) < 3: cnt.append(0)
print('YES' if max(cnt) - min(cnt) <= 1 else 'NO')
# Judge status: Wrong Answer
w, h, n = map(int, input().split())

min_x, max_x, min_y, max_y = 0, w, 0, h
for _ in range(n):
    x, y, a = map(int, input().split())

    if a == 1:
        min_x = x
    elif a == 2:
        max_x = x
    elif a == 3:
        min_y = y
    else:
        max_y = y

if max_x <= min_x or max_y <= min_y:
    print(0)
else:
    print((max_x - min_x) * (max_y - min_y))
# Judge status: Accepted
def main():
    n, a, b = map(int, input().split())
    mod = 10**9+7
    s = pow(2, n, mod)-1
    x = 1
    y = 1
    for i in range(1, b+1):
        x = x*(n-i+1)%mod
        y = y*i%mod
        if i==a or i==b:
            s -= x*pow(y, mod-2, mod)

    print(s%mod)

main()
# Judge status: Accepted
def main():
    n = int(input())
    s = input()
    ma = 0
    for i in range(1, n):
        x = s[:i]
        y = s[i:]
        ma = max(ma, count_same(x, y))
    print(ma)


def count_same(x, y):
    return len(set(x) & set(y))


if __name__ == '__main__':
    main()
# Judge status: Accepted
from numpy import*


n=int(input())
a=array(list(map(int,input().split())))
b=abs(a)


if 0 in a:
  print(sum(b));exit()
  
  
minus_cnt=sum(a<0)


if minus_cnt%2==0:
  print(sum(b));exit()
  
  
print(sum(b)-min(b)*2)
# Judge status: Accepted
n = int(input())
s = ""
while n != 0:
    s += str(-(n % -2))
    n = -(n//2)

if s == "":
    print(0)
else:
    print("".join(s[::-1]))
# Judge status: Accepted
s=int(input())
a= s//500
b=(s%500)//5
yasashisa=a*1000+b*5
print(yasashisa)
# Judge status: Accepted
S,W = map(int,input().split())

if W<S:
    print("safe")
else:
    print("unsafe")
# Judge status: Wrong Answer
n,m = map(int, input().split())
l,r = [0]*m,[0]*m
for i in range(m):
    l[i],r[i] = map(int,input().split())
s = min(n,min(r)) - min(n,max(l))
if (n < min(r)):
    s = 0
else:
    s += 1
print(s)
# Judge status: Wrong Answer
from scipy.misc import comb

url = "https://atcoder.jp//contests/abc094/tasks/arc095_b"

def main():
    input()
    t = list(map(int, input().split()))
    combs = {}
    for i in range(-1, -2, -1):
        for j in range(i, len(t)):
            tmp = sorted([t[i], t[j]], reverse=True)
            combs[comb(tmp[0], tmp[1], exact=True)] = tmp[::]
    key = max(combs.keys())
    print(' '.join([str(v) for v in combs[key]]))

if __name__ == '__main__':
    main()
# Judge status: Accepted
mod = 10 ** 9 + 7  # mod素数
def nCr(n, r, mod):
  ret = [1]*(r+1)
  for i in range(1, r+1):
    ret[i] = (ret[i-1] * (n-i+1) * pow(i,mod-2,mod)) % mod
  return ret
    
X,Y=map(int,input().split())
x,y = 2*X-Y, 2*Y-X
if x<0 or y<0 or x%3!=0 or y%3!=0:
  ret=0
else:
  x,y=x//3,y//3
  nCrl = nCr(x+y, min(x,y), mod)
  ret=nCrl[min(x,y)]
print(ret)
# Judge status: Accepted
X,A,B=map(int,input().split())
if X<B-A:
  print("dangerous")
elif B-A<=0:
  print("delicious")
else:
  print("safe")
# Judge status: Wrong Answer
import math
x,y=map(int,input().split())
ans=math.floor(math.log2(y/x))+1
print(ans)
# Judge status: Accepted
S = input()

print(S + "s" if S[-1] != "s" else S + "es")
# Judge status: Accepted
a, b, t = map(int, input().split())
print(b * (t // a))
# Judge status: Wrong Answer
N = input()
index = set()
for c in N:
    index.add(c)
if (len(index) <= 2):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]

dist_sum = 0
for n, i in enumerate(XY[:-1]):
    for j in XY[n+1:]:
        dist_sum += ((i[0] - j[0])**2 + (i[1] - j[1])**2) ** 0.5
print(dist_sum * 2 / N)
# Judge status: Wrong Answer
n = int(input())
a = []
for i in range(n):
  a.append(list(map(int,input().split())))

a.sort(key=lambda x: x[1])

q = 0
w = 0
flg = 0
for j in a:
  q += j[0]
  w += j[1]
  if q > w :
    flg = 1
    break

if flg == 0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n,a,b=map(int,input().split())
if a>b:
  print(0)
  exit()
if a==b:
  print(1)
  exit()
if n==1:
  print(0)
  exit()
minimum = a*(n-1)+b
maximum = b*(n-1)+a
if n<=2:
  print(1)
else:
  print(maximum-minimum+1)
# Judge status: Accepted
a,b = map(int,input().split())
if a<=5:
    print(0)
elif 6<=a and a<=12:
    print(int(b/2))
else:
    print(b)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
n = int(input())
word = input()
res = 0
num_r = 0

for charactor in word:
    if charactor == 'R':
        num_r += 1

num_w = 0
for i in range(num_r):
    if word[i] == 'W':
        num_w += 1

print(num_w)
# Judge status: Accepted
A,B,C = map(int,input().split())

if A < C < B or B < C < A:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())

d = 1
ans = 0

while True:
    if d > n:
        break
    else:
        if d * 10 <= n:
            ans += d * 9
        else:
            ans += n - d + 1
    d *= 100
print(ans)
# Judge status: Accepted
from collections import defaultdict
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)
# Judge status: Accepted
a,b = [x for x in input().split()]

ans = False
for i in range(1,1000):
    if i ** 2== int(a+b):
        ans = True
        break

if ans:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import itertools
num = str(input())
sign = ("+", "-")
for s1, s2, s3 in itertools.product(sign, repeat=3):
    result = num[0] + s1 + num[1] + s2 + num[2] + s3 + num[3]
    if eval(result) == 7:
        print(result+"=7")
        break
# Judge status: Wrong Answer
def main():
    A, B, C = map(int, input().split())

    ans = 0
    if (2 * A - B - C) == 0 and (2 * B - A - C) == 0 and (2 * C - A - B) == 0:
        print(-1)
    else:
        for i in range(10**5):
            if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
                print(ans)
                exit()

            A, B, C = (B + C)//2, (A + C)//2, (A + B)//2
            ans += 1

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()
if(s == t):
  print(len(s))
  exit()

tmp = []
i = 1
while True:
  if(s[-i] == t[i-1]):
    tmp.append(i-1)
    i += 1
  else:
    break
print(tmp)
t = list(t)
for i in range(len(tmp)):
  del t[tmp[i]]
t = ''.join(t)
print(len(s+t))
# Judge status: Accepted
s=list(input())
n=len(s)
dp=[0]*(n+1)
dp[0]=0
dp[1]=1
if n>=2:
  dp[2]=1+(1 if s[0]!=s[1] else 0)
  for i in range(2,n):
    if s[i]!=s[i-1]:
      dp[i+1]=dp[i]+1
    else:
      dp[i+1]=dp[i-2]+2
print(dp[n])
# Judge status: Wrong Answer
N=int(input())
if N>81:
  print("No")
for i in range(2,9):
  if N%i==0 and N<=i*9:
    print("yes")
    exit(0)
print("No")
# Judge status: Accepted
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]
ans = 0
for n in range(N):
    score = sum(A[0][:n + 1]) + sum(A[1][n:])
    ans = max(ans, score)
print(ans)
# Judge status: Wrong Answer
input_weather = input()
print(input_weather.count('R'))
# Judge status: Accepted
N,M=map(int,input().split())
if N%2==1:
    for i in range(1,M+1):
        a,b=i,N-i
        print(a,b)
else:
    for i in range(1,M+1):
        a,b=i,N-i
        if b-a<=N//2:
            a+=1
        print(a,b)
# Judge status: Accepted
import sys
A, B, C = list(map(int, input().split()))
if A % 2 != 0 or B % 2 != 0 or B % 2 != 0:
    print('0')
    sys.exit()
if A == B == C:
    print('-1')
    sys.exit()
cnt = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    _A = A
    _B = B
    _C = C
    A = _B // 2 + _C // 2
    B = _A // 2 + _C // 2
    C = _A // 2 + _B // 2
    cnt += 1
print(cnt)
# Judge status: Accepted
H=int(input())
print(2**(len(format(H,'b')))-1)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
temp=[0]*n
for i in range(0,n):
  temp[i]=a[i]-(i+1)
temp.sort()
ave=int(n/2)
ans=0
for i in range(0,n):
  ans=ans+abs(temp[i]-temp[ave])
print(ans)
# Judge status: Wrong Answer
N, K = (int(i) for i in input().split())
p = [int(i) for i in input().split()]
p_ex = [(i+1)/2 for i in p]
sum_list = [sum(p_ex[0:K]),sum(p_ex[N-K:N])]
tmp_num = sum_list[0]
if N == K:
  print(sum(p_ex))
else:
  for i in range(1,N-K):
    #print("i:"+str(i))
    tmp_num = tmp_num - p_ex[i-1] + p_ex[i+K]
    #print("  tmp_num = tmp_num - "+str(p_ex[i-1])+" + "+str(p_ex[i+K]))
    sum_list.append(tmp_num)
  print(max(sum_list))
# Judge status: Accepted
import math
n = int(input())

cards = [0] * n

for i in range(n):
  cards[i] = int(input())

ans = 0


for i in range(n):
  ans += math.floor(cards[i] / 2)
  cards[i] = cards[i] % 2
  if cards[i] == 1 and not(i == (n - 1)) and not(cards[i + 1] == 0):
    ans += 1
    cards[i + 1] = cards[i + 1] - 1

print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
s=list(input())
s[b-1]=(s[b-1]).lower()
print("".join(s))
# Judge status: Accepted
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
A, B = [list(i) for i in zip(*AB)]
t = 0
bl = True
for i in range(N):
    t += A[i]
    if t > B[i]:
        bl = False

print('Yes' if bl else 'No')
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

def gcd(x, y):
  if x < y: x, y = y, x
  if y == 0: return x
  return gcd(x % y, y)

L = [A[0]]
for i in range(1, n):
  L.append(gcd(L[-1], A[i]))

R = [A[-1]]
for i in range(n-2, -1, -1):
  R.append(gcd(R[-1], A[i]))
R = list(reversed(R))

ans = 1
for i in range(n):
  if i == 0: g = R[i+1]
  elif i == n-1: g = L[i-1]
  else: g = gcd(L[i-1], R[i+1])
  ans = max(ans, g)

print(ans)
# Judge status: Accepted
from math import *
x=int(input())
ans=[]
if x<4:
    print(1)
    exit()
for i in range(2,int(sqrt(x))+1):
    t=2
    while i**t<=x:
        ans.append(i**t)
        t+=1
print(max(ans))
# Judge status: Accepted
c = ['Sunny', 'Cloudy', 'Rainy', 'Sunny']
s = input()
print(c[c.index(s) + 1])
# Judge status: Wrong Answer
A,B,C=list(map(int,input().split()))
if A<=C<=B:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n = int(input())%10
if n in [2, 4, 5, 7, 9]:
    print("hon")
elif n in [0, 1, 6, 8]:
    print("pon")
else:
    print("bon")
# Judge status: Wrong Answer
a, b = list(map(int, input().split()))

print( a % b )
# Judge status: Accepted
def lcm(a, b):
    x, y = a, b
    while y != 0:
        x, y = y, x % y
    return a * b // x

N = int(input())
T = [int(input()) for _ in range(N)]

ans = 1
for t in T:
    ans = lcm(ans, t)
print(ans)
# Judge status: Wrong Answer
num = int(input())
a = num // 100
b = num // 10 - (a * 10)
c = num - (a * 100) - (b * 10)
print(a, b, c)
print(a + b + c)
# Judge status: Wrong Answer
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
  
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
N = int(input())
A = list(map(int, input().split()))

ans = 0
MOD = 10**9 + 7
GCD = gcd_list(A)
LCM = lcm_list(A)//GCD


for a in A:
  a == a//GCD
  ans += LCM//a
  ans = ans%MOD
  
print(ans)
# Judge status: Wrong Answer
from math import sqrt
from decimal import Decimal


def main():
    a, b, c = map(Decimal, input().split())
    print("Yes" if Decimal(sqrt(a)) + Decimal(sqrt(b)) < Decimal(sqrt(c)) else "No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
# B

from collections import Counter

n = int(input())
s_c = Counter([input() for x in range(n)])

print("AC x",s_c["AC"])
print("WA x",s_c["WA"])
print("TLE x",s_c["TLE"])
print("RE x",s_c["RE"])
# Judge status: Wrong Answer
import math
n = 2
sum = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            sum += math.gcd(math.gcd(k,j), i)

print(sum)
# Judge status: Accepted
a, b = map(int, input().split())
if a == b:
    print(a + b)
elif a - b >= 1:
    print(a + a - 1)
else:
    print(b + b - 1)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))

dp = [0] * n
dp[1] = abs(h[0] - h[1])

for i in range(2, n):
    dp[i] = min(abs(h[i] - h[i-1]) + dp[i-1], abs(h[i]- h[i-2])+dp[i-2])
    # print(dp)

print(dp[n-1])
# Judge status: Accepted
a, b, c = map(int, input().split())
ans = 'No'
if a+b >= c:
  ans = 'Yes'
print(ans)
# Judge status: Accepted
K,S=map(int,input().split())
count=0
for i in range(K+1):
    for j in range(K+1):
        if((S-i-j)<=K and 0<=S-i-j):
            count=count+1
print(count)
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
if abs(a-b)<=d and (b-c)<=d or abs(a-c)<=d:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()
a = s + ('es' if s[-1] == 's' else 's')
print(a)
# Judge status: Accepted
n, m = map(int, input().split())
lis = list(map(lambda z: int(z) - 1, map(int, input().split())))

s = {0}
res = [0]

while lis[res[-1]] not in s:
    res.append(lis[res[-1]])
    s.add(res[-1])

x, y = res.index(lis[res[-1]]), len(res)

if m < y:
    print(res[m] + 1)
else:
    mm = (m - x) % (y - x)
    print(res[mm + x] + 1)
# Judge status: Accepted
def main():
    n = int(input())
    d = list(map(int, input().split()))
    d_s = sorted(d)
    idx = int(n/2)
    diff = d_s[idx] - d_s[idx-1]
    print(diff)
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
k=n//100
nex=111*k
if nex>=n:
    print(nex)
else:
    print(nex+111)
# Judge status: Wrong Answer
import sys
a,b,c=map(int,input().split())
ans=0
if a%2==1 or b%2==1 or c%2==1:
    print(-1)
    sys.exit()
if a%2==0 and a==b==c:
    print(-1)
    sys.exit()
while a%2==0 and b%2==0 and c%2==0:
    ta=a/2
    tb=b/2
    tc=c/2
    a=tb+tc
    b=ta+tc
    c=ta+tb
    ans+=1
print(ans)
# Judge status: Accepted
import math

n = int(input())
csf = [list(map(int, input().split())) for i in range(n-1)]
ANS = []
for i in range(n):
  ans = 0
  for c,s,f in csf[i:]:
    if ans <= s:
      ans = s + c
    else:
      ans = s + math.ceil((ans-s)/f) * f + c
  ANS.append(ans)
for i in ANS:
  print(i)
# Judge status: Accepted
N, T  = map(int, input().split())
ct = []
for i in range(N):
  c,t = map(int, input().split())
  if t <= T:
    ct.append([c,t])

if ct == []:
  print("TLE")
else:
  ct.sort()
  print(ct[0][0])
# Judge status: Accepted
mass = int(input())
nums = list(map(int, input().split()))
c = 0
for i  in range(len(nums)):
    if nums[i]%2 ==1:
        i += 1
        if i%2 == 1:
            c += 1
            
print(c)
# Judge status: Wrong Answer
from collections import Counter

S = input()
T = input()

counter_S = Counter(S)
counter_T = Counter(T)
length_CS = len(counter_S)
length_CT = len(counter_T)

# print(counter_S)
# print(counter_T)

if length_CS != length_CT:
    print("No")
else:
    flag = True
    list_CS = list(counter_S.values())
    list_CT = list(counter_T.values())
    for i in range(length_CS):
        if list_CS[i] != list_CT[i]:
            flag = False
            break
    if flag:
        print("Yes")
    else:
        print("No")