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

H, W = map(int, input().split())
ch, cw = map(lambda x: int(x)-1, input().split())
dh, dw = map(lambda x: int(x)-1, input().split())
s = [input() for _ in range(H)]

E = [[[] for _ in range(W)] for _ in range(H)]
for h in range(H):
    for w in range(W):
        for i, j in [(0,1), (0,-1), (1,0), (-1,0)]:
            if (h+i<0 or w+j<0) or (h+i>=H or w+j>=W):
                continue
            if s[h+i][w+j] == '#':
                continue
            E[h][w].append((0, (h+i, w+j)))

        for i in range(-2, 3):
            for j in range(-2, 3):
                if i == 0 and j == 0:
                    continue
                if (h+i<0 or w+j<0) or (h+i>=H or w+j>=W):
                    continue
                if s[h+i][w+j] == '#':
                    continue
                E[h][w].append((1, (h+i, w+j)))


def dijkstra(h, w):
    import heapq
    hq = [(0, h, w)]
    heapq.heapify(hq)
    cost = [[float('inf')] * W for _ in range(H)]
    cost[h][w] = 0

    while hq:
        c, vh, vw = heapq.heappop(hq)
        if c > cost[vh][vw]:
            continue
        for d, (uh, uw) in E[vh][vw]:
            tmp = d + cost[vh][vw]
            if tmp >= cost[uh][uw]:
                continue
            cost[uh][uw] = tmp
            heapq.heappush(hq, (cost[uh][uw], uh, uw))
    return cost


dist = dijkstra(ch, cw)
ans = dist[dh][dw]
if ans == float('inf'):
    print(-1)
else:
    print(ans)

### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
ch, cw = map(lambda x: int(x)-1, input().split())
dh, dw = map(lambda x: int(x)-1, input().split())
s = [input() for _ in range(H)]

INF = 10**9
m = [[INF]*W for _ in range(H)]
m[ch][cw] = 0

q = deque()
q.append((ch, cw, 0))

cnt = 0
while q:
    cnt += 1
    h, w, n = q.popleft()
    for i, j in [(0,1), (0,-1), (1,0), (-1,0)]:
        if (h+i<0 or w+j<0) or (h+i>=H or w+j>=W):
            continue
        if m[h+i][w+j] <= n:
            continue
        if s[h+i][w+j] == '#':
            continue
        m[h+i][w+j] = n
        q.appendleft((h+i, w+j, n))

    for i in range(-2, 3):
        for j in range(-2, 3):
            if (h+i<0 or w+j<0) or (h+i>=H or w+j>=W):
                continue
            if m[h+i][w+j] <= n+1:
                continue
            if s[h+i][w+j] == '#':
                continue
            m[h+i][w+j] = n + 1
            q.append((h+i, w+j, n+1))
if m[dh][dw] == INF:
    print(-1)
else:
    print(m[dh][dw])
### BUGGY CODE ###

import heapq
def SME(Whole,start,end,L,ANS):
    A = []
    if end > N : end = N
    count = 0
    for i,x in enumerate(Whole[start:end]):
        heapq.heappush(A,[x,i])
    for j in range(start,end):
        a = heapq.heappop(A)
        for i in range(L):
            idx = a[1] + i
            try :
                if ANS[idx] == 0 and idx < end:
                    ANS[idx] = a[0]
                    count += 1
            except IndexError : continue
        if count > N * 0.99 : break
    for i in range(L):
        if ANS[i] == 0 : ANS[i] = min(Whole[:i+1])
    for i in range(L,N):
        if ANS[i] == 0 : ANS[i] = min(Whole[i+1-L:i+1])
    return ANS

[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ANS = [0]*N
start = 0
K = L * int(N ** 0.3 + 2 )
if K > N : K = N
end = K
while (end <= N):
    ANS = SME(A, start, end, L, ANS)
    start = end
    end += K 
for i in ANS[L-1:-1]:print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
### BUGGY CODE ###

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

C = [-1] * N
C[0] = 0
for n in range(1, N):
    for m in range(max(0, n-K), n):
        if C[n] < 0:
            C[n] = abs(H[n] - H[m]) + C[m]
        else:
            C[n] = min(abs(H[n] - H[m]) + C[m], C[n])

print(C[N-1])


### FIXED CODE ###

import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))

C = [-1] * N
C[0] = 0
for n in range(1, N):
    for m in range(max(0, n-K), n):
        C[n] = abs(H[n] - H[m]) + \
            C[m] if C[n] < 0 else min(abs(H[n] - H[m]) + C[m], C[n])

