Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N = int(input())
An = list(map(int,input().split()))
a = 1
if 0 in An:
    print("0")

else:
    for i in range(N):
        a *= An[i]
    if a <= 10**18:
        print(a)
    else:
        print("-1")

### FIXED CODE ###

import sys
N = int(input())
An = list(map(int,input().split()))
a = 1
if 0 in An:
    print("0")
    sys.exit()
else:
    for i in range(N):
        a *= An[i]
        if a > 10**18:
            print("-1")
            sys.exit()
    if a <= 10**18:
        print(a)
        sys.exit()
### BUGGY CODE ###

# coding=utf-8


def fib(number):
    if number == 0 or number == 1:
        return 1
    return fib(number-1) + fib(number-2)


if __name__ == '__main__':
    N = int(input())
    print(fib(N))



### FIXED CODE ###

# coding=utf-8


def fib(number):
    if number == 0 or number == 1:
        return 1
    memo1 = 1
    memo2 = 1

    for i in range(number-1):
        memo1, memo2 = memo1+memo2, memo1
    return memo1


if __name__ == '__main__':
    N = int(input())
    print(fib(N))
### BUGGY CODE ###

from scipy.sparse import*
h,w,*a=map(int,open(0).read().split())
print(int(sum(csgraph.dijkstra(csr_matrix([a[i*10:-~i*10]for i in range(10)]))[i][1]for i in a[100:]if i>=0)))

### FIXED CODE ###

from scipy.sparse import*
i=lambda:list(map(int,input().split()))
h,w=i()
c=csgraph.dijkstra(csr_matrix([i()for _ in[0]*10]))
print(int(sum(c[j][1]for i in eval('i(),'*h)for j in i if j>=0)))
### BUGGY CODE ###

from math import sqrt, ceil, factorial
from collections import Counter
m = 10**9+7

def prime_factorization(n):
    factor = []
    f = 2
    while n > 1:
        if n % f == 0:
            factor.append(f)
            n /= f
        else:
            f += 1
    return factor

def comb(n, r):
    a = 1
    for i in range(n-r+1, n+1):
        a *= i
    return a//factorial(r)

N, M = map(int, input().split())
p = prime_factorization(M)
c = Counter(p)
ans = 1
for v in c.values():
    ans *= (comb(v + N - 1, v) % m)
print(ans%m)

### FIXED CODE ###

from math import sqrt, ceil, factorial
from collections import Counter

m = 10**9+7
def is_prime(n):
    if n == 1: return False
    if n == 2: return True
    for i in range(2, ceil(sqrt(n))+1):
        if n % i == 0: return False
    return True

def prime_factorization(n):
    if is_prime(n):return [n]
    factor = []
    f = 2
    while n > 1:
        if n % f == 0:
            factor.append(f)
            n /= f
        else:
            f += 1
    return factor

def comb(n, r):
    a = 1
    for i in range(n-r+1, n+1):
        a *= i
    return a//factorial(r)

N, M = map(int, input().split())
p = prime_factorization(M)
c = Counter(p)
ans = 1
for v in c.values():
    ans *= (comb(v + N - 1, v) % m)
print(ans%m)
### BUGGY CODE ###

n = int(input())
List=list(map(int,input().split()))
total = 1
for i in range(n):
  total *= List[i]
if total >10**18: print(-1)
else:print(total)

### FIXED CODE ###

import numpy as np
n = int(input())
target = 1
List = list(map(int,input().split()))
if 0 in List:
  print(0)
  exit()
for i in range(len(List)):
  target*=List[i]
  if target>10**18 :
    print(-1)
    exit()
print(target)
### BUGGY CODE ###

n,k = map(int,input().split())
point = 0
for a in range(1,n+1):
    for b in range(1,n+1):
        if a%b >= k:
            point += 1
print(point)

### FIXED CODE ###

from sys import stdin
n,k = map(int,stdin.readline().rstrip().split())
point = 0
#n=p*b+r
for b in range(1,n+1):
    p = n//b
    r = n%b
    point += p*max(0,b-k)
    point += max(0,r-k+1)
if k == 0:
    point -= n
print(point)
### BUGGY CODE ###

N=int(input())
a=[int(i) for i in input().split()]
count=0
for j in range(N):
    print(a.count(j+1))


### FIXED CODE ###

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

d = {}

for i in range(N - 1):
    if A[i] in d:
        d[A[i]].append(i + 2)
    else:
        d[A[i]] = [i + 2]

