Harryxun/stf_run huggingface dataset:
N=int(input())
ans=""
while N!=0:
    if N%2!=0:
        
        ans="1"+ans
        N-=1
    else:
        ans="0"+ans
    N=N/-2
if ans="":
    ans="0"
print(ans)


### FIXED CODE ###

N=int(input())
ans=""
while N!=0:
    if N%2!=0:
        
        ans="1"+ans
        N-=1
    else:
        ans="0"+ans
    N=N/-2   
if ans=="":
    ans="0"
print(ans)
a = []
for i in range(3)
    a.append(map(int, raw_input().split()))
print(a[0][0], a[1][1], a[2][2])

### FIXED CODE ###

#ABC90
a = [input() for i in range(3)]
print(a[0][0]+a[1][1]+a[2][2])
import sys

for i, num in enumerate(sys.stdin.read().splitlines()):
	print("Case "+ i +  ": " + num)

### FIXED CODE ###

import sys
cnt = 1

while 1:
  num=sys.stdin.readline().strip()
  if num == "0":
    break
  print('Case {0}: {1}'.format(cnt, num))
  cnt+=1
N, M, Q = map(int, input().split())

import itertools
from collections import defaultdict

seq = list(range(1, M+1))
dlist = defaultdict(list)
dres  = defaultdict(int)
Na    = 0

for i,v in enumerate(itertools.combinations(seq, N)):
    dlist[i] = v
    Na += 1

#print(seq)
#print(dlist)

#import numpy as np

#X = np.r_[[dlist[i] for i in range(Na)]]

#Y = np.zeros((Q, 4), dtype=int)

for i in range(Q):
    ai, bi, ci, di = map(int, input().split())
    #Y[i] = [ai, bi, ci, di]
    #print(ai-1, bi-1, ci, di)
    for j in range(Na):
        tmp = dlist[j]
        if tmp[bi-1] - tmp[ai-1] == ci:
            dres[j] += di
print(max([dres[i] for i in range(Na)]))

### FIXED CODE ###

import itertools
from collections import defaultdict

N, M, Q = map(int, input().split())


seq = list(range(1, M+1))
dlist = defaultdict(list)
dres  = defaultdict(int)
Na    = 0

for i,v in enumerate(itertools.combinations_with_replacement(seq, N)):
    dlist[i] = v
    Na += 1


for i in range(Q):
    ai, bi, ci, di = map(int, input().split())
    for j in range(Na):
        tmp = dlist[j]
        if tmp[bi-1] - tmp[ai-1] == ci:
            dres[j] += di
print(max([dres[i] for i in range(Na)]))
import sys

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

A.sort(reverse=True)

P = []
M = []
Ans = []
p = 0
m = 0

for i in range(N):
    if 0 <= A[i]:
        P.append(A[i])
    else:
        M.append(A[i])

M.sort()

if K % 2 == 1 and len(P) != 0:
    Ans.append(P[p])
    p += 1
elif K % 2 == 1 and len(P) == 0:
    M.sort(reverse=True)
elif len(M) == 0:
    answer = 1
    for i in range(K):
        answer = (answer * P[i]) % 1000000007

    print(answer)
    sys.exit()

while len(Ans) < K:

    #Mのストックがもうない時
    if m+1 >= len(M):
        Ans.append(P[p])
        if len(Ans) == K:
            break
        Ans.append(P[p + 1])
        p += 2
    elif p+1 >= len(P):
        Ans.append(M[m])
        if len(Ans) == K:
            break
        Ans.append(M[m + 1])
        m += 2
    elif m >= len(M):
        Ans.append(P[p])
        p += 1
    elif p >= len(P):
        Ans.append(M[m])
        m += 1
    else:
        if P[p]*P[p+1] < M[m]*M[m+1]:
            Ans.append(M[m])
            Ans.append(M[m+1])
            m += 2
        else:
            Ans.append(P[p])
            Ans.append(P[p + 1])
            p += 2

answer = 1
for i in range(K):
    answer = (answer * Ans[i]) % 1000000007