print(C[N-1])
### BUGGY CODE ###

from sys import setrecursionlimit


def f(i, links, dp):
  if dp[i] != -1:
    return dp[i]
  if len(links[i]) == 0:
    dp[i] = 0
  else:
    dp[i] = max(f(j, links, dp) for j in links[i]) + 1
  return dp[i]


setrecursionlimit(1000000)

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

links = [[] for _ in range(N)]
for _ in range(M):
  x, y = map(int, input().split())
  links[x - 1].append(y - 1)

dp = [-1] * N
print(max(f(i, links, dp) for i in range(N)))


### FIXED CODE ###

from sys import setrecursionlimit


def f(i, links, dp):
  if dp[i] != -1:
    return dp[i]
  if len(links[i]) == 0:
    dp[i] = 0
  else:
    dp[i] = max(f(j, links, dp) for j in links[i]) + 1
  return dp[i]


setrecursionlimit(1000000)

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

links = [[] for _ in range(N)]
for _ in range(M):
  x, y = map(int, input().split())
  links[x - 1].append(y - 1)

dp = [-1] * N
print(max(f(i, links, dp) for i in range(N)))
### BUGGY CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
N,M = map(int,input().split())
uf = UnionFind(N+1)
for i in range(M):
    A,B = map(int,input().split())
    uf.union(A,B)
Group = uf.all_group_members()
A = uf.roots()
Answer = 0
for h in range(len(Group)):
    Answer = max(Answer,len(Group[A[h]]))
print(Answer)

### FIXED CODE ###

N,M = list(map(int, input().split()))
ABs = [list(map(int, input().split())) for _ in range(M)]
par = [i for i in range(N+1)]
size = [1 for _ in range(N+1)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]
def same(x,y):
    return find(x) == find(y)
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    par[x] = y
    size[y] = size[x] + size[y]
    size[x] = 0

for AB in ABs:
    unite(AB[0],AB[1])
print(max(size))
### BUGGY CODE ###

import fractions
from functools import reduce


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


def lcm_list(n):
    return reduce(lcm, n)


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

mod = 10 ** 9 + 7