for i in range(1, N + 1):
    if i in d:
        print(len(d[i]))
    else:
        print(0)
### BUGGY CODE ###

N,M = map(int, input().split(" "))
A=["" for i in range(N)]
B=["" for i in range(N)]
for i in range(N):
    A[i],B[i] = map(int, input().split(" "))
total_num=0
total_mon=0
while True:
    min_a = min(A)
    ind = A.index(min_a)
    add = B[ind]
    total_num+=add
    if total_num>=M:
        add = add - (total_num-M)
        total_mon+=add*min_a
        break
    total_mon+=add*min_a
    A.pop(ind)
    B.pop(ind)
print(total_mon)


### FIXED CODE ###

N,M = map(int, input().split(" "))
AB=["" for i in range(N)]
for i in range(N):
    A,B = map(int, input().split(" "))
    AB[i] = [A,B]
total_num=0
total_mon=0
AB = sorted(AB)
for i,t in enumerate(AB):
    add = t[1]
    total_num+=add
    if total_num>=M:
        add = add - (total_num-M)
        total_mon+=add*t[0]
        break
    total_mon+=add*t[0]
print(total_mon)
### BUGGY CODE ###

from itertools import product
import scipy.spatial as ss

H, W = map(int, input().split())
A = []
black = []
for i in range(H):
    tmp = input()
    A.append(tmp)
    black += [(i, j) for j in range(W) if tmp[j] == '#']
ans = 0
tree = ss.KDTree(black, leafsize=10)
for i, j in product(range(H), range(W)):
    if A[i][j] == '.':
        dist_nn_bl = int(tree.query((i,j), k=1, p=1)[0])
        ans = max(ans, dist_nn_bl)
print(ans)

### FIXED CODE ###

import numpy as np
from itertools import product
from collections import deque

H, W = map(int, input().split())
val = []
INF = 10**9
for i in range(H):
    tmp = input()
    val.append([0 if tmp[j] == '#' else INF for j in range(W)])
val = np.array(val)

for i in range(H-1):
    val[i+1, :] = np.minimum(val[i, :]+1, val[i+1, :])
for i in range(H-1, 0, -1):
    val[i-1, :] = np.minimum(val[i, :]+1, val[i-1, :])
for j in range(W-1):
    val[:, j+1] = np.minimum(val[:, j]+1, val[:, j+1])
for j in range(W-1, 0, -1):
    val[:, j-1] = np.minimum(val[:, j]+1, val[:, j-1])

print(val.max())
### BUGGY CODE ###

import sys,resource
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inm   = lambda:      map(int, input().split())
DBG = True # and False
R = 10**9 + 7

def setrlim():
  sys.setrecursionlimit(250000)
  soft,hard = resource.getrlimit(resource.RLIMIT_STACK)
  # setrlimit works on ubuntu (and atcoder), but not on WSL
  resource.setrlimit(resource.RLIMIT_STACK, (256*1024*1024,hard))

def dfs(i,fromup):
    y[i] = fromup + v[i]
    for d in dst[i]:
        dfs(d,y[i])

setrlim()
n,q = inm()
dst = [ [] for i in range(n) ]
for i in range(n-1):
    a,b = inm()
    a -= 1
    b -= 1
    dst[a].append(b)
v = [0]*n
for i in range(q):
    p,x = inm()
    p -= 1
    v[p] += x
y = [0]*n
dfs(0,0)
for i in range(n):
    printn((' ' if i>0 else '') + str(y[i]))
print("")


### FIXED CODE ###

import sys,resource
from collections import deque
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inm   = lambda:      map(int, input().split())
DBG = True # and False
R = 10**9 + 7

def setrlim():
  sys.setrecursionlimit(250000)
  soft,hard = resource.getrlimit(resource.RLIMIT_STACK)
  # setrlimit works on ubuntu (and atcoder), but not on WSL
  resource.setrlimit(resource.RLIMIT_STACK, (256*1024*1024,hard))

n,q = inm()
dst = [ [] for i in range(n) ]
for i in range(n-1):
    a,b = inm()
    a -= 1
    b -= 1
    dst[a].append(b)
v = [0]*n
for i in range(q):
    p,x = inm()
    p -= 1
    v[p] += x
y = [0]*n

d = deque([])
d.append(0)
while len(d)>0:
    i = d.popleft()
    for j in dst[i]:
        v[j] += v[i]
        d.append(j)

for i in range(n):
    printn((' ' if i>0 else '') + str(v[i]))