print(answer)


### FIXED CODE ###

import sys

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

A.sort(reverse=True)

P = []
M = []
Ans = []
p = 0
m = 0

for i in range(N):
    if 0 <= A[i]:
        P.append(A[i])
    else:
        M.append(A[i])

M.sort()

if K % 2 == 1 and len(P) != 0:
    Ans.append(P[p])
    p += 1
elif K % 2 == 1 and len(P) == 0:
    M.sort(reverse=True)
elif len(M) == 0:
    answer = 1
    for i in range(K):
        answer = (answer * P[i]) % 1000000007

    print(answer)
    sys.exit()

while len(Ans) < K:

    #Mのストックがもうない時
    if m+1 >= len(M) and p < len(P):
        Ans.append(P[p])
        if len(Ans) == K:
            break
        if p + 1 < len(P):
            Ans.append(P[p + 1])
            p += 2
        else:
            p += 1
        
    elif p+1 >= len(P) and m < len(M):
        Ans.append(M[m])
        if len(Ans) == K:
            break
        Ans.append(M[m + 1])
        m += 2
    elif m >= len(M) and p < len(P):
        Ans.append(P[p])
        p += 1
    elif p >= len(P) and m < len(M):
        Ans.append(M[m])
        m += 1
    else:
        if P[p]*P[p+1] < M[m]*M[m+1]:
            Ans.append(M[m])
            Ans.append(M[m+1])
            m += 2
        else:
            Ans.append(P[p])
            Ans.append(P[p + 1])
            p += 2

answer = 1
for i in range(K):
    answer = (answer * Ans[i]) % 1000000007

print(answer)
s = input()
if "BC" in s:
    s = s.replace("BC", "D")
else:
    print(0)
    quit()

pos = 0
str_len = len(s)
count = 0
seq_a = 0
seq_d = 0

while pos < str_len:
    if s[pos] == "A":
        while pos < str_len and s[pos] == "A":
            seq_a += 1
            pos += 1
        if s[pos] == "D":
            while pos < str_len and s[pos] == "D":
                seq_d += 1
                pos += 1
            count += seq_a * seq_d
            if pos < str_len and s[pos] != "A":
                seq_a = 0
            seq_d = 0
        else:
            pos += 1
            seq_a = 0
    else:
        pos += 1
        seq_a = 0

print(count)


### FIXED CODE ###

s = input()
pos = 0
str_len = len(s)
count = 0
seq_a = 0
seq_bc = 0

while pos < str_len:
    if s[pos] == "A":
        while pos < str_len and s[pos] == "A":
            seq_a += 1
            pos += 1
        if pos + 1 < str_len and s[pos] == "B" and s[pos+1] == "C":
            while pos < str_len and s[pos] == "B" and pos + 1 < str_len and s[pos+1] == "C":
                seq_bc += 1
                pos += 2
            count += seq_a * seq_bc
            if pos < str_len and s[pos] != "A":
                seq_a = 0
            seq_bc = 0
        else:
            pos += 1
            seq_a = 0
    else:
        pos += 1
        seq_a = 0

print(count)
n,k=map(int,input().split())
li=[[0,0] for i in range(n)]
for i in range(n):
    li[i][0],li[i][1]=map(int,input().split())

li.sort(reverse=True,key=lambda x:x[1])

def find_num_neta(choice,li):
    k=[]
    for i in choice:
        k.append(li[i][0])
    return len(set(k))

#-----------------------------------------
best_list=[]
best_list_neta=[]
not_best_list=[]

for i in li:
    if i[0] in best_list_neta:
        not_best_list.append(i[1])
    else:
        best_list.append(i[1])
        best_list_neta.append(i[0])


s2=min(len(best_list_neta),k)
s1=find_num_neta(list(range(k)),li)


score=-1
for i in range(s1,s2+1):
    oishisa=0
    for j in range(i):
        oishisa+=best_list[j]
    for j in range(k-i):
        oishisa+=not_best_list[j]
    
    new_score=i**2+oishisa

    if score<new_score:
        score=new_score
        
    
