peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import math

area = int(input())

sq = int(math.sqrt(area))
# sq <= sqrt(area)  < sq + 1

if (sq ** 2) <= area <= sq * (sq + 1):
    # li = [0, -1, sq, 0, sq * (sq + 1) - area, sq]
    li = [0, 0, sq, 1, sq * (sq + 1) - area, sq + 1]
elif sq * (sq + 1) <= area <= (sq + 1) ** 2:
    li = [0, 1, sq+1, 0, -(sq * (sq + 1) - area), sq + 1]

print(' '.join(map(str, li)))
# Judge status: Wrong Answer
from itertools import combinations as combi
N, X, Y = map(int, input().split(" "))

main_list = list(combi(list(range(1, N + 1)), 2))
dis_list = [0] * (N - 1)

for c in main_list:
    x = c[0]
    y = c[1]
    if x <= X and y >= Y:
        dis = (X - x) + (y - Y) + 1
    else:
        dis = y - x
    dis_list[dis - 1] += 1


for c in dis_list:
    print(c)
# Judge status: Wrong Answer
a, b, c, k = map(int, input().split())
x = 0
if k == 0:
  print (a - b)
elif a == b and b == c:
  print(0)
else:
  while x < k:
  	d = b + c
  	e = c + a
  	f = a + b
  	x += 1
  print (d - e)
# Judge status: Wrong Answer
# coding: utf-8
N, M = map(int, input().split())
ans = 1
for d in range(1, int(M**0.5)+1):
    if M % d == 0 and d <= M / N:
        ans = max(ans, d)
        if M // d <= M // N:
            ans = max(ans, d)
print(ans)
# Judge status: Accepted
import collections


class Solution:
    def solve(self, N: int, B) -> int:

        answer = B[0]

        for i in range(1, N-1):
            answer += min(B[i-1], B[i])

        answer += B[N-2]

        return answer


if __name__ == '__main__':

    # standard input
    N = int(input())
    B = list(map(int, input().split()))

    # solve
    solution = Solution()
    answer = solution.solve(N, B)
    print(answer)
# Judge status: Accepted
s=input()
if 'A' in s and 'B' in s:
    print("Yes")
else:print("No")
# Judge status: Wrong Answer
N = int(input())
H = list(map(int, input().split()))
for i in range(N-1):
    if H[i] > H[i+1]:
        H[i] -= 1
        if H[i] > H[i+1]:
            break
        
for i in range(N-1):
    if H[i] > H[i+1]:
        print('No')
        break
else:
    print('Yes')
# Judge status: Wrong Answer
n,a,b = map(int,input().split())

result = 0
if (a-b)==0:
    result = 0
elif (a-b)%2==0:
    result = (abs(a-b)//2)
elif (a-b)%2==1:
    # min distance to top or bottom
    top = max(a-1,b-1)
    bot = max(n-a,n-b)
    dist = min(top,bot)
    result = dist

print (result)
# Judge status: Wrong Answer
x, a, b = map(int, input().split())

now = b - a

if (now < 0):
   print('delicious')
elif (now > x):
   print('dengerous')
else:
   print('safe')
# Judge status: Accepted
n=int(input())
mod=pow(10,9)+7
ans=pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod)
print(ans%mod)
# Judge status: Wrong Answer
S, W = map(int, input().split())
    # S,W = input().split()
    # S = int(S)
    # W = int(W)
if S >= W:
    print("safe")
else:
    print("unsafe")