print("")
### BUGGY CODE ###

N=int(input())
H = list(map(int, input().split()))
I=[H[i]-H[i+1] for i in range(N-1)]
K=[]
for j in range(N-1):
  if I[j]>=0:
    K.append(1)
  else:
    K.append(0)
a=map(str,K)
S = ''.join(a)
i=0
while "1"*(i+1) in S:
  i+=1
print(i)

### FIXED CODE ###

N=int(input())
H = list(map(int, input().split()))
I=[H[i]-H[i+1] for i in range(N-1)]
a=0
n=0
j=0
while j<N-1:
  if I[j]>=0:
    j+=1
    n+=1
  else:
    j+=1
    a=max(n,a)
    n=0
a=max(n,a)
print(a)
### BUGGY CODE ###

import fractions
from functools import reduce
import sys

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


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


n = int(sys.stdin.readline())
l = [int(_) for _ in sys.stdin.readline().split()]
x = lcm_list(l)
ans = 0
for i in range(n):
    ans += x // l[i]
    ans %= (10**9 + 7)
print(ans)

### FIXED CODE ###

import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


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


n = int(input())
l = [int(_) for _ in input().split()]
x = lcm_list(l)
ans = 0
for i in range(n):
    ans += x // l[i]
ans %= (10**9 + 7)
print(ans)
### BUGGY CODE ###

a, b, n = map(int, input().split())
if a == 1 or b == 1:
    print(0)
else:
    ans = 0
    prev = 0
    for x in range(n+1):
        tmp = (a*x)//b - a*(x//b)
        if prev > 0 and tmp == 0:
            ans = prev
            break
        prev = tmp
    else:
        ans = prev
    print(ans)

### FIXED CODE ###