print(score)

### FIXED CODE ###

a,b,c=map(int,input().split())
print(int(a*b/2))
s=list(input)
a=[i for i in set(s) if s.count(i)>1]
print(a[0])

### FIXED CODE ###

a=input().split()
a.sort()
print(a[2] if a[0]==a[1] else a[0])
dist = [0]*5
for i in range(5):
    dist[i] = int(input())
k = int(input())

for i in range(5):
    for j in range(i):
        if abs(dist[j]-dist[i]) > k:
            exit(":(")

print("Yay!")

### FIXED CODE ###

dist = [0]*5
for i in range(5):
    dist[i] = int(input())
k = int(input())

for i in range(5):
    for j in range(i):
        if abs(dist[j]-dist[i]) > k:
            print(":(")
            exit()

print("Yay!")
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
M = [A, B, C, D, E]
N = []
n = []
T = 0
for i in range(5):
    if M[i] % 10 == 0:
        T += M[i]
    else:
        T += M[i]
        T += 10 - M[i] % 10
        n.append(M[i] % 10)
print(T - (10 - min(n)))

### FIXED CODE ###

M = [int(input()) for _ in range(5)]
m = []
T = 0
for i in range(5):
    if M[i] % 10 == 0:
        T += M[i]
    else:
        T += M[i]
        T += 10 - M[i] % 10
        m.append(M[i] % 10)
print(T - (10 - (10 if not m else min(m))))
import sys
N = input()
numlist = list(map(int, input().split()))

for i in range(N):
  if numlist[0] == numlist[i]:
    print('No')
    sys.exit()

print('Yes')

### FIXED CODE ###

import sys
N = int(input())
numlist = list(map(int, input().split()))

numlist.sort()
for i in range(N-1):
    if numlist[i] == numlist[i+1]:
        print('NO')
        sys.exit()

print('YES')
import collections
n = int(input())
S = [list(input()) for i in range(n)]
Sc = [collections.Counter(i) for i in S]


if n == 1:
    ans = "".join(S[0])
    ans.sort()
    print(ans)
else:
    counter = Sc[0] & Sc[1]
    for i in range(2, len(Sc)):
        counter = counter & Sc[i]

    Sclist = list(counter.elements())
    Sclist.sort()
    ans = "".join(Sclist)

    print(ans)


### FIXED CODE ###

import collections
n = int(input())
S = [list(input()) for i in range(n)]
Sc = [collections.Counter(i) for i in S]


if n == 1:
    S[0].sort()
    ans = "".join(S[0])
    print(ans)
else:
    counter = Sc[0] & Sc[1]
    for i in range(2, len(Sc)):
        counter = counter & Sc[i]

    Sclist = list(counter.elements())
    Sclist.sort()
    ans = "".join(Sclist)

    print(ans)
import numpy as np