# Judge status: Accepted
a, b, x = map(int, input().split())
print(b//x - (a - 1)//x)
# Judge status: Accepted
N, A, B, C, D = map(int, input().split())
S = input()

from sys import exit

# check
goal = max(C, D)
if "##" in S[A-1:goal]:
    print("No")
    exit()

if C < D:
    # Bから先に動く
    print("Yes")

else:
    # 入れ替わる必要がある

    # cehck : 初期値で入れ替えられる
    if "..." in S[B-2:D+1]:
    # if ('...' in S[B-1:D]) or ('...' in S[B-2:B+1]) or ('...' in S[D-2:D+1]):
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
A,B=map(int, input().split())
if A>=13:
    print(B)
elif ((A>=6) & (A<=12)):
    print(int(B/2))
else:
    print("0")
# Judge status: Accepted
import sys
def input():return sys.stdin.readline().strip()

def main():
    N, H = map(int, input().split())
    info = [tuple(map(int, input().split())) for _ in range(N)]
    A_MAX = max(a for a, _ in info)
    Bs = [b for _, b in info if b > A_MAX]

    Bs.sort(reverse=True)
    ans = 0
    for b in Bs:
        if H <= 0:
            break
        ans += 1
        H -= b

    if H > 0:
        ans += (H + A_MAX-1)//A_MAX
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
deka=-1
for i in range(n):
  if deka>=A[i]+2:
    print("No")
    exit()
  deka=max(deka,A[i])
print("Yes")
# Judge status: Wrong Answer
import re
a,b = list(map(int,input().split()))
s = input()
if re.search(r"[1-9][1-9]*",s[0:a]):
  if s[a]=="-":
    if re.search(r"[1-9][1-9]*",s[(a+1):]):
      print("Yes")
      exit()
print("No")
# Judge status: Accepted
MOD = 10 ** 9 + 7
n, k = map(int, input().split())

def calc(a):
    smallest = a * (a-1) // 2
    largest = smallest + a * (n-a+1)
    return largest - smallest + 1


ans = 0
for a in range(k, n+2):
    ans += calc(a)
    ans %= MOD

print(ans)
# Judge status: Accepted
n = int(input())
if n>=64:
  print(64)
elif n>=32:
  print(32)
elif n>=16:
  print(16)
elif n>=8:
  print(8)
elif n>=4:
  print(4)
elif n>=2:
  print(2)
else:
  print(1)
# Judge status: Accepted
n=int(input())
print(n*800 - n//15 * 200)
# Judge status: Wrong Answer
N, Q = map(int, input().split())
S = input()
T = [0]*(N+1)

for i in range(1, N):
    T[i+1] = 1 if S[i-1:i+1]=='AC' else 0
for _ in range(Q):
    l, r = map(int, input().split())
    print(T[:r+1].count(1) - T[:l].count(1))
# Judge status: Accepted
N, K = map(int, input().split())
ashi = list(map(int, input().split()))
 
if N<=K:    
    print(abs(ashi[-1]-ashi[0]))
    exit()
 
arr = [0]*N
for i in range(1,K+1,1):
    arr[i] = abs(ashi[i]-ashi[0])
 
 
for i in range(K+1,N,1):
    x = arr[i-1]+abs(ashi[i]-ashi[i-1])
    for j in range(1,K+1,1):
        if arr[i-j]+abs(ashi[i]-ashi[i-j]) < x:
            x=arr[i-j]+abs(ashi[i]-ashi[i-j])
    arr[i] = x
 
print(arr[-1])
# Judge status: Accepted
N,A,B,C,D=map(int,input().split())
S=input()

c1=S[B-2:D+1].count('...')
c2=S[A-1:D].count('##')

if c2>=1:
    print('No')
    exit()
else:
    pass

if C>D and c1==0:
    print('No')
    exit()
else:
    pass


print('Yes')
# Judge status: Wrong Answer
a, b, h, m = map(int, input().split())

from math import sin, cos, sqrt, pi

jishin_rad = (h / 12 * 360) * pi / 180
funshin_rad = (m / 60 * 360) * pi / 180

jishin = (cos(jishin_rad)*a, sin(jishin_rad)*a)
funshin = (cos(funshin_rad)*b, sin(funshin_rad)*b)

x_diff = jishin[0] - funshin[0]
y_diff = jishin[1] - funshin[1]
print(sqrt(x_diff**2 + y_diff**2))
# Judge status: Accepted
N, M = map(int, input().split())
if N==M:
    print('Yes')
else :
    print('No')
# Judge status: Wrong Answer
S = input()
if 'L' in S[1::2] or 'R' in S[0::2]:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
N, A, B = map(int, input().split())

ret = (N // (A + B)) * A
ret += min(A, N % (A + B))

print(ret)
# Judge status: Wrong Answer

def solve():
    ans = "Yes"
    for i in range(N-1):
        if H[i+1] >= H[i]:
            continue
        elif H[i] - H[i+1] == 1:
            H[i] -= 1
        else:
            ans = "No"
            break
    print(ans)

if __name__ == "__main__":
    N = int(input())
    H = list(map(int, input().split()))  
    solve()
# Judge status: Wrong Answer
a=int(input())
print(int(a*(a-1)/2))
# Judge status: Accepted
from fractions import gcd

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


def division(x, p, q):
    return x - x // p - x // q + x // (p * q // gcd(p, q))


print(division(B, C, D) - division(A - 1, C, D))
# Judge status: Wrong Answer
N,M = map(int, input().split())
C = sorted([list(map(int, input().split())) for m in range(M)])
A = (N+1)*[0]
D = {}

for p,y in C:
  A[p]+=1
  D[y]="%06d%06d" % (p,A[p])

for p,y in C:
  print(D[y])
# Judge status: Wrong Answer
a,b,c=map(int,input().split("/"))
if a*10000+b*100+c<=20190430:
    print('HEISEI')
else:
    print('TBD')
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 30 20:19:25 2020

@author: black
"""


K, N = map(int, input().split())
li = list(map(int, input().split()))
li.append(K + li[0])
sub = [li[i+1]-li[i] for i in range(N)]
MAX = max(sub)
total = sum(sub)
print(total - MAX)
# Judge status: Accepted
A=sorted(list(map(int,input().split())))
print(A[-1]*2**int(input())+A[0]+A[1])
# Judge status: Accepted
s=input()
i=s.find('A')
j=s.rfind('Z')

print(abs(i-j)+1)
# Judge status: Accepted
from functools import reduce

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

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

n = int(input())
A = list(map(int, input().split()))
print(gcd_list(A))
# Judge status: Accepted
x, y = [int(x) for x in input().split()]

flg = False
for c in range(x+1):
    t = x-c
    flg |= y == (2 * c + 4 * t)

print("Yes" if flg else "No")
# Judge status: Wrong Answer
k,s = list(map(int,input().split()))

count=0
for x in range (k+1):
  for y in range(k+1):
    z = s - x - y
    if z < 0:
      continue
    count+=1
        
print(count)
# Judge status: Accepted
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    K = int(input())
    S = input()

    if len(S) > K:
        S = S[:K] + "..."

    print(S)

if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
if (b-a)%2:ans=(b-a-1)//2+min(a+1,n-b)
else:ans=(b-a)//2
print(ans)
# Judge status: Accepted
N = int(input())

def it(i,n):
    if i == N:
        yield [None]*N
    else:
        for x in range(n):
            for d in it(i+1,n):
                d[i] = x
                yield d
        for d in it(i+1,n+1):
            d[i] = n
            yield d

print(*(''.join(chr(x+ord('a')) for x in d) for d in it(0,0)), sep='\n')
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
ans = 0
for i in range(n-2):
    if max(p[i],p[i+1],p[i+2]) != p[i+1] and min(p[i],p[i+1],p[i+2]) != p[i+1]:
        ans += 1
print(ans)
# Judge status: Accepted

#ユークリッドの互除法( A < B　とし, O(logA))
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

N = int(input())

#3個以上の最大公約数を求める必要がある
# res=0 と初期化して、res=gcd(res,x[i])と更新する
# gcd(a,b,c,....) → gcd(gcd(gcd(a,b),c),...) 
res = 0
x = list(map(int,input().split()))

for i in range(N):
    res = gcd(res,x[i])

print(res)
# Judge status: Accepted
N,P = map(int, input().split())
A = list(map(int, input().split()))

n = 0
for a in A:
    if a % 2 == 0: n += 1
if N == n:
    if P == 0:
        ans = 2 ** N #選ぶか選ばないか => 2通り
    else: ans = 0
else: ans = 2 ** (N-1)
print(ans)
# Judge status: Accepted
N = int(input())
t = 0
x = 0
y = 0

for i in range(N):
    tt, xx, yy = map(int,input().split())
    if tt-t>=abs(xx-x)+abs(yy-y) and ((tt-t)-(abs(xx-x)+abs(yy-y)))%2==0:
        t = tt
        x = xx
        y = yy
    else:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
n,k=map(int,input().split())
c=0
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
l.sort()
for i in range(n):
    c+=l[i][1]
    if(c>=k):
        print(l[i][0])
        exit()
# Judge status: Wrong Answer
N = int(input())
in_list = input().split(' ')

judge_list = max([int(s)%2 for s in in_list])

if judge_list==1:
    print(0)
else:
    min_num = min([int(s) for s in in_list])
    amari = min_num%2
    counter = 0
    while amari == 0 :
        min_num = min_num/2
        amari = min_num%2
        counter += 1
    print(counter)
# Judge status: Accepted
#ABC063-C
n = int(input())
s = []
for _ in range(n):
    a =int(input())
    s.append(a)
s.sort()
flg = False
gokei = sum(s)
if gokei % 10 != 0:
    print(gokei)
else:
    for i in range(n):
        if gokei % 10 == 0 and s[i] % 10 != 0:
            gokei -= s[i]
            flg = True
            break
    if flg:
        print(gokei)
    else:
        print(0)
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    x = list(map(int, input().split()))
    if x.count(5) == 2 and x.count(7) == 1:
        print("YES")
    else:
        print("NO")
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
p = 0
for i in range(1,n+1):
  if i%2==1:
    p += 1
print(p/n)
# Judge status: Accepted
n,k = map(int,input().split())

B = input()
happy = 0
for i in range(n):
  if B[i]=="L" and i != 0 :
    if B[i-1] == "L":
      happy +=1
  if B[i]=="R" and i != n-1 :
    if B[i+1] == "R":
      happy +=1
print(min(happy+2*k, n-1))
# Judge status: Wrong Answer
a,b,x=map(int,input().split())
if a%x>0 and b%x>0:
    print(b//x-a//x)
else:
    print(b//x-a//x+1)
# Judge status: Wrong Answer
N, L = list(map(int, input().split()))

ans = sum(L + i for i in range(N))
if L < 0 and abs(L) > N:
    ans -= (N + L - 1)
elif L > 0:
    ans -= L
print(ans)
# Judge status: Wrong Answer
n,d = map(int,input().split())
l=list()
for _ in range(n):
  x,y=map(int,input().split())
  l.append([x,y])
count = 0
for x,y in l:
  if int((x**2+y**2)**0.5)<=d:
    count+=1
print(count)
# Judge status: Wrong Answer
S=input()
T=input()
l=len(S)
if S==T:
    print("Yes")
    exit()
 
for i in range(l+1):
    tmp=S[-1]
    S=S.strip(S[-1])
    new_string=tmp+S
    
    if new_string==T:
        print("Yes")
        exit()
    
    S=new_string
 
print("No")
# Judge status: Accepted
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7
 
S = list(readline().rstrip())
K = int(readline())
N = len(S)
for i,s in enumerate(S):
    t = ord(s)-97
    if t == 0:
        continue
    if 26 - t <= K:
        S[i] = 'a'
        K -= 26-t
S[-1] = chr((ord(S[i]) + K%26)%97+97)
print(''.join(S))
# Judge status: Accepted
import bisect

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
count = 0
lenA = len(A)
lenB = len(B)
lenC = len(C)
for b in B:
  count += (bisect.bisect_left(A, b))*(lenC-bisect.bisect_right(C, b))
print(count)
# Judge status: Accepted
s=input()
t=set()
for i in range(len(s)):
    t.add(s[i])
cnt=0
u=t.pop()
t.add(u)
for i in range(len(s)):
    if(u==s[i]):
        cnt+=1
#print(cnt)
if(cnt==2 and len(t)==2):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
print("Yes" if int("".join(input().split()))%4==0 else "No")
# Judge status: Wrong Answer
n, m = map(int, input().split())
print(int(n / 2 + m / 4))
# Judge status: Accepted
#142_D
from fractions import gcd
a, b = map(int, input().split())
ab = gcd(a, b)

def factorization(n):
    arr = [1]
    tmp = n
    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            while tmp % i == 0:
                tmp //= i
            arr.append(i)

    if tmp != 1:
        arr.append(tmp)

    if arr == []:
        arr.append(n)

    return arr

print(len(factorization(ab)))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
total=0
for i in range(N):
  total+=B[A[i]-1]
  if i!=0:
    if A[i]==A[i-1]+1:
      total+=C[A[i-1]-1]
print(total)
# Judge status: Wrong Answer
import bisect
def resolve():
    S = input()
    T = input()
    lenT = len(T)
    found = False
    for i in range(0, len(S)-lenT+1):
        for j in range(0, lenT):
            if not (S[i+j] == "?" or S[i+j] == T[j]):
                break
        else:
            S = S[:i] + T + S[i+lenT:]
            found = True
    if found:
        print(S.replace("?", "a"))
    else:
        print("UNRESTORABLE")

if '__main__' == __name__:
    resolve()
# Judge status: Accepted
N = int(input())
M=1000

while True:
  if N <= M:
    print(M-N)
    break
  else:
    M += 1000
# Judge status: Wrong Answer
N, M = map(int, input().split())

AB = []
for _ in range(N):
    A, B = map(int, input().split())
    AB.append((A, B))
AB = sorted(AB, key=lambda x: (-x[1], -x[0]))

ans = 0
for A, B in AB:
    if A <= M:
        ans += B
        M -= 1
        if M == 0:
            break
print(ans)
# Judge status: Wrong Answer
a = int(input())
b = int(input())
if a == 2 and b == 3:
    print('2')
elif a == 1 and b == 2:
    print('3')
else:
    print('1')
# Judge status: Accepted
X, Y = map(int, input().split())
if Y - 2 * X >= 0 and (Y - 2 * X) % 2 == 0 and 4 * X - Y >= 0 and (4 * X - Y) % 2 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from collections import deque
n,m=map(int,input().split())
a=deque(sorted(list(map(int,input().split())),reverse=True))
cnt=deque([0])
for i in range(m):
  if a[0]>=cnt[0]:
    a[0]=a[0]//2
    if i==0:
      cnt.pop()
    cnt.append(a[0])
    a.popleft()
    if len(a)==0:
      a.append(0)
  else:
    cnt[0]=cnt[0]//2 
    if len(cnt)>=2:
      if cnt[0]<=cnt[1]:
        a.append(cnt[0])
        cnt.popleft()
print(sum(a)+sum(cnt))
# Judge status: Accepted
n, k = [int(x) for x in input().split()]
a_list = [int(x) - 1 for x in input().split()]
ci = 0
while k:
    if k & 1:
        ci = a_list[ci]
    k >>= 1
    a_list = [a_list[a_list[i]] for i in range(n)]
print(ci + 1)
# Judge status: Wrong Answer
A,B = map(int,input().split())
if B % A == 0:
    print(B//A)
else:
    A -= 1
    print(B//A+1)
# Judge status: Accepted
a,b,c = map(int,input().split())
d = a - b
if d >= c:
    print(0)
else:
    print(abs(d - c))
# Judge status: Accepted
x,y = map(int,input().split())

a = y-x if y-x >= 0 else float("inf")
b = y+x+1 if y+x >= 0 else float("inf")
c = x-y+2 if x-y >=0 else float('inf')
d = -(y+x)+1 if x+y <=0 else float('inf')

print(min(a,b,c,d))
# Judge status: Accepted
from sys import stdin
def main():
    N = int(stdin.readline())
    ans = c = 0
    for _ in range(N):
        a = int(stdin.readline())
        if a:
            c += a
        else:
            ans += c >> 1
            c = 0
    print(ans + (c >> 1))
if __name__ == "__main__":
    main()
# Judge status: Accepted
A, B, C = map(int, input().split())
K = int(input())

ans = "No"
for a in range(K+1):
  for b in range(K+1):
    for c in range(K+1):
      if a+b+c<=K and (A<<a)<(B<<b)<(C<<c):
        ans = "Yes"
print(ans)
# Judge status: Accepted
k=int(input())
n,m=map(int,input().split())
f=0
for i in range(n,m+1):
    if i%k==0:
        f=1
if f==1:
    print('OK')
else:print('NG')
# Judge status: Wrong Answer
a, b = (int(x) for x in input().split())
c = a*b
if c%2:
    print("Even")
else:
    print("Odd")
# Judge status: Accepted
s = str(input())
k = int(input())
for i in range(len(s)):
    if s[i] != '1' or k - 1 == i:
        print(s[i])
        exit()
# Judge status: Accepted
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
d = Counter(a)
lg = 0
lt = 0
for k in d.keys():
  if d[k]>=2 and k>lg:
    lg = k
d[lg] -= 2
for k in d.keys():
  if d[k]>=2 and k>lt:
    lt = k
print(lg*lt)
# Judge status: Accepted
from collections import Counter

n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))

A = Counter(a)

ans = sum([1 for x in A.values() if x % 2 != 0])
print(ans)
# Judge status: Accepted
n = int(input())
H = list(map(int, input().split()))
H[0] -= 1
ans = 0

for i in range(n-1):
    if H[i] < H[i+1]:
        H[i+1] -= 1
    if H[i] > H[i+1]:
        ans = 1
        break

if ans == 0:
    print('Yes')
else:
    print("No")
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    x, a, b = map(int, input().split())
    print("A") if abs(x - a) < abs(x - b) else print("B")


if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
n, k = map(int, input().split())
x = list(map(int, input().split()))

x_cs = [0] * (n + 1)
for i in range(n):
    x_cs[i + 1] = x_cs[i] + x[i]

ans = x[-1] - x[0]
for i in range(n - k + 1):
    cand = x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]))
    ans = min(ans, cand)

print(ans)
# Judge status: Wrong Answer
from collections import Counter
d = Counter(list(input()))
if len(d) > 2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
def main():
    N, M = [int(x) for x in input().split()]
    H = [0] + [int(x) for x in input().split()]
    flag = [0] + [1] * N
    for _ in range(M):
        a, b = [int(x) for x in input().split()]
        if H[a] >= H[b]:
            flag[b] = 0
        if H[b] >= H[a]:
            flag[a] = 0
    
    print(sum(flag))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import numpy as np
n,m = [int(i) for i in input().split()]
p = np.zeros(m,dtype=int)
y = np.zeros(m,dtype=int)
for i in range(m):
    p[i],y[i] = [int(i) for i in input().split()]
for n in set(p):
    y[np.where(p == n)] = np.where(np.sort(y[p == n]))
for i in range(m):
    print(str(p[i]).zfill(6) + str(y[i]).zfill(6))
# Judge status: Accepted
from fractions import gcd
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
ans = 0
p = 1
for a in A:
    b = gcd(a,p)
    ans = (ans * (a//b) % MOD + (p//b))%MOD
    p = a*p//b
print(ans)
# Judge status: Accepted
button=list(map(int,input().split()))
button.sort()
sco = 0
sco += button[1]
button[1] -= 1
button.sort()
sco += button[1]
print(sco)
# Judge status: Accepted
import collections
N=int(input())
A=list(map(int,input().split()))
S=collections.Counter(A)
s=list(S.values())
num=0
for i in s:
  num+=i*(i-1)/2
for i in A:
  tmp=S[i]-1
  ans=int(num-tmp)
  print(ans)
# Judge status: Wrong Answer
n,k = map(int, input().split())

a,b = n,k
while b>0:
    a,b = b,a%b

if k==a:
    print(0)
else:
    print(a)
# Judge status: Accepted
n=int(input())
s=input()
e=[0]*n
w=[0]*n
for i in range(n):
  if s[i]=='W':
    w[i]+=1+w[i-1]
    e[i]=e[i-1]
  else:
    e[i]+=1+e[i-1]
    w[i]=w[i-1]
ans=10**6
for i in range(n):
  ans=min(ans,[w[i-1],0][i==0]+(e[-1]-e[i]))
print(ans)
# Judge status: Accepted
def gcd(x, y):
    if(y == 0):
        return x
        
    return gcd(y, x%y)
    
def lcm(x, y):
    return (x*y)//(gcd(x, y))


n = int(input())
x = []
for i in range(n):
    x.append(int(input()))
        
l = x[0]
for i in range(1, n):
    l = lcm(l, x[i])
        
print(l)
# Judge status: Accepted
a, b = map(int, input().split())
if a <= 9 and a>=1 and b<=9 and b>=1:
    print(a*b)
else: print(-1)
# Judge status: Accepted
a,b,c=map(int,input().split())
if b*2==a+c:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
# coding: utf-8
N = int(input())
C = list(input())

R_cnt = 0

for i in range(N):
    if C[i] == "R":
        R_cnt += 1

ans = 0

for i in range(R_cnt):
    if C[i] == "W":
        ans += 1

print(ans)
# Judge status: Accepted
def main():
	arr =[]
	for i in range(int(input())):
		arr.append(int(input()))
	ans = 0
	now = 0
	for i in arr:
		if i==0:
			ans = ans +(now//2)
			now = 0
		else:
			now = now+i
	ans= ans+(now//2)
	print(ans)
if __name__ =="__main__":
	main()
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
al = sorted(list(map(int, input().split())), reverse=True)

c = Counter(al)

l4 = []
l2 = []

for k, v in c.items():
    if v >= 4:
        l4.append(k)
    elif v >= 2:
        l2.append(k)

s1, s2 = 0, 0

if len(l4) > 0:
    s1 = l4[0]*2
if len(l2) >= 2:
    s2 = l2[0] * l2[1]

if s1 != 0 or s2 != 0:
    print(max(s1, s2))
else:
    print(0)
# Judge status: Accepted
a=[int(x) for x in input().split()]
a=sorted(a)
if((a[1]-a[0])%2==0):
    print((a[2]*3-sum(a))//2)
else:
    print(((a[2]+1)*3-sum(a))//2)
# Judge status: Accepted
N, M = map(int, input().split())
ans = 1

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)

    divisors.sort()
    return divisors


A = make_divisors(M)
for an, a in zip(A, A[1:]):
    ans = an
    if a * N > M:
        break
else:
    ans = M
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
ans_lis = [0]
check = False
count = 0
for i in range(N-1):
  if (check == True and A[i] < A[i+1]) or i == N-2:
    if A[i] >= A[i+1]:
      count += 1
    ans_lis.append(count)
    check = True
    count = 1
  elif check == False and A[i] >= A[i+1]:
    check = True
    count = 1
  elif check == True and A[i] >= A[i+1]:
    count += 1
print(max(ans_lis))
# Judge status: Wrong Answer
import numpy as np
N=int(input())
div = np.zeros(N+1, np.int64)
for n in range(1, N+1):
    for m in range(n, N+1, n):
        div[m] += 1
print(sum(div))
# Judge status: Accepted
import sys

P = set()
N = int(input())
for s in sys.stdin.readlines():
    n = int(s)
    if n in P:
        P.remove(n)
    else:
        P.add(n)

print(len(P))