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

#c
n = int(input())
a = [int(input()) for _ in range(n)]
import copy
ans = []
for i in range(len(a)):
    tmp = copy.deepcopy(a)
    tmp.pop(i)
    print(max(tmp))

### FIXED CODE ###

#c
n = int(input())
a = [int(input()) for _ in range(n)]
b = sorted(a, reverse=True)
a_max = b[0]
for i in range(len(a)):
    if a[i] == a_max:
        print(b[1])
    else:
        print(a_max)
### BUGGY CODE ###

N=int(input())
a=[]
for i in range(N):
    a.append(input())
a=sorted(a)
c=0
while c!=len(a)-1:
    if a[c]==a[c+1]:
        a.pop(c+1)
    else:
        c+=1
print(len(a))

### FIXED CODE ###

N=int(input())
a=[]
for i in range(N):
    a.append(input())
print(len(set(a)))
### BUGGY CODE ###

from collections import deque
import itertools
import sys
buf = sys.stdin.buffer
 
def dfs(field, h, w):
    visited = [[False] * w for _ in range(h)]
    q = deque([])
    for y in range(h):
        for x in range(w):
            if field[y][x] == '#':
                q.append((y, x, 0))
                visited[y][x] = True
    
    while q:
        if not False in itertools.chain.from_iterable(visited):
            i, j, d = q.pop()
            return d
        i, j, d = q.popleft()
        if i > 0 and visited[i - 1][j] == False and field[i - 1][j] == '.':
            q.append((i - 1, j, d + 1))
            visited[i - 1][j] = True
        if i < h - 1 and visited[i + 1][j] == False and field[i + 1][j] == '.':
            q.append((i + 1, j, d + 1))
            visited[i + 1][j] = True
        if j > 0 and visited[i][j - 1] == False and field[i][j - 1] == '.':
            q.append((i, j - 1, d + 1))
            visited[i][j - 1] = True
        if j < w - 1 and visited[i][j + 1] == False and field[i][j + 1] == '.':
            q.append((i, j + 1, d + 1))
            visited[i][j + 1] = True
    else:
        return d


h , w = map(int,buf.readline().split())
field = [sys.stdin.readline().rstrip() for _ in range(h)]
d = dfs(field, h, w)
print(d)

### FIXED CODE ###

import numpy as np

H,W = map(int,input().split())
use = np.zeros((H,W),dtype=int)
for i in range(H):
    s = input()
    for j,st in enumerate(s):
        if st == ".":
            use[i][j] = 10**10
        else:
            use[i][j] = 0

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

print(np.max(use))
### BUGGY CODE ###

n = int(input())
s = input()

ans = 0

r = []
if s[0] == "R":
    r.append(1)
else:
    r.append(0)

for i in range(1, len(s)):
    if s[i] == "R":
        r.append(r[-1] + 1)
    else:
        r.append(r[-1])

g = []
if s[0] == "G":
    g.append(1)
else:
    g.append(0)

for i in range(1, len(s)):
    if s[i] == "G":
        g.append(g[-1] + 1)
    else:
        g.append(g[-1])

b = []
if s[0] == "B":
    b.append(1)
else:
    b.append(0)

for i in range(1, len(s)):
    if s[i] == "B":
        b.append(b[-1] + 1)
    else:
        b.append(b[-1])

for i in range(n - 2):
    for j in range(i + 1, n):
        if s[i] != s[j]:
            tmp = [s[i]] + [s[j]]
            target_idx = j + (j - i)

            if "R" not in tmp:
                ans += r[-1] - r[j]
                if target_idx >= len(s):
                    continue
                if s[target_idx] == "R":
                    ans -= 1
            elif "G" not in tmp:
                ans += g[-1] - g[j]
                if target_idx >= len(s):
                    continue
                if s[target_idx] == "G":
                    ans -= 1
            else:
                ans += b[-1] - b[j]
                if target_idx >= len(s):
                    continue
                if s[target_idx] == "B":
                    ans -= 1

print(ans)


### FIXED CODE ###

n = int(input())
s = input()

ans = 0
sn = len(s)

r = []
if s[0] == "R":
    r.append(1)
else:
    r.append(0)