n = int(input())
a = np.array(input().split(), dtype=np.int)
mod = 10**9 + 7
max_a = a.max()
sieve = [True] * (max_a // 2)
prime = [2]
p = 3
while p * p <= max_a:
  if sieve[p // 2 - 1]:
    prime.append(p)
    for i in range(p * p, max_a + 1, 2 * p):
      sieve[i // 2 - 1] = False
  p += 2
prime.extend([i for i in range(p, max_a + 1, 2) if sieve[i // 2 - 1]])
prime_dict = {p: idx for idx, p in enumerate(prime)}

pf = np.zeros((n, len(prime)), dtype=np.int)
for i in range(n):
  for j, p in enumerate(prime):
    if p * p > a[i]:
      break
    while a[i] % p == 0:
      a[i] //= p
      pf[i, j] += 1
  if a[i] > 1:
    pf[i, prime_dict[a[i]]] += 1
    
b_pf = pf.max(axis=0) - pf
b_sum = 0
for i in range(n):
  b = 1
  for j, p in enumerate(prime):
    b = b * p ** b_pf[i, j] % mod
  b_sum = (b_sum + b) % mod
print(b_sum)

### FIXED CODE ###

from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
mod = 10**9 + 7

lcm = 1
for i in range(n):
  lcm = lcm * a[i] // gcd(lcm, a[i])
lcm %= mod

sum_b = 0
for i in range(n):
  sum_b = (sum_b + lcm * pow(a[i], mod - 2, mod)) % mod
print(sum_b)
N,W=map(int,input().split())
dp=[0]*(W+1)
for i in range(N):
    w,v=map(int,input().split())
    for p,q in enumerate(dp.copy()):
        if p+w<=W:
            dp[p+w]=max(dp[p+w],q+v)
print(max(dp))

### FIXED CODE ###

from collections import *

N,W=map(int,input().split())
d=defaultdict(int)
d[0]=0
for i in range(N):
    w,v=map(int,input().split())
    c=d.copy()
    for p,q in c.items():
        if p+w<=W:
            d[p+w]=max(d[p+w],q+v)
print(max(d.values()))
import math
a,b,c,d = map(int,input().split())
x = b//c + b//d - b//(c*d//math.gcd(c,d))
y = (a-1)//c + (a-1)//d - (a-1)//(c*d//math.gcd(c,d))
print(b-(a-1)-x+y)


### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
x = b//c + b//d - b//(c*d//fractions.gcd(c,d))
y = (a-1)//c + (a-1)//d - (a-1)//(c*d//fractions.gcd(c,d))
print(b-(a-1)-x+y)
n, m, k = map(int, input().split())
if n <= k+1:
    print(m**n)
else:
    a = [m*((m-1)**(n-1))]
    b = [1]
    c = 0
    for i in range(k):
        b.append(int(b[-1]/(i+1)*(n-i-1))%998244353)
    for i in range(k):
        a.append(int(((a[-1]*b[i+1])%998244353)/b[i]/(m-1))%998244353)
    for i in range(k+1):
        c += a[i]
    print(c%998244353)

### FIXED CODE ###

n, m, k = map(int, input().split())
z = 998244353
if n <= k+1:
    a = 1
    for i in range(n):
        a = a*m%z
    print(a)
else:
    a = []
    b = []
    d = [1, 1]
    e = [1, 1]
    f = [0, 1]
    for i in range(2, n):
        d.append(d[-1]*i%z)
        f.append((-f[z%i]*(z//i))%z)
        e.append(e[-1]*f[-1]%z)
    for i in range(k+1):
        b.append(d[n-1]*e[i]*e[n-i-1]%z)
    x = 0
    g = [1]
    for i in range(n-1):
        g.append(g[i]*(m-1)%z)
    for i in range(k+1):
        a.append(b[i]*m*g[n-i-1]%z)
    for i in range(k+1):
        x = (x+a[i])%z
    print(x)
data = {
    'S':[int(x) for x in range(1,14)],
    'H':[int(x) for x in range(1,14)],
    'C':[int(x) for x in range(1,14)],
    'D':[int(x) for x in range(1,14)]
     }

n = int(input())
for nc in range(n):
    (s, r) = input().split()
    index = cards[s].index(int(r))
    del cards[s][index]
  
for s in ['S', 'H', 'C', 'D']:
    for r in cards[s]:
        print(s, r)

### FIXED CODE ###

cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
        }
  
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    r = int(r)
    cards[s][r - 1] = r
  
for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print( '{0:s} {1:d}'.format(s, r+1))
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i))


values = [i for i in range(N)]

dic = dict(zip(A, values))

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

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(C[i][2])

### FIXED CODE ###

input_AP = list(map(int, input().split()))
A = input_AP[0]
P = input_AP[1]

result = (A*3 + P)//2
print(result)
N= int(input())
E = [input().split()[2:] for _ in [0]*N]
Q = [0]
L = [0] + [-1]*N
def func(ide):
    for i in E[ide]:
        i = int(i) - 1
        if L[i] < 0 :L[i] = L[ide] +1 ;Q += [i]


while Q:top = Q.pop();func(top)

for i in range(N):print(i + 1 ,int(L[i]))



### FIXED CODE ###

N= int(input())
E = [input().split()[2:] for _ in range(N)]
Q = [0]
L = [0] + [-1]*N
frag = [1] + [0]*N
def func(ide):
    global Q
    for i in E[ide]:
        i = int(i) - 1
        if frag[i] != 1:frag[i] = 1;L[i] = L[ide] +1 ;Q.append(i)
        
    

while Q:top = Q[0];func(top);del Q[0]

for i in range(N):print(i + 1 ,int(L[i]))
a  = input()
s = 0
t = 0
k = ["0","1"]
for n,i in enumerate(a):
  if i != k[(n%2)]:
    s+=1
  if i != k[(n%2)+1]:
    t+=1
print(min(s,t))
  
  

### FIXED CODE ###

a  = input()
s = 0
t = 0
k = ["0","1"]
for n,i in enumerate(a):
  if i != k[(n%2)]:
    s+=1
  if i != k[(n+1)%2]:
    t+=1
print(min(s,t))
import sys
A, B, K = map(int, input().split())
box = list(range(A, B+1))
if K >= 2*len(box):
    box.sort()
    for i in box:
        print(i)
    sys.exit()
if A == B:
    if K >= 1:
        print(A)
        sys.exit()
    else:
        print()
        sys.exit()
box.sort()
temp1 = box[:K] + box[-K:]
temp = sorted(set(temp1), key=temp1.index)
temp.sort()
for i in temp:
    print(i)

### FIXED CODE ###

A, B, K = map(int, input().split())
L = [A+i for i in range(K) if A+i <= B]
R = [B-i for i in range(K) if B-i >= A]
S = set(L+R)
S = sorted(S)
for v in S:
    print(v)
whatMan = []

N, K = input().split()
wahtMan.extend(input().split())
print(wahtMan)

### FIXED CODE ###

whatMan = []

N, K = input().split()
for i in range(int(K)):
    input()
    whatMan.extend(input().split())
print(int(N) - len(set(whatMan)))
from sys import stdin
X,Y,A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]
Q = [int(x) for x in stdin.readline().rstrip().split()]
R = [int(x) for x in stdin.readline().rstrip().split()]

P.sort()
Q.sort()
R.sort()

P = P[A-X:]
Q = Q[B-Y:]

ans = 0

while True:
    if X > 0 and Y > 0:
        if P[-1] > Q[-1]:
            if P[-1] > R[-1]:
                ans += P.pop()
                X -= 1
            else:
                ans += R.pop()
        else:
            if Q[-1] > R[-1]:
                ans += Q.pop()
                Y -= 1
            else:
                ans += R.pop()
    elif X > 0 and Y == 0 and R:
        X -= 1
        if P[-1] < R[-1]:
            ans += R.pop()
        else:
            ans += P.pop()
    elif X == 0 and Y > 0 and R:
        Y -= 1
        if Q[-1] < R[-1]:
            ans += R.pop()
        else:
            ans += Q.pop()
    else:
        break
print(ans)

### FIXED CODE ###

from sys import stdin
X,Y,A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]
Q = [int(x) for x in stdin.readline().rstrip().split()]
R = [int(x) for x in stdin.readline().rstrip().split()]

P.sort(reverse=True)
Q.sort(reverse=True)

res = P[:X] + Q[:Y] + R
res.sort(reverse=True)

print(sum(res[:X+Y]))
N, M = map(int, input().split())
ans_num_lis = [0 for i in range(N)]
pre_ans_lis = [0 for i in range(N)]
ans_lis = [0 for i in range(N)]
for i in range(M):
  problem, result = input().split()
  problem_num = int(problem)
  if result == "WA":
    pre_ans_lis[problem_num] += 1
  if result == "AC" and not ans_num_lis[problem_num]:
    ans_num_lis[problem_num] = 1
    ans_lis[problem_num] = pre_ans_lis[problem_num]

print(sum(ans_num_lis), sum(ans_lis))

### FIXED CODE ###

N, M = map(int, input().split())
lis = [[] for _ in range(N)]
for _ in range(M):
  question, result = input().split()
  question = int(question)
  lis[question-1].append(result)  

AC_times = 0
WA_times = 0
for i in range(N):
  pre_WA_times = 0
  for j in lis[i]:
    passed = False
    if not passed:
      if j == "AC":
        passed = True
        WA_times += pre_WA_times
      elif j == "WA":
        pre_WA_times += 1
    if passed:
      AC_times += 1
      break
      
print(AC_times, WA_times)
round(r*r,0)

### FIXED CODE ###

rad = int(input())
S = round(rad*rad,0)
print(S)
N = raw_input()
N = int(N)

a = {}
for i in range(N):
	s_input = raw_input()
	if s_input in a:
		del a[s_input]
	else:
		a[s_input] = s_input

print(len(a))

### FIXED CODE ###

N = raw_input()
N = int(N)

num10 = N/10
num1 = N - num10*10

if num10 == 9 or num1 == 9:
	print('Yes')
else:
	print('No')
s=input()
ans=0
cnt=[]
for i in s:
    if i=="A" or i=="C" or i=="G" or i=="T":
        ans+=1
    else:
        cnt.append(ans)
        ans=0
print(max(cnt))


### FIXED CODE ###

s=list(input())
n=len(s)
ans=0
tmp=-10
cnt=[0]*20
for i in range(n):
    if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        cnt[i]=1
for i in cnt:
    if i==1:
        ans+=1
    else:
        if tmp<ans:
            tmp=ans
            ans=0
if tmp==-10:
    print(ams)
else:
    print(tmp)
n = raw_input()
nums = map(int, raw_input().split())
nums = nums.reverse()
print " ".join(map(str, nums))

### FIXED CODE ###

n = raw_input()
nums = map(int, raw_input().split())
nums.reverse()
print " ".join(map(str, nums))
N=int(input())
for i in range(N):
	a=map(int,input().split())
	a.sort()
	if a[0]**2+a[1]**2==a[2]**2:
		print("YES")
	else:
		print("NO")

### FIXED CODE ###

def d(a):
	return int(a)

N=int(input())
answer=""
for i in range(N):
	if answer!="":
		answer+="\n"
	a=input().split()
	
	a.sort(key=d)
	if int(a[0])**2+int(a[1])**2==int(a[2])**2:
		answer+="YES"
	else:
		answer+="NO"
print(answer)
import sys
import numpy as np
i8 = np.int64
mod = 10**9 + 7


def main(stdin):
    N, X = stdin[0], stdin[1:]
    D = X[1:] - X[:-1]
    f = 1
    for i in range(1, N):
        f *= i
        f %= mod
    A = np.cumsum(np.array([pow(i, mod - 2, mod) for i in range(N)], dtype=i8))
    A *= f
    A %= mod
    A[1:] *= D
    A %= mod
    print(np.sum(A) % mod)


if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', '(i8[:],)')(main)
    # b1: bool, i4: int32, i8: int64, double: f8, [:], [:, :]
    cc.compile()
else:
    from my_module import main
    stdin = np.array([int(_) for _ in open(0).read().split()])
    main(stdin)


### FIXED CODE ###

import itertools
mod = 10**9 + 7
stdin = [int(_) for _ in open(0).read().split()]
N, X = stdin[0], stdin[1:]
A = [pow(i, mod - 2, mod) for i in range(N)]
D = [0] + [a - b for a, b in zip(X[1:], X[:-1])]
f = 1
for i in range(1, N):
    f *= i
    f %= mod
A = [d * f * a % mod for d, a in zip(D, list(itertools.accumulate(A)))]
print(sum(A) % mod)
l=[]
x=0
l.append(x)
n=int(input())
s=input()
for i in s:
  if(i=='I'):
      x++
      l.append(x)
  if(i=='D'):
      x--
      l.append(x)
print(max(l))

### FIXED CODE ###

l=[]
x=0
l.append(x)
n=int(input())
s=input()
for i in s:
  if(i=='I'):
      x=x+1
      l.append(x)
  if(i=='D'):
      x=x-1
      l.append(x)
print(max(l))
def gcd(a,b):
    if a <= b:
        a,b = b,a
    if a%b == 0:
        return b
    else:
        return gcd(b,a%b)

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

L_gcd = [A[0]]
R_gcd = [A[-1]]

for i in range(1,N):
    L_gcd.append(gcd(L_gcd[i-1],A[i]))
    R_gcd.insert(0,gcd(A[N-i-1],R_gcd[0]))

ans = []
for i in range(N-2):
    ans.append(gcd(L_gcd[i],R_gcd[i+2]))
print(max(ans))

### FIXED CODE ###

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

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

L_gcd = [0]*(N+1)
R_gcd = [0]*(N+1)

for i in range(N):
    L_gcd[i+1] = gcd(L_gcd[i],A[i])
    R_gcd[N-i-1] = gcd(R_gcd[N-i],A[N-i-1])

ans = 0
for i in range(N):
    if gcd(L_gcd[i],R_gcd[i+1])>ans:
        ans = gcd(L_gcd[i],R_gcd[i+1])
    
print(ans)
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]

T = 1
for i in range(M-1):
    if a[i]+1==a[i+1]:
        T = 0
        break
if T == 0:
    print(0)
else:
    if N==1:
        print(1)
    elif N == 2:
        print(2)
    else:
        L = [0 for _ in range(N)]
        if 0 in a:
            L[0] = 0
            L[1] = 1 
        else:
            L[0] = 1
            if 1 in a:
                L[1] = 0
            else:
                L[1] = 2
        for i in range(2,N):
            S = i-2 in a
            T = i-1 in a
            U = i in a
            if U:
                L[i] = 0
            elif T:
                L[i] = L[i-2]%1000000007
            else:
                if S:
                    L[i] = L[i-1]%1000000007
                else:
                    L[i] = (L[i-1]+L[i-2])%1000000007
    print(L[-1])

### FIXED CODE ###

N,M = map(int,input().split())

a = [int(input())-1 for _ in range(M)]
T = 1
for i in range(M-1):
    if a[i]+1 == a[i+1]:
        T = 0
        break
if T == 0:
    print(0)
else:
    if N == 1:
        if M==0:
            print(1)
        else:
            print(0)
    else:
        L = [0 for _ in range(N)]
        for i in range(M):
            L[a[i]] = -1
        if L[0] == -1:
            L[1] = 1
        else:
            L[0] = 1
            if L[1] != -1:
                L[1] = 2
        for i in range(2,N):
            if L[i] != -1:
                if L[i-2] == -1:
                    L[i] = L[i-1]%1000000007
                elif L[i-1] == -1:
                    L[i] = L[i-2]%1000000007
                else:
                    L[i] = (L[i-1]+L[i-2])%1000000007
        print(L[-1])
a,b=map(int,input().split())
print(int(a*b))

### FIXED CODE ###

from fractions import Fraction
a,b=input().split()
a=Fraction(int(a),1)
b=Fraction(int(b[0]+b[2:]),100)
print(int(a*b))
N = input()
li = list(map(int, input().split()))

cnt = 0
while True:
  if 1 in (li % 2):
    break
  else:
    cnt += 1
print(cnt)


### FIXED CODE ###

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

    num_of_operation = 0
    is_dividable = True

    while True:
        for num in li:
            if num % 2 != 0:
                is_dividable = False
                break

        if not is_dividable:
            break

        for i in range(N):
            li[i] //= 2
        num_of_operation += 1

    print(num_of_operation)


if __name__ == '__main__':
    main()
from sys import stdin
a, b, c = [int(i) for i in stdin.readline().rstrip().split()]

print(max([10 * a + b + c, a + 10 * b + c, a + b + 10 * c])


### FIXED CODE ###

from sys import stdin
a, b, c = [int(i) for i in stdin.readline().rstrip().split()]

print(max([10 * a + b + c, a + 10 * b + c, a + b + 10 * c]))