a, b, n = map(int, input().split())
print((a*min(b-1,n))//b)
### BUGGY CODE ###

MOD = 10 ** 9 + 7
qTable = [[(j * i) % 13 for j in range(13)] for i in range(11)]

S = input()

C, tC, qi = [1] + [0] * 12, [0] * 13,  1

for i in range(len(S)):
    if S[-(i + 1)] == '?':
        tC = [0] * 13
        for j in range(10):
            q = qTable[j][qi]
            for c in range(13):
                tC[(c + q) % 13] += C[c]
    else:
        q = qTable[int(S[-(i + 1)])][qi]
        for c in range(13):
            tC[(c + q) % 13] = C[c]

    qi = qTable[10][qi]
    for c in range(13):
        C[c] = tC[c] % MOD

print(C[5] % MOD)


### FIXED CODE ###

MOD = 10 ** 9 + 7
qTable = [[(j * i) % 13 for j in range(13)] for i in range(11)]

S = input()

C, tC, qi = [1] + [0] * 12, [0] * 13,  1

for i in range(len(S)):
    if S[-(i + 1)] == '?':
        tC = [0] * 13
        for j in range(10):
            q = qTable[j][qi]
            for c in range(13):
                tC[(c + q) % 13] += C[c]
    else:
        q = qTable[int(S[-(i + 1)])][qi]
        for c in range(13):
            tC[(c + q) % 13] = C[c]

    qi = qTable[10][qi]
    for c in range(13):
        C[c] = tC[c] % MOD

print(C[5] % MOD)
### BUGGY CODE ###

from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N = read()
S = input()

former = defaultdict(int)
latter = defaultdict(int)

for bits in range(1 << N):
  bs1 = []; rs1 = []; bs2 = []; rs2 = []
  for i in range(N):
    if (1 << i) & bits:
      rs1.append(S[i])
      rs2.append(S[-1-i])
    else:
      bs1.append(S[i])
      bs2.append(S[-1-i])
  former["".join(rs1), "".join(bs1)] += 1
  latter["".join(bs2), "".join(rs2)] += 1

ans = 0
for k, v in former.items():
  if k in latter:
    ans += v * latter[k]

print(ans)

### FIXED CODE ###

from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N = read()
S = input()

former = defaultdict(int)
latter = defaultdict(int)

for bits in range(1 << N):
  bs1 = []; rs1 = []; bs2 = []; rs2 = []
  for i in range(N):
    if (1 << i) & bits:
      rs1.append(S[i])
      rs2.append(S[-1-i])
    else:
      bs1.append(S[i])
      bs2.append(S[-1-i])
  former["".join(rs1), "".join(bs1)] += 1
  latter["".join(bs2), "".join(rs2)] += 1

ans = 0
for k, v in former.items():
  if k in latter:
    ans += v * latter[k]

print(ans)
### BUGGY CODE ###

import sys

n, k = map(int, input().split())

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

num_flag = [0 for i in range(n)]

for item in a:
    num_flag[item - 1] += 1

while 0 in num_flag:
    num_flag.remove(0)

num_flag.sort()

cnt = 0
while len(num_flag) > k:
    cnt += num_flag[0]
    num_flag.pop(0)

print("{}".format(cnt))

### FIXED CODE ###

import sys

n, k = map(int, input().split())

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

num_flag = [0 for i in range(n)]

for item in a:
    num_flag[item - 1] += 1

# while 0 in num_flag:
#     num_flag.remove(0)

# num_flag.sort()

# cnt = 0
# while len(num_flag) > k:
#     print(len(num_flag))
#     cnt += num_flag[0]
#     num_flag.pop(0)

num_flag.sort(reverse=True)

cnt = 0
for i in range(k):
    cnt += num_flag[i]

print("{}".format(n - cnt))
### BUGGY CODE ###

from collections import defaultdict
import bisect
n,m = map(int,input().split())
s = list(map(int,input().split()))
t = list(map(int,input().split()))
mod = 10**9+7
p = max(n,m)
if n>m:
  t.extend((0,)*(n-m))
else:
  s.extend((0,)*(m-n))
dcs = defaultdict(list)
dct = defaultdict(list)
dp = [[1 for i in range(p+1)] for j in range(p+1)]
for i in range(p):
  if s[i] != 0:
    dcs[s[i]].append(i)
  if t[i] != 0:
    dct[t[i]].append(i)
for i in range(1,p+1):
  for j in range(1,p+1):
    val = dp[i-1][j-1]
    x = s[i-1]
    y = t[j-1]
    if dct[x]:
      k = bisect.bisect_left(dct[x],j-1)
      if k != 0:
        val += dp[i][dct[x][k-1]+1]-dp[i-1][dct[x][k-1]+1]
    if dcs[y]:
      l = bisect.bisect_left(dcs[y],i-1)
      if l != 0:
        val += dp[dcs[y][l-1]+1][j]-dp[dcs[y][l-1]+1][j-1]
    if x == y:
      val += dp[i-1][j-1]
    dp[i][j] = val%mod
print(dp[-1][-1])

### FIXED CODE ###

from collections import defaultdict
import bisect
n,m = map(int,input().split())
s = list(map(int,input().split()))
t = list(map(int,input().split()))
mod = 10**9+7
p = max(n,m)
if n>m:
  t.extend((0,)*(n-m))
else:
  s.extend((0,)*(m-n))
dp = [[1 for i in range(p+1)] for j in range(p+1)]
for i in range(1,p+1):
  for j in range(1,p+1):
    x = s[i-1]
    y = t[j-1]
    if x == y:
      dp[i][j] = (dp[i-1][j]+dp[i][j-1])%mod
    else:
      dp[i][j] = (dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1])%mod
print(dp[-1][-1])
### BUGGY CODE ###

N = int(input())
A = [int(x) for x in input().split()]
assert(len(A) == N)
sum_now = 0
for i in range(N):
    for j in range(i+1,N):
        sum_now = (sum_now + A[i] * A[j]) % (1e9+7)
print(int(sum_now))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
s = sum(a)
ans = 0
mod = 10**9+7
 
for i in range(n-1):
    s -= a[i]
    ans += a[i]*s
 
print(ans%mod)
### BUGGY CODE ###

import collections,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,W = LI()
wv = [LI() for _ in range(N)]
dp = [collections.defaultdict(int) for _ in range(N+1)] #1_indexed
dp[0][0] = 0
for i in range(1,N+1):
    w,v = wv[i-1]
    for dw,dv in dp[i-1].items():
        dp[i][dw] = max(dp[i][dw],dv)
        if w+dw<=W:
            dp[i][w+dw] = max(dp[i][w+dw],v+dv)
print(max(dp[-1].values()))


### FIXED CODE ###

import itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,W = LI()
wv = [LI() for _ in range(N)]
V = N*10**3
dp = [[float('INF')]*(V+1) for _ in range(N+1)]
dp[0][0] = 0
for i,j in itertools.product(range(1,N+1),range(V+1)):
    w,v = wv[i-1]
    if j-v>=0:
        dp[i][j] = min(dp[i][j],dp[i-1][j-v]+w)
    dp[i][j] = min(dp[i][j],dp[i-1][j])