g = []
if s[0] == "G":
    g.append(1)
else:
    g.append(0)
b = []
if s[0] == "B":
    b.append(1)
else:
    b.append(0)

for i in range(1, sn):
    if s[i] == "R":
        r.append(r[-1] + 1)
        g.append(g[- 1])
        b.append(b[- 1])
    elif s[i] == "G":
        r.append(r[-1])
        g.append(g[-1] + 1)
        b.append(b[- 1])
    elif s[i] == "B":
        r.append(r[-1])
        g.append(g[-1])
        b.append(b[-1] + 1)
    else:
        r.append(r[-1])
        g.append(g[- 1])
        b.append(b[- 1])

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        if s[i] != s[j]:
            tmp = dict()
            tmp[s[i]] = 0
            tmp[s[j]] = 0
            target_idx = j + (j - i)

            if tmp.get("B", 1) == 1:
                ans += b[-1] - b[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "B":
                    ans -= 1
            elif tmp.get("G", 1) == 1:
                ans += g[-1] - g[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "G":
                    ans -= 1
            else:
                ans += r[-1] - r[j]
                if target_idx >= sn:
                    continue
                if s[target_idx] == "R":
                    ans -= 1

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

n, k = map(int, input().split())
a = [int(i) for i in input().split()]
for j in range(min(k, 42)):
    bit = [0 for _ in range(n)]
    for i in range(n):
        bit[max(i - a[i], 0)] += 1
        if i + a[i] + 1 < n:
            bit[i + a[i] + 1] -= 1
    result = [bit[0]]
    for i in range(n - 1):
        result.append(bit[i + 1] + result[-1])
    a = result
print(' '.join(list(map(str, a))))

### FIXED CODE ###

n, k = map(int, input().split())
a = [int(i) for i in input().split()]
for j in range(min(k, 42)):
    bit = [0 for _ in range(n)]
    for i in range(n):
        bit[max(i - a[i], 0)] += 1
        if i + a[i] + 1 < n:
            bit[i + a[i] + 1] -= 1
    result = [bit[0]]
    for i in range(n - 1):
        result.append(bit[i + 1] + result[-1])
    a = result
print(' '.join(list(map(str, a))))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import collections

def search_b(a_char, a_count, b_most_common, fixed_count):
  thres = fixed_count - a_count
  for (b_char, b_count) in [b for b in b_most_common if b[1] > thres]:
    if a_char != b_char:
      return a_count + b_count
  
  return fixed_count


def search(a_most_common, b_most_common):
  fixed_count = -1
  for (a_char, a_count) in a_most_common:
    fixed_count = search_b(a_char, a_count, b_most_common, fixed_count)
  
  return fixed_count


def main():
  n = int(input())
  V = list(map(int, input().split()))

  a = V[::2]
  b = V[1::2]
  
  a_counter = collections.Counter(a)
  b_counter = collections.Counter(b)

  a_most_common = a_counter.most_common()
  b_most_common = b_counter.most_common()

  if len(a_most_common) == 1 and len(b_most_common) == 1 and a_most_common[0][0] == b_most_common[0][0]:
    print(n // 2)
    return

  print(n - search(a_most_common, b_most_common))


if __name__ == '__main__':
  main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import collections

def search_b(a_char, a_count, b_most_common, fixed_count):
  thres = fixed_count - a_count
  for (b_char, b_count) in [b for b in b_most_common if b[1] > thres]:
    if a_char != b_char:
      return a_count + b_count
  
  return fixed_count


def search(a_most_common, b_most_common):
  fixed_count = -1
  b_max = b_most_common[0][1]

  for (a_char, a_count) in a_most_common:
    if a_count <= fixed_count - b_max:
      break

    fixed_count = search_b(a_char, a_count, b_most_common, fixed_count)
  
  return fixed_count


def main():
  n = int(input())
  V = list(map(int, input().split()))

  a = V[::2]
  b = V[1::2]
  
  a_counter = collections.Counter(a)
  b_counter = collections.Counter(b)

  a_most_common = a_counter.most_common()
  b_most_common = b_counter.most_common()

  if len(a_most_common) == 1 and len(b_most_common) == 1 and a_most_common[0][0] == b_most_common[0][0]:
    print(n // 2)
    return

  print(n - search(a_most_common, b_most_common))


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

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

m = [[0]*n for _ in range(n)]
dp = [0]*n
from collections import deque
que = deque()
for _ in range(M):
  a,b = list(map(int,input().split()))
  a -= 1
  b -= 1
  m[a][b] = 1
  m[b][a] = 1
  if a == 0:
    que.append(b)
    dp[b] = 1
  if b == 0:
    que.append(a)
    dp[a] = 1

while que:
  c = que.popleft()
  for i in range(n):
    if m[c][i] == 1 and dp[i] == 0 :
      dp[i] = c+1
      que.append(i)

#[exit(print('No')) for i in range(1,n)  if dp[i] == 0]

print('Yes')
[print(dp[i]) for i in range(1,n)]


### FIXED CODE ###

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

m = [[] for _ in range(n)]
dp = [0]*n
from collections import deque
que = deque()
for _ in range(M):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  m[a].append(b)
  m[b].append(a)
  if a == 0:
    que.append(b)
    dp[b] = 1
  if b == 0:
    que.append(a)
    dp[a] = 1

while que:
  c = que.popleft()
  for i in m[c]:
    if dp[i] == 0 :
      dp[i] = c+1
      que.append(i)

#[exit(print('No')) for i in range(1,n)  if dp[i] == 0]

print('Yes')
[print(dp[i]) for i in range(1,n)]
### BUGGY CODE ###

N = int(input())
ans = 1
for i in range(1,N+1):
    ans *= i
print(ans%(10**9 + 7))

### FIXED CODE ###

N = int(input())
mod = 1000000007
ans = 1
for i in range(1,N+1):
    ans = (i * ans)%mod
print(ans)
### BUGGY CODE ###

def decode():
    s = input()

    m = [0]
    h = 0
    for c in s:
        if c == "\\":
            h -= 1
        elif c == "_":
            pass
        else:
            h += 1

        m.append(h)

    return m


def checkwater(m, left):
    if m[left] <= m[left+1]:
        return False, 0, 0
    else:
        left_h = m[left]
        water = 0
        r = left + 1
        while r < len(m):
            if m[r] == m[r-1]:
                water += left_h - m[r]
            elif m[r] <= m[r-1]:
                water += left_h - m[r] - 0.5
            else:
                water += left_h - m[r] + 0.5

            if m[r] == left_h:
                return True, r, water

            r += 1

        return False, 0, 0


if __name__ == '__main__':

    def t():
        m = decode()
        print(m)
        left = int(input())
        result, r, water = checkwater(m, left)
        print(result, r, water)


    def main():
        m = decode()

        wlist = []
        left = 0
        while left < len(m) - 1:
            result, r, water = checkwater(m, left)
            if result:
                wlist.append(water)
                left = r
            else:
                left += 1

        print(int(sum(wlist)))
        wlist.insert(0, len(wlist))
        print(" ".join([str(int(x)) for x in wlist]))

    main()


### FIXED CODE ###

def check(aline):
    pools = []
    leftedge = []

    for i, c in enumerate(aline):
        if c == "\\":
            leftedge.append(i)
        elif c == "_":
            pass
        else:
            if leftedge:
                left = leftedge.pop()
                w = i - left

                while pools and left < pools[-1][0]:
                    w += pools.pop()[1]

                pools.append((left, w))

    return pools


if __name__ == '__main__':

    al = input().strip()
    ps = check(al)

    print(sum([x[1] for x in ps]))
    print(len(ps), *[x[1] for x in ps])
### BUGGY CODE ###

import itertools


N,M,R = map(int,input().split())
rs = list(map(lambda x:int(x)-1,input().split()))
tree = [[] for i in range(N)]
cost=[[10**9]*N for i in range(N)]
for i in range(M):
    a,b,c = map(int,input().split())
    cost[a-1][b-1] = c
    cost[b-1][a-1] = c

for k in range(N):
    for i in range(N):
        for j in range(N):  # j<i
            cost[i][j] =  min(cost[i][j],cost[i][k] + cost[k][j])
            cost[j][i] = cost[i][j]

ans = 10**9
for roads in itertools.permutations(rs):
    co = 0
    p = roads[0]
    for r in roads[1:]:
        co += cost[p][r]
        p = r
    ans = min(ans,co)
print(ans)


### FIXED CODE ###

import itertools
#TLE

N,M,R = map(int,input().split())
rs = list(map(lambda x:int(x)-1,input().split()))
cost=[[10**9]*N for i in range(N)]
for i in range(M):
    a,b,c = map(int,input().split())
    cost[a-1][b-1] = c
    cost[b-1][a-1] = c

for k in range(N):
    for i in range(N):
        for j in range(i):  # j<i
            cost[i][j] =  min(cost[i][j],cost[i][k] + cost[k][j])
            cost[j][i] = cost[i][j]

ans = 10**9
for roads in itertools.permutations(rs):
    co = 0
    p = roads[0]
    for r in roads[1:]:
        co += cost[p][r]
        p = r
    ans = min(ans,co)
print(ans)
### BUGGY CODE ###

N = int(input())
A = [str(_) for _ in input().split(" ")]

ans = [0 for _ in range(N)] 
for i in range(N):
    ans[i] = (str(A.index(str(i + 1)) + 1))

print(" ".join(ans))

### FIXED CODE ###

import numpy as np

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

ans = np.argsort(A)

for i in range(N):
    print(ans[i] + 1)
### BUGGY CODE ###

s = input()
q = int(input())
query_list = [list(input().split()) for _ in range(q)]
for query in query_list:
    if query[0] == '1':
        #s = ''.join(list(reversed(s)))
        s = s[::-1]
    elif query[0] == '2':
        if query[1] == '1':
            s = query[2] + s
        elif query[1] == '2':
            s = s + query[2]
print(s)

### FIXED CODE ###

s = input()
q = int(input())
query_list = [list(input().split()) for _ in range(q)]
reverse_flag = False
concat = ''
initial = 0
for query in query_list:
    if query[0] == '1':
        reverse_flag = not reverse_flag
    elif query[0] == '2':
        if (query[1] == '1' and not reverse_flag) or (query[1] == '2' and reverse_flag):
            concat = query[2] + concat
            initial += 1
        elif (query[1] == '2' and not reverse_flag) or (query[1] == '1' and reverse_flag):
            concat = concat + query[2]
ans = ''
if reverse_flag:
    s = s[::-1]
    concat = concat[::-1]
    ans = concat[:-initial]+s+concat[-initial:]
else:
    ans = concat[:initial]+s+concat[initial:]
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

n,t = map(int, raw_input().split())
a = map(int, raw_input().split()) 

l,r = 0,0
diff = 0
num = 0
lp = 0
for l in range(n):
    if(a[lp]<a[l]):
        pass
    else:
        lp = l
        for r in range(l+1,n):
            if(a[r]-a[l]>diff):
                diff = a[r]-a[l]
                num = 1
            elif(a[r]-a[l]==diff):
                num += 1
print(num)
            
 


### FIXED CODE ###

# -*- coding: utf-8 -*-
 
n,t = map(int, raw_input().split())
a = map(int, raw_input().split()) 
 
m = 10**9+1
num = 0
diff = 0
for i in range(n):
    if(a[i]<m):
        m = a[i]
    if(a[i]-m > diff):
        diff = a[i]-m
        num = 1
    elif(a[i]-m == diff):
        num += 1
print(num)
### BUGGY CODE ###

import math
N = int(input())
A = list(map(int, input().split()))
bit = [0] * 60
MOD = 10 ** 9 + 7
for a in A:
    b = a
    i = 0
    while a > 0:
        if a % (2 ** (i+1)) != 0:
            a -= 2 ** i
            bit[i] += 1
        i += 1
answer = 0
for i, b in enumerate(bit):
    answer += (2 ** i) * (b * (N-b))
print(answer % MOD)

### FIXED CODE ###

import math
N = int(input())
A = list(map(int, input().split()))
bit = [0] * 60
MOD = 10 ** 9 + 7
for a in A:
    i = 0
    waru = 1
    while a > 0:
        if a % (waru * 2) != 0:
            a -= waru
            bit[i] += 1
        waru *= 2
        i += 1
answer = 0
for i, b in enumerate(bit):
    answer += (2 ** i) * (b * (N-b))
print(answer % MOD)
### BUGGY CODE ###

from itertools import accumulate

n = int(input())
A = list(map(int,input().split()))
acmA = [0] + list(accumulate(A))
ans = 0
for i in range(1,n+1):
  for j in range(n-i+1):
    if acmA[j+i]-acmA[j]==0: ans += 1
print(ans)

### FIXED CODE ###

from itertools import accumulate
from collections import Counter

int(input())
A = list(map(int,input().split()))
acmA = list(accumulate(A))
ans = 0
for key, num in Counter(acmA).items():
  ans += (num*(num-1))//2
  if key == 0:ans += num
print(ans)
### BUGGY CODE ###

from bisect import bisect_right

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

shop = []
shop_a0 = []

for i in range(n):
    a, b = map(int, input().split())
    if a != 0:
        shop.append([a, b, a/(b+1)])
    else:
        shop_a0.append(b)

shop = sorted(shop, key=lambda x: -x[2])
shop_a0 = sorted(shop_a0)

n = len(shop)

# dp[i][j]:i番目まで見てj個の店を回るのに掛かる所要時間の最小値
dp = [[10**10]*(n+1) for _ in range(n+1)]
dp[0][0] = 0


for j in range(min(n+1, 50)):
    for i in range(n):
        dp[i+1][j] = min(dp[i][j], dp[i][j-1] + 1 +
                         shop[i][0]*(dp[i][j-1]+1) + shop[i][1])

ss = []
if shop_a0:
    ss.append(1+shop_a0[0])
    for i in range(1, len(shop_a0)):
        ss.append(ss[-1]+1+shop_a0[i])

ans = 0

for i in range(n+1):
    if t - dp[n][i] >= 0:
        ans = max(ans, bisect_right(ss, t-dp[n][i]) + i)

print(ans)


### FIXED CODE ###

from bisect import bisect_right
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline


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

shop = []
shop_a0 = []

for i in range(n):
    a, b = map(int, input().split())
    if a != 0:
        shop.append([a, b, a/(b+1)])
    else:
        shop_a0.append(b)

shop = sorted(shop, key=lambda x: -x[2])
shop_a0 = sorted(shop_a0)

n = len(shop)

INF = 10**10
# dp[i][j]:i番目まで見てj個の店を回るのに掛かる所要時間の最小値
dp = [[INF for _ in range(31)] for __ in range(n+1)]
dp[0][0] = 0

m = min(n+1, 30)

for i in range(n):
    for j in range(m):
        if (shop[i][0]+1)*(dp[i][j]+1) + shop[i][1] > t:
            dp[i+1][j+1] = dp[i][j+1]
        else:
            dp[i+1][j+1] = min(dp[i][j+1], (shop[i][0]+1)
                               * (dp[i][j]+1) + shop[i][1])
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])

ss = []
if shop_a0:
    ss.append(1+shop_a0[0])
    for i in range(1, len(shop_a0)):
        ss.append(ss[-1]+1+shop_a0[i])

ans = 0

for i in range(m):
    if t - dp[n][i] >= 0:
        ans = max(ans, bisect_right(ss, t-dp[n][i]) + i)

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

N = int(input())
S = list(input())

i_range = [int(x) for x in range(1, N-1)]
j_range = [int(x) for x in range(2, N)]
k_range = [int(x) for x in range(3, N+1)]

val = 0

for k in k_range:
    S_k = S[k-1]
    for j in j_range:
        if(j >= k):
            break
        S_j = S[j-1]
        for i in i_range:
            if(i >= j):
                break
            S_i = S[i-1]
            if((S_i != S_j) and (S_j != S_k) and (S_i != S_k) and (j-i != k-j)):
                val = val + 1

print(val)

### FIXED CODE ###

N = int(input())
S = list(input())


"""
脳死で全探索で探すとO(n^3）で時間がかかる。
→1つめの条件で予め絞った後に、そこからさらに絞り込むやり方をやる。（補集合を引くパターン）
j-i=k-jを満たすもの（すなわちk=2j-i）を求めて、あとで引き算すればOK.
≠は＝で考えて引き算のほうがよい。
"""

r_count = S.count('R')
g_count = S.count('G')
b_count = S.count('B')


val = 0

for i in range(N-2):
    for j in range(i+1, N-1):
        k = 2*j-i
        if(k < N):
            if((S[i] != S[j]) and (S[j] != S[k]) and (S[i] != S[k])):
                val += 1

print((r_count * g_count * b_count) - val)
### BUGGY CODE ###

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

for i in range(N[1]):
    for Index, Kakaku in enumerate(A):
        if Kakaku == max(A):
            A[Index] = int(Kakaku / 2)
            break

print(sum(A))


### FIXED CODE ###

import heapq

N = list(map(int, (input().split(' '))))
A = list(map(lambda x: x*(-1), map(int, (input().split(' ')))))

heapq.heapify(A)
for i in range(N[1]):
    heapq.heappush(A, int(heapq.heappop(A) / 2))

print(-sum(A))
### BUGGY CODE ###

def main():
    n= int(input())
    slis = tuple(input())
    total = 0
    lis_R = [n for n, v in enumerate(slis) if v == "R"]
    lis_G = [n for n, v in enumerate(slis) if v == "G"]
    lis_B = [n for n, v in enumerate(slis) if v == "B"]
 
    lenR = len(lis_R)
    lenG = len(lis_G)
    lenB = len(lis_B)
    total += lenR * lenG * lenB
 
    if lenB <= lenG <= lenR:
        for i in lis_R:
            for j in lis_G:
                for k in lis_B:
                    if abs(i-j) == abs(j-k) or abs(i-k)==abs(j-k) or abs(k-i)==abs(j-i):
                        total -= 1
 
    elif lenB <= lenR <= lenG:
        for i in lis_G:
            for j in lis_R:
                for k in lis_B:
                    if abs(i-j) == abs(j-k) or abs(i-k)==abs(j-k) or abs(k-i)==abs(j-i):
                        total -= 1
 
    elif lenG <= lenB <= lenR:
        for i in lis_R:
            for j in lis_B:
                for k in lis_G:
                    if abs(i-j) == abs(j-k) or abs(i-k)==abs(j-k) or abs(k-i)==abs(j-i):
                        total -= 1
    elif lenG <= lenR <= lenB:
        for i in lis_B:
            for j in lis_R:
                for k in lis_G:
                    if abs(i-j) == abs(j-k) or abs(i-k)==abs(j-k) or abs(k-i)==abs(j-i):
                        total -= 1
    elif lenR <= lenB <= lenG:
        for i in lis_G:
            for j in lis_B:
                for k in lis_R:
                    if abs(i-j) == abs(j-k) or abs(i-k)==abs(j-k) or abs(k-i)==abs(j-i):
                        total -= 1
    elif lenR <= lenG <= lenB:
        for i in lis_B:
            for j in lis_G:
                for k in lis_R:
                    if abs(i-j) == abs(j-k) or abs(i-k)==abs(j-k) or abs(k-i)==abs(j-i):
                        total -= 1
    print(total)
 
 
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    import re
    n = int(input())
    s = input()
    rindex = set()
    gindex = set()
    bindex = set()
    for i in range(n):
        if s[i] == "R":
            rindex.add(i)
        elif s[i] == "G":
            gindex.add(i)
        else:
            bindex.add(i)
    ans = len(rindex) * len(gindex) * len(bindex)

    for r in rindex:
        for g in gindex:
            if r > g:
                gap = r - g
                b1 = r + gap
                b2 = g - gap
                b3 = g + (gap/2)

            elif r < g:
                gap = g - r
                b1 = g + gap
                b2 = r - gap
                b3 = r + (gap/2)
            if b1 in bindex:
                ans -= 1
            if b2 in bindex:
                ans -= 1  
            if b3 in bindex:
                ans -= 1  
    print(ans)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

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

ans = 1

for a in A:
    ans *= a

if ans > 10 ** 18:
    ans = -1
print(ans)


### FIXED CODE ###

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

ans = 1

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

for a in A:
    ans *= a
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)