L = lcm_list(a)
ans = 0
for i in a:
    ans = (ans + (L // i) % mod) % mod

print(ans % mod)

### FIXED CODE ###

import fractions
from functools import reduce


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


def lcm_list(n):
    return reduce(lcm, n)


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

mod = 10 ** 9 + 7

L = lcm_list(a)
ans = 0
for i in a:
    ans += L // i

print(ans % mod)
### BUGGY CODE ###

N,K = input().split()

CalcList = tuple(range(int(K), int(N)+2))

#print(CalcList)

ans = 0

for i in CalcList:
    tmp = 0
    min = sum(range(0,i))
#    print(min)
    max = i * int(N) -min
#    print(max)

    tmp = max - min +1
    ans += tmp

ans = ans % (10 ** 9 +7)
    
print(ans)


### FIXED CODE ###

N,K = input().split()

CalcList = tuple(range(int(K), int(N)+2))
N = int(N)
#print(CalcList)

ans = 0

for i in CalcList:
    tmp = 0
    min = i * (i-1) /2
#    print(min)
    max = i * N -min
#    print(max)

    tmp = max - min +1
    ans += tmp

ans = ans % (10 ** 9 +7)
    
print(int(ans))
### BUGGY CODE ###

import math
num_limit = int(input())
s_limit = int(num_limit**0.5)
for i in range(1,num_limit+1):
    xyz_list = []
    xyz_count = 0
    s_limit = int(i ** 0.5)
    for j in range(1,s_limit+1):
        if i <= j**2:
            break
        for k in range(1,j+1):
            if i <= j**2 + k**2 + j*k:
                break
            for l in range(1,k+1):
                if i < j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    break
                elif i == j**2 + k**2 + l**2 + j*k + k*l + l*j:
                    if j > k:
                        if k > l:
                            xyz_count += 6
                        else:
                            xyz_count += 3
                    elif k == l:
                        xyz_count += 1
                    else:
                        xyz_count += 3
    print(xyz_count)

### FIXED CODE ###

num_limit = int(input())
num_list = [0] * num_limit
j_limit = int(num_limit ** 0.5)
for j in range(1,j_limit+1):
    for k in range(1,j + 1):
        for l in range(1,k+1):
            if num_limit >= j**2 + k**2 + l**2 + j*k + k*l + l*j:
                if j > k:
                    if k > l:
                        num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 6
                    else:
                        num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 3
                elif k > l:
                    num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 3
                else:
                    num_list[j**2 + k**2 + l**2 + j*k + k*l + l*j-1] += 1
for i in num_list:
    print(i)
### BUGGY CODE ###

k,n=map(int,input().split())
l1=list(map(int,input().split()))
l2 = [x+k for x in l1]
l=l1+l2
ans=[]
for i in range(n):
    ans.append(max(l[i+1:i+n])-l[i] )
print (min(ans))

### FIXED CODE ###

k,n,*a=map(int,open(0).read().split())
a+=[k+a[0]]
print(k-max(y-x for x,y in zip(a,a[1:])))
### BUGGY CODE ###

# E - Gluttony

import numpy as np

# np.arrayに変換する場合、sortedを使うよりnp.sortを使う方が速い(使わないとTLE)
N, K = map(int, input().split())
A = np.sort(np.array((list(map(int, input().split())))))
F = np.sort(np.array((list(map(int, input().split())))))[::-1]

lower = 0
upper = A[-1] * F[0]

# 達成可能な最高成績を二分探索する
while lower <= upper:
    result = (lower + upper) // 2
    if sum(np.clip(A - result//F, 0, None)) <= K: # resultを達成可能なAと実際のAの差異の総和が必要な修行コスト
        ans = result
        upper = result - 1
    else:
        lower = result + 1

print(ans)

### FIXED CODE ###

# E - Gluttony

import numpy as np

N, K = map(int, input().split())
A = np.array(sorted(list(map(int, input().split()))))
F = np.array(sorted((list(map(int, input().split()))), reverse = True))

lower = 0
upper = A[-1] * F[0]

# 達成可能な最高成績を二分探索する
while lower <= upper:
    result = (lower + upper) // 2
    # resultを達成可能なAと実際のAの差異の総和が必要な修行コスト
    # np.arrayの和を求める場合、sum(array)よりarray.sum()の方が速い(使わないとTLE)
    if np.clip(A - result//F, 0, None).sum() <= K:
        ans = result
        upper = result - 1
    else:
        lower = result + 1

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

import sys
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n = I()
    a = list(IL())
    sa = set(a)
    f = s = 0

    for rep in sa:
        if 4<=a.count(rep): 
            f = max(f,rep)
            s = max(s, rep)
        elif 2<=a.count(rep):
            l = [f,s,rep]
            l.sort()
            f = l[-1]
            s = l[-2]
    print(f*s)
    return

if __name__=='__main__':
    Main()

### FIXED CODE ###

import sys
from collections import Counter
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n = I()
    l = list(IL())
    a = Counter(l)
    f = s = 0
    l = list(set(l))
    l.sort(reverse=True)
    for rep in l:
        if 4<=a[rep]:
            f = max(f,rep)
            s = max(s,rep)
            break
        elif 2<=a[rep]:
            if f==0:
                f = rep
            else:
                s = rep
                break
    
    print(f*s)
    return

if __name__=='__main__':
    Main()
### BUGGY CODE ###

# coding: utf-8
# Your code here!

from collections import defaultdict

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

memo = defaultdict(int)
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
    
for a in A:
    divisors = make_divisors(a)
    for divisor in divisors:
        memo[divisor] += 1

max_divisor = 1        
for k,v in memo.items():
    if v >= N - 1:
        max_divisor = max(max_divisor, k)
        
print(max_divisor)

### FIXED CODE ###

# coding: utf-8
# Your code here!

from collections import defaultdict
import copy

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

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
    
max_divisor = 0
for a in A[:2]:
    divisors = make_divisors(a)
    
    for divisor in divisors:
        if divisor > max_divisor:
            nondivisable = 0
            for a in A:
                if a % divisor != 0:
                    nondivisable += 1
                if nondivisable > 2:
                    break
                
            if nondivisable <= 1:
                max_divisor = divisor
            
            
print(max_divisor)
### BUGGY CODE ###

K = int(input())
seven = 7
count = 0

if(K % 2 == 0 or K % 5 == 0):
    print(-1)
if(K == 7 or K == 1):
    print(1)
else:
    while(seven % K != 0):
        seven = (seven * 10 + 7) % K
        count += 1
    print(count+1)
    """
    for i in range(1,10**6):
        seven = (seven * 10 + 7) % K
        if(seven % K == 0):
            print(i+1)
            break
    """

# これだと10^5以降の計算が遅くなる。countのせい？？
# count += 1
# seven = seven + 7 * (10 ** count)

### FIXED CODE ###

K = int(input())
seven = 7
count = 0

if(K % 2 == 0 or K % 5 == 0):
    print(-1)
if(K == 7 or K == 1):
    print(1)
else:
    for i in range(1,10**6):
        seven = (seven * 10 + 7) % K
        if(seven % K == 0):
            print(i+1)
            break

        # これだと10^5以降の計算が遅くなる。countのせい？？
        # count += 1
        # seven = seven + 7 * (10 ** count)
### BUGGY CODE ###

n, k = map(int, input().split())
p = map(int, input().split())
p_e = list(map(lambda x: sum([i for i in range(1, x+1)]) / x, p))

max_e = -1
for i in range(n - k + 1):
    v = sum([p_e_j for p_e_j in p_e[i:i+k]])
    if max_e < v:
        max_e = v
print(max_e)

### FIXED CODE ###

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

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n+1)]
print(max(e_sum))
### BUGGY CODE ###

import sys
from collections import deque
def input(): return sys.stdin.readline().rstrip()
S = deque(input())
Q = int(input())
rev = False
apdlft = S.appendleft
apd = S.append

for _ in range(Q):
    q = input().split()
    if q[0] == '1':
        rev = not(rev)
    else:
        if (q[1]=='1' and rev is False) or (q[1]=='2' and rev is True):
            apdlft(q[2])
        else:
            apd(q[2])

for i in list(range(len(S)) if rev is False else reversed(range(len(S)))):
    print(S[i], end="")
else:
    print("")

### FIXED CODE ###

import sys
from collections import deque
def input(): return sys.stdin.readline().rstrip()
S = deque(input())
rev = False
apdlft = S.appendleft
apd = S.append

for _ in range(int(input())):
    q = input().split()
    if q[0] == '1':
        rev = not(rev)
    else:
        if (q[1]=='1' and rev is False) or (q[1]=='2' and rev is True):
            apdlft(q[2])
        else:
            apd(q[2])

if rev:
    print((''.join(S))[::-1])
else:
    print(''.join(S))
### BUGGY CODE ###

MOD = 1000000007;

s = input()

if len(s)<1 or len(s)>10**5:
	print ('Illegal')
	exit()

n=len(s)

#a=[-1]*len(s)
b=[[0 for i in range(13)] for j in range(n+1)]
p=[0]*n

x=1
for i in reversed(range(n)):
	p[i]=x%13
	x=p[i]*10
	
for i in range(n):
	if(s[i]=="?"):
		c=-1
	elif(s[i]>="0" and s[i]<="9"):
		c=int(s[i])
	else:
		print (a[i]+"   Illegal")
		exit()
	if ( i== 0):
		for j in range(10):
			if (c!=-1 and c!=j): continue
			b[0][(p[i]*j)%13]=1
	else:
		for j in range(10):
			if (c!=-1 and c!=j): continue
			y=(p[i]*j)%13
			for k in range(13):
				b[i][(k+y)%13]+=b[i-1][k]


	for k in range(13):b[i][k]%=MOD
#	print (b[i])
#	print (b[i+1])

print (b[n-1][5])


### FIXED CODE ###

MOD = 1000000007;

s = [int(x) if x!="?" else -1 for x in input()]

n=len(s)

r=[0]*13

c=s[0]
if (c!=-1):
	r[c]=1
else:
	for i in range(10):r[i]=1

for i in range(1,n):
	dp=[0]*26
	for j in range(13):dp[j*10%13]+=(r[j]%MOD)
	dp[13:26]=dp[0:13]
	c=s[i]
	r=[0]*13
	if (c==-1):
		w=sum(dp[4:14])
		for j in range(13):
				r[j]+=w
				w=w+dp[j+1]-dp[4+j]
	else:
		for j in range(13):
			r[j]+=dp[13-c+j]
print (r[5]%MOD)
### BUGGY CODE ###

import math
import bisect

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

ans = 0
while(len(A)>1):
  a = A.pop()
  b = (1<<(int(math.log(a,2))+1))-a
  #print(a,b)
  r = bisect.bisect_left(A, b)
  if r < len(A) and A[r] == b:
    ans += 1
    del A[r]
print(ans)

### FIXED CODE ###

import math
import bisect
import collections

N = int(input())
A = list(map(int,input().split()))
C = collections.Counter(A)
A = sorted(list(C.keys()))
#print(C)
#print(A)

ans = 0
for i in range(len(A)-1,-1,-1):
  a = A[i]
  b = (1<<(int(math.log(a,2))+1))-a
  if a == b:
    ans += C[a]//2
    C[a] -= C[a]//2*2
  else:
    r = bisect.bisect_left(A, b)
    if r < i and A[r] == b:
      mn = min(C[a],C[A[r]])
      ans += mn
      C[a] -=  mn
      C[A[r]] -= mn
print(ans)
### BUGGY CODE ###

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

ans=0
for a in set(A):
  cnt=A.count(a)
  if cnt==a:
    continue
  elif cnt<a:
    ans+=cnt
  else:
    ans+=min(cnt-a,cnt)
print(ans)

### FIXED CODE ###

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

c=Counter(A)
ans=0
for key, value in c.items():
  if key!=value:
    if key>value:
      ans+=value
    else:
      ans+=value-key
print(ans)
### BUGGY CODE ###

import math

k = int(input())

k += 1
ans = 0

for a in range(1, k):
    for b in range(1, k):
        for c in range(1, k):
            ab = math.gcd(a, b)
            bc = math.gcd(b, c)
            abc = math.gcd(ab, bc)

            ans += abc

print(ans)


### FIXED CODE ###

import math

k = int(input())

k += 1
ans = 0

ab = []

for a in range(1, k):
    for b in range(1, k):
       ab.append(math.gcd(a, b))

for a in ab:
    for c in range(1, k):
        ans += math.gcd(a, c)

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

MOD = int(1e9) + 7
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(60):
    cnt = 0
    for j in range(n):
        if a[j] >> i & 1 == 1:
            cnt += 1
    ans += (cnt * (n-cnt) * (2**i)) % MOD
ans %= MOD
print(ans)


### FIXED CODE ###

MOD = int(1e9) + 7
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(60):
    cnt = 0
    for j in range(n):
        if a[j] >> i & 1 == 1:
            cnt += 1
    ans += (cnt * (n-cnt) * (2**i)) % MOD
ans %= MOD
print(ans)
### BUGGY CODE ###

def main():
    n = int(input())
    p_list = list(map(int, input().split()))
    count = 1
    for i in range(1, len(p_list)):
        if min(p_list[:i+1]) == p_list[i]:
            count += 1

    print(count)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    p_list = list(map(int, input().split()))
    count = 1
    tmp_min = p_list[0]
    for i in range(1, len(p_list)):
        tmp_min = min(tmp_min, p_list[i])
        if tmp_min == p_list[i]:
            count += 1

    print(count)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

from functools import reduce
from operator import mul

n = int(input())
a_li = list(map(int, input().split()))

if 0 in a_li:
    print(0)
    exit()

a_li = [a for a in a_li if a != 1 or a != 0]
ans = reduce(mul, a_li)

if ans > 1000000000000000000:
    print(-1)
    exit()
else:
    print(ans)


### FIXED CODE ###

n = int(input())
a_li = list(map(int, input().split()))

if 0 in a_li:
    print(0)
    exit()

ans = 1
a_li = [a for a in a_li if a != 1 and a != 0]
a_li.append(1)
for a in a_li:
    ans *= a
    if ans > 1000000000000000000:
        print(-1)
        exit()
print(ans)
### BUGGY CODE ###

k = int(input())

import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

total = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            total += gcd(a,b,c)
print (total)


### FIXED CODE ###

k = int(input())

import math
#from functools import reduce
#def gcd(*numbers):
#    return reduce(math.gcd, numbers)

total = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        tmp = math.gcd(a,b)
        for c in range(1,k+1):
            total += math.gcd(tmp,c)
print (total)
### BUGGY CODE ###

n = int(input())

strs = []

for i in range(n):
    s = input().split()
    if(s[0] == 'insert'):
        if(s[1] not in strs):
            strs.append(s[1])
    else:
        if(s[1] in strs):
            print('yes')
        else:
            print('no')


### FIXED CODE ###

n = int(input())

strs = {}

for i in range(n):
    s = input().split()
    if(s[0] == 'insert'):
        if(s[1] not in strs):
            strs[s[1]] = ''
    else:
        if(s[1] in strs):
            print('yes')
        else:
            print('no')