print(max([i for i in range(V+1) if dp[-1][i]<=W]))
### BUGGY CODE ###

from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,q = readInts()
G = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(lambda x: int(x) - 1,input().split())
    G[a].append(b)
    G[b].append(a)
val = [0] * n
for i in range(q):
    p,x = readInts()
    p -= 1
    val[p] += x

def dfs(v,p):
    if p != -1:
        val[v] += val[p]
    for nv in G[v]:
        if nv == p:
            continue
        dfs(nv,v)

dfs(0,-1)
print(*val)


### FIXED CODE ###

from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,q = readInts()
G = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(lambda x: int(x) - 1,input().split())
    G[a].append(b)
    G[b].append(a)
val = [0] * n
for i in range(q):
    p,x = readInts()
    p -= 1
    val[p] += x
stack = [(0,-1)]
while stack:
    v,p = stack.pop()
    for nv in G[v]:
        if nv == p:
            continue
        val[nv] += val[v]
        stack.append((nv,v))
# def dfs(v,p):
#     if p != -1:
#         val[v] += val[p]
#     for nv in G[v]:
#         if nv == p:
#             continue
#         dfs(nv,v)
#
# dfs(0,-1)
print(*val)
### BUGGY CODE ###

import collections as c

S = input()
N = len(S)
MOD = 2019
dp = [0] * (len(S))
dp[0] = int(S[-1])
for i in range(1,N):
    tmp = (int(S[-(i+1)]) * (10 ** i)) % 2019
    dp[i] = dp[i-1] + tmp
    dp[i] %= 2019 

D = c.Counter(dp)
ans = 0
for k,v in zip(D.keys(),D.values()):
    if k == 0:
        ans += v
        ans += v * (v - 1) //2
    elif v >= 2:
        ans += v * (v - 1) // 2

print(ans)

### FIXED CODE ###

from collections import defaultdict

S = input()
S = S[::-1]
N = len(S)
MOD = 2019
D = defaultdict(int)
res = 0
p = 1
for i in range(N):
    tmp = res + int(S[i]) * p
    tmp %= MOD
    D[tmp] += 1

    res = tmp
    p *= 10
    p %= 2019 

ans = 0
for k,v in zip(D.keys(), D.values()):
    if k == 0:
        ans += v
        ans += v * (v - 1) //2
    elif v >= 2:
        ans += v * (v - 1) // 2

print(ans)
### BUGGY CODE ###

from collections import Counter
from math import factorial
N = int(input())
A = list(map(int, input().split()))

Length = len(list(set(A)))

if (Length == len(A)):
    for i in range(N):
        print(0)
    exit()

c = Counter(A)
d = [0] * N
count = 0
for i in range(N):
    if (d[A[i]] != 0):
        print(d[A[i]])
        continue

    if (c[A[i]] == 1):
        for j, v in c.items():
            if (v == 1):
                continue
            else:
                count += factorial(v) // factorial(2) // factorial(v - 2)
    else:
        for j, v in c.items():
            if (v == 1):
                continue
            elif (j == A[i] and v - 1 != 1):
                count += factorial(v - 1) // factorial(2) // factorial(v - 3)
            elif (j == A[i] and v - 1 == 1):
                continue
            else:
                count += factorial(v) // factorial(2) // factorial(v - 2)
    d[A[i]] = count
    print(count)
    count = 0


### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))

allCount = 0
c = Counter(A)

for i, v in c.items():
    if (v == 1):
        continue
    else:
        allCount += v * (v - 1) // 2


if (allCount == 0):
    for i in range(N):
        print(0)
    exit()

for i in range(N):
    a = allCount
    num = c[A[i]] - 1
    if (num == 1 or num == 0):
        print(allCount - num)
        continue
    old = c[A[i]] * (c[A[i]] - 1) // 2
    count = num * (num - 1) // 2
    print(a - old + count)
### BUGGY CODE ###

N, K = map(int,input().split())
if K == 1 or N == 0 or N == K:
    print(0)
    exit()
elif K == 0:
    print(N)
    exit()
elif N == 1 or N == K-1 or K == N-1:
    print(1)
    exit()
else:
    res = []
    ans = N
    for i in range(max(N,K)):
        ans = abs(ans - K)
        res.append(ans)
        if i >= 2:
            if res[i] == res[i-2]:
                print(min(res))
                exit()
    print(min(res))

### FIXED CODE ###

N, K = map(int,input().split())
if K == 1 or N == 0 or N == K or N%K==0:
    print(0)
elif K == 0:
    print(N)
elif N == 1 or N == K-1 or K == N-1 or N%K==1:
    print(1)
elif N > K:
    res = abs(N - (K*(N//K)))
    if abs(res - K) < res:
        print(abs(res-K))
    else:
        print(res)
elif K > N:
    if abs(K-N) < N:
        print(abs(K-N))
    else:
        print(N)
### BUGGY CODE ###

n, q = map(int, input().split())
a = [2 ** 31 - 1] * n
for _ in range(q):
    query = input().split()
    if query[0] == '0':
        s, t, x = map(int, query[1:])
        a[s:t + 1] = [x] * (t - s + 1)
    else:
        print(a[int(query[1])])

### FIXED CODE ###

from math import log2, ceil


class SegmentTree:
    def __init__(self, n):
        tn = 2 ** ceil(log2(n))
        self.a = [2 ** 31 - 1] * (tn * 2)

    def find(self, c, l, r, i):
        if self.a[c] != -1:
            return self.a[c]
        mid = (l + r) // 2
        if i <= mid:
            return self.find(c * 2, l, mid, i)
        else:
            return self.find(c * 2 + 1, mid + 1, r, i)

    def update(self, c, l, r, s, t, x):
        if l == s and r == t:
            self.a[c] = x
            return
        cv = self.a[c]
        if cv != -1:
            self.a[c * 2] = self.a[c * 2 + 1] = cv
            self.a[c] = -1
        mid = (l + r) // 2
        if t <= mid:
            self.update(c * 2, l, mid, s, t, x)
        elif s > mid:
            self.update(c * 2 + 1, mid + 1, r, s, t, x)
        else:
            self.update(c * 2, l, mid, s, mid, x)
            self.update(c * 2 + 1, mid + 1, r, mid + 1, t, x)


n, q = map(int, input().split())
st = SegmentTree(n)
for _ in range(q):
    query = input().split()
    if query[0] == '0':
        s, t, x = map(int, query[1:])
        st.update(1, 0, n - 1, s, t, x)
    else:
        print(st.find(1, 0, n - 1, int(query[1])))
### BUGGY CODE ###

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

def factorize(x):
    """xの素因数分解を表す辞書 {素因数: 指数}"""
    f = {}
    d = 2
    while x > 1:
        c = 0
        while x % d == 0:
            c += 1
            x //= d
        f[d] = c
        d += 1
        if d * d > x > d:
            d = x
    return f

def dropmin(ls):
    """[min(ls[:i] + ls[i + 1:]) for i in range(len(ls))]"""
    # l = [min(ls[:i]) for i in range(len(ls))]
    l = [float('inf')] * len(ls)
    for i in range(1, len(ls)):
        l[i] = min(l[i - 1], ls[i - 1])
    # r = [min(ls[i + 1:]) for i in range(len(ls))]
    r = [float('inf')] * len(ls)
    for i in range(len(ls) - 2, -1, -1):
        r[i] = min(r[i + 1], ls[i + 1])
    return [min(a, b) for a, b in zip(l, r)]

def prod(ls):
    p = 1
    for x in ls:
        p *= x
    return p

# 各A_iの素因数
F = [factorize(a) for a in A]

# 素因数の集合 (2要素に出現しない素因数は無視)
D =  set(F[0].keys())
D.update(F[1].keys())

# Dの要素 d → dが各A_iに含まれる個数のリスト
X = {d: [f[d] if d in f else 0 for f in F] for d in D}

# Dの要素 d → A_iを削除したときのdの個数の最小値のリスト
X = {d: dropmin(X[d]) for d in D}

S = [prod(d ** X[d][i] for d in D if X[d][i] > 0) for i in range(N)]
print(max(S))


### FIXED CODE ###

# math.gcd is introduced in python 3.5
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

N = int(input())
A = [int(a) for a in input().split()]

# L[i] = gcd(A[:i + 1])
# R[i] = gcd(A[i:])
L = [0] * N
L[0] = A[0]
for i in range(1, N):
    L[i] = gcd(L[i-1], A[i])
R = [0] * N
R[-1] = A[-1]
for i in range(N - 2, -1, -1):
    R[i] = gcd(R[i+1], A[i])

G = [0] * N
G[0]  = R[1]
G[-1] = L[-2]
for i in range(1, N - 1):
    G[i] = gcd(L[i-1], R[i+1])

print(max(G))