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

from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
T = 1 << 30
for k in range(30, -1, -1):
    cnt = 0

    TT = T << 1
    for i in range(N):
        A[i] %= TT
        B[i] %= TT

    B = sorted(B)

    for i in range(N):
        cnt += bisect_left(B, 2 * T - A[i]) - bisect_left(B, T - A[i])
        cnt += bisect_left(B, 4 * T - A[i]) - bisect_left(B, 3 * T - A[i])

    if cnt % 2 == 1:
        ans |= 1 << k

    T = T >> 1

print(ans)



### FIXED CODE ###

from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
T = 1 << 30
for k in range(30, -1, -1):
    cnt = 0

    TT = T << 1
    for i in range(N):
        A[i] %= TT
        B[i] %= TT

    A = sorted(A)
    B = sorted(B)

    d0 = bisect_left(B, T - A[0])
    d1 = bisect_left(B, 2 * T - A[0])
    d2 = bisect_left(B, 3 * T - A[0])
    for i in range(N):
        while d0 - 1 >= 0 and B[d0 - 1] >= T - A[i]:
            d0 -= 1
        while d1 - 1 >= 0 and B[d1 - 1] >= 2 * T - A[i]:
            d1 -= 1
        while d2 - 1 >= 0 and B[d2 - 1] >= 3 * T - A[i]:
            d2 -= 1

        cnt += d1 - d0
        cnt += N - d2

    if cnt % 2 == 1:
        ans |= T

    T = T >> 1

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

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

r = []
g = []
b = []

for i, c in enumerate(s):
    if c == "R":
        r.append(i)
    elif c == "G":
        g.append(i)
    else:
        b.append(i)


ans = 0
for ri in r:
    for gi in g:
        for bi in b:
            arr = [ri, gi, bi]
            arr.sort()
            if arr[0] + arr[2] == 2 * arr[1]:
                pass
            else:
                ans += 1

print(ans)

### FIXED CODE ###

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

r = s.count("R")
g = s.count("G")
b = s.count("B")


ans = r * g * b

for i in range(n):
    for j in range(i + 1, n):
        if 2 * j - i > n - 1:
            continue
        if s[i] == s[j] or s[i] == s[2 * j - i] or s[j] == s[2 * j - i]:
            pass
        else:
            ans -= 1
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    A[i] -= 1
c = 0
for i in range(N):
    for j in range(N):
        if i < j:
            if A[i] == j and A[j] == i:
                c += 1
print(c)
    

### FIXED CODE ###

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

c = 0
for i in range(N):
    if A[A[i]-1] == i+1:
        c += 1
print(int(c//2))
### BUGGY CODE ###

from sys import stdin
N = int(input())
A = list(map(int, stdin.readline().split()))
"""ans = 1
for a in A:
    ans = ans*a
    if ans == 0:
        break"""
from functools import reduce
ans = reduce(lambda x,y:x*y,A)
if ans >10**18:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

from sys import stdin
N = int(input())
A = list(map(int, stdin.readline().split()))
if 0 in A:
    print(0)
else:
    ans = 1
    for a in A:
        ans = ans*a
        if ans > 10**18:
            break
    """from functools import reduce
    ans = reduce(lambda x,y:x*y,A)"""
    """import numpy as np
    A = np.array(A)
    ans = np.prod(A)"""
    if ans >10**18:
        print(-1)
    else:
        print(ans)
### BUGGY CODE ###

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

sum_p = []

for i in range(N - K + 1):
    sum_p.append(sum(p[i:i+K]))
    

ex = (max(sum_p)-K+2)/2

print(ex + K - 1)

### FIXED CODE ###

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

sum_p = 0

for i in range(K):
    sum_p += p[i]

max_p = sum_p

for j in range(K,N):
    sum_p -= p[j - K]
    sum_p += p[j]
    max_p = max(max_p,sum_p)

ex = (max_p - K + 2)/2

print(ex + K - 1)
### BUGGY CODE ###

N = int(input())
a = list(map(int,input().split()))
ans = 0
while all( A%2 == 0 for A in a ):
        A = [ i/2 for i in a ]
        ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 0
while all(A%2 == 0 for A in a):
	a = [i/2 for i in a ]
	ans += 1
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))+[0]

for i in range(n):
  ans = 0
  t = 0
  for j in range(n+1):
    if i == j: continue
    ans += abs(t - a[j])
    t = a[j]
  print(ans)

### FIXED CODE ###

n = int(input())
a = [0] + list(map(int, input().split())) + [0]

nums = [0]*(n+1)
for i in range(1, n+2): nums[i-1] = abs(a[i] - a[i-1])

ans = sum(nums)
for i in range(1,n+1):
  print(ans - nums[i-1]-nums[i]+abs(a[i+1]-a[i-1]))
### BUGGY CODE ###

import heapq
n,m,s,t = map(int,input().split())
en = []
su = []
for i in range(m):
    x1,y1,z1,a1=[int(i) for i in input().split()]
    en.append([x1-1,y1-1,z1])
    en.append([y1-1,x1-1,z1])
    su.append([x1-1,y1-1,a1])
    su.append([y1-1,x1-1,a1])
def shortest_path(edge,num_v,start):
    inf = float("inf")
    cost = [[inf for i in range(num_v)] for j in range(num_v)]
    for e in edge: cost[e[0]][e[1]] = e[2]
    d = [inf for j in range(num_v)]
    l = [[] for i in range(n)]
    for pi in edge:  
      l[pi[0]].append(pi[1])
      l[pi[1]].append(pi[0])
    q = []
    heapq.heappush(q, (0, start))
    d[start] = 0
    while len(q) != 0:
      prov_cost, src = heapq.heappop(q)
      if d[src] < prov_cost:
                continue
      for dest in l[src]:
        you = cost[src][dest]
        if you != float('inf') and d[dest] > d[src] + you:
          d[dest] = d[src] + you
          heapq.heappush(q, (d[dest], dest))
    return d


from collections import deque
ans = deque([])
tori = shortest_path(en,n,s-1)
kae = shortest_path(su,n,t-1)
sai = float("inf")
for i in range(n-1,-1,-1):
  kon = kae[i]+tori[i]
  if sai > kon:
     ans.appendleft(kon)
     sai = kon
  else:
    ans.appendleft(sai)
    
moti = 10**15
for i in range(n):
  print(moti-ans[i])

### FIXED CODE ###

import heapq
n,m,s,t = map(int,input().split())
en = []
su = []
for i in range(m):
    x1,y1,z1,a1=[int(i) for i in input().split()]
    en.append([x1-1,y1-1,z1])
    su.append([x1-1,y1-1,a1])
def shortest_path(edge,num_v,start):
    inf = float("inf")
    cost = [[] for i in range(n+1)]
    for path in edge:
      cost[path[0]].append((path[1],path[2]))
      cost[path[1]].append((path[0],path[2]))
    d = [inf for j in range(num_v)]
    q = []
    heapq.heappush(q, (0, start))
    d[start] = 0
    while len(q) != 0:
      prov_cost, src = heapq.heappop(q)
      if d[src] < prov_cost:
                continue
      for dest,weight in cost[src]:
        if weight != float('inf') and d[dest] > d[src] + weight:
          d[dest] = d[src] + weight
          heapq.heappush(q, (d[dest], dest))
    return d
 
 
from collections import deque
ans = deque([])
tori = shortest_path(en,n,s-1)
kae = shortest_path(su,n,t-1)
sai = float("inf")
for i in range(n-1,-1,-1):
  kon = kae[i]+tori[i]
  if sai > kon:
     ans.appendleft(kon)
     sai = kon
  else:
    ans.appendleft(sai)
    
moti = 10**15
for i in range(n):
  print(moti-ans[i])
### BUGGY CODE ###

import itertools
H,W,M = map(int,input().split())
lsx = [0] + [0]*H
lsy = [0] + [0]*W
lsxy = []
for i in range(M):
    x,y = map(int,input().split())
    lsx[x] += 1
    lsy[y] += 1
    lsxy.append((x,y))
maxx = max(lsx)
maxy = max(lsy)
lsmaxx = [i for i, x in enumerate(lsx) if x == maxx]
lsmaxy = [i for i, x in enumerate(lsy) if x == maxy]
lsp = list(itertools.product(lsmaxx,lsmaxy))
ii = 0
for i in range(M):
    if lsxy[i] in lsp:
        ii += 1
if len(lsp)-ii == 0:
    factor = 1
else:
    factor = 0
print(maxx+maxy-factor)


### FIXED CODE ###

H,W,M = map(int,input().split())
lsx = [0] + [0]*H
lsy = [0] + [0]*W
lsxy = []
for i in range(M):
    x,y = map(int,input().split())
    lsx[x] += 1
    lsy[y] += 1
    lsxy.append([x,y])
maxx = max(lsx)
maxy = max(lsy)
cx = lsx.count(maxx)
cy = lsy.count(maxy)
al = cx*cy
for i in range(M):
    if lsx[lsxy[i][0]] == maxx and lsy[lsxy[i][1]] == maxy:
        al -= 1
if al == 0:
    factor = 1
else:
    factor = 0        
print(maxx+maxy-factor)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
 
N, M = (int(i) for i in input().split())
input_list = [[int(i) for i in input().split()] for i in range(M)] 
 
m_list = [[0] for j in range(N+1)]
 
for inputs in input_list:
    m_list[inputs[0]].append(inputs[1])
 
for arr in m_list:
    arr.sort()
 
for inputs in input_list:
    num = m_list[inputs[0]].index(inputs[1])
    print(str(inputs[0]).zfill(6) + str(num).zfill(6))

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
N, M = (int(i) for i in input().split())
py_list = [[int(i) for i in input().split()] + [0] for i in range(M)] 
m_list = [[] for j in range(N+1)]
 
sorted_py_list = sorted(py_list, key=lambda x:x[1])

city_list = {}
for py in sorted_py_list:
    city_list[py[0]] = city_list[py[0]]+1 if py[0] in city_list else 1
    py[2] = city_list[py[0]]
 
for py in py_list:
    print(str(py[0]).zfill(6) + str(py[2]).zfill(6))
### BUGGY CODE ###

from collections import deque
import sys

input = sys.stdin.readline

n, m, max_tank = map(int, input().split())

g = tuple(set() for _ in range(n))
for _ in range(m):
    a, b, c = map(int, input().split())
    if c > max_tank:
        continue
    # 燃料不足で通過できない

    a -= 1
    b -= 1
    g[a].add((b, c))
    g[b].add((a, c))
    # 隣接リスト、(行き先、コスト)

inf = n + 10

q = int(input())
for _ in range(q):
    s, t = map(int, input().split())
    s -= 1
    t -= 1

    if not g[t]:
        print(-1)
        continue
    # ゴールに接続する辺がない場合

    d = [inf] * n
    remains = [0] * n

    d[s] = 0
    remains[s] = max_tank

    dq = deque()
    dq.append((s, max_tank, 0, -1))
    while dq:
        v, tank, take, parent = dq.popleft()
        if (d[v] < take) or (d[v] == take and remains[v] > tank):
            continue

        if v == t:
            break
            
        for u, c in g[v]:
            if u == parent:
                continue
            if c > tank:
                if (d[u] > take + 1) or (d[u] == take + 1 and remains[u] < max_tank - c):
                    d[u] = take + 1
                    remains[u] = max_tank - c
                    dq.append((u, max_tank - c, take + 1, v))
            else:
                if (d[u] > take) or (d[u] == take and remains[u] < tank - c):
                    d[u] = take
                    remains[u] = tank - c
                    dq.appendleft((u, tank - c, take, v))

    if d[t] == inf:
        print(-1)
    else:
        print(d[t])


### FIXED CODE ###

import sys

input = sys.stdin.readline

inf = 300 * (10 ** 9) + 10

n, m, max_tank = map(int, input().split())

dist = [[inf] * n for _ in range(n)]
for i in range(n):
    dist[i][i] = 0

for _ in range(m):
    a, b, c = map(int, input().split())
    if c > max_tank:
        continue
    # 燃料不足で通過できない

    a -= 1
    b -= 1

    dist[a][b] = c
    dist[b][a] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

g = [[inf] * n for _ in range(n)]
for i in range(n):
    for j in range(n):
        if dist[i][j] <= max_tank:
            g[i][j] = 0

for i in range(n):
    g[i][i] = 0

for k in range(n):
    for i in range(n):
        for j in range(n):
            g[i][j] = min(g[i][j], g[i][k] + g[k][j] + 1)

q = int(input())
for _ in range(q):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    print(-1 if g[s][t] == inf else g[s][t])
### BUGGY CODE ###

s = input()
q = int(input())
for i in range(q):
    query = input().split()
    if query[0] == '1':
        s = s[::-1]
    else:
        if query[1] == '1':
            s = query[2] + s
        else:
            s = s + query[2]
print(s)


### FIXED CODE ###

s = input()
q = int(input())

t = ''
for i in range(q):
    query = input().split()
    if query[0] == '1':
        s,t = t,s
    else:
        if query[1] == '1':
            t += query[2] 
        else:
            s += query[2]

print(t[::-1] + s)
### BUGGY CODE ###

#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
for m in range(M):
	I=list(map(int,input().split()))
	A.append(I[0])
	B.append(I[1])
tA=[]
tB=[]
for i,x in enumerate(A):
	if x==1:
		tA.append(B[i])
for i,x in enumerate(B):
	if x==N:
		tB.append(A[i])
for a in tA:
	if a in tB:
		print('POSSIBLE')
		break
else:
	print('IMPOSSIBLE')

### FIXED CODE ###

#ABC068C
N,M=map(int,input().split())
A=[]
B=[]
C=[]
D=[]
for m in range(M):
	I=list(map(int,input().split()))
	if I[0]==1:
		A.append(I[0])
		B.append(I[1])
	elif I[1]==N:
		C.append(I[0])
		D.append(I[1])
if len(set(B)&set(C))>0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')
### BUGGY CODE ###

H,W,K=map(int,input().split())
x1,y1,x2,y2=map(int,input().split())
C=[]

for _ in range(H):
    C.append(list(input()))

def keiro(x,y,cn,k):
    nx=[]

    i=1
    while True:
        if y+i>W-1 or C[x][y+i]=='@' or i>k:
            break
        elif C[x][y+i]=='.' or int(C[x][y+i])==cn+1:
            C[x][y+i]=str(cn+1)
            nx.append([x,y+i])
            i+=1
        else:
            break
    
    i=1
    while True:
        if y-i<0 or C[x][y-i]=='@' or i>k:
            break
        elif C[x][y-i]=='.' or int(C[x][y-i])==cn+1:
            C[x][y-i]=str(cn+1)
            nx.append([x,y-i])
            i+=1
        else:
            break
    
    i=1
    while True:
        if x+i>H-1 or C[x+i][y]=='@' or i>k:
            break
        elif C[x+i][y]=='.' or int(C[x+i][y])==cn+1:
            C[x+i][y]=str(cn+1)
            nx.append([x+i,y])
            i+=1
        else:
            break
    
    i=1
    while True:
        if x-i<0 or C[x-i][y]=='@' or i>k:
            break
        elif C[x-i][y]=='.' or int(C[x-i][y])==cn+1:
            C[x-i][y]=str(cn+1)
            nx.append([x-i,y])
            i+=1
        else:
            break

    return nx

C[x1-1][y1-1]=str(0)
taisho=keiro(x1-1,y1-1,0,K)
result=1

while C[x2-1][y2-1]=='.':
    next_taisho=[]
    if len(taisho)==0:
        result=-1
        break
    for l in taisho:
        m=keiro(l[0],l[1],result,K)

        for n in m:
            next_taisho.append(n)
    result+=1
    taisho=next_taisho.copy()

print(result)

### FIXED CODE ###

H,W,K=map(int,input().split())
x1,y1,x2,y2=map(int,input().split())
C=[]
nx=set([])

for _ in range(H):
    C.append(list(input()))

def keiro(x,y,k):
    i=1
    while True:
        if y+i>W-1 or C[x][y+i]!='.' or i>k:
            break
        else:
            if (x,y+i) not in nx:
                nx.add((x,y+i))
            i+=1
    
    i=1
    while True:
        if y-i<0 or C[x][y-i]!='.' or i>k:
            break
        else:
            if (x,y-i) not in nx:
                nx.add((x,y-i))
            i+=1
    
    i=1
    while True:
        if x+i>H-1 or C[x+i][y]!='.' or i>k:
            break
        else:
            if (x+i,y) not in nx:
                nx.add((x+i,y))
            i+=1
    
    i=1
    while True:
        if x-i<0 or C[x-i][y]!='.' or i>k:
            break
        else:
            if (x-i,y) not in nx:
                nx.add((x-i,y))
            i+=1

    return 0

C[x1-1][y1-1]=0
keiro(x1-1,y1-1,K)
taisho=nx.copy()
result=1
for j in nx:
    C[j[0]][j[1]]=result

while C[x2-1][y2-1]=='.':
    nx=set([])
    if len(taisho)==0 or result>10**6:
        result=-1
        break
    for l in taisho:
        keiro(l[0],l[1],K)
    result+=1
    for j in nx:
        C[j[0]][j[1]]=result
    taisho=nx.copy()

print(result)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 9)

n, q = map(int, input().split())
root = [[] for _ in range(n)]
plus = [0 for _ in range(n)]
ans = [0 for _ in range(n)]
for _ in range(n - 1):
    a, b = map(int, input().split())
    root[a - 1].append(b - 1)
    root[b - 1].append(a - 1)
for _ in range(q):
    p, x = map(int, input().split())
    plus[p - 1] += x
    
def dfs(pos, cost):
    check[pos] = True
    cost += plus[pos]
    ans[pos] = cost
    for next_pos in root[pos]:
        root[next_pos].remove(pos)
        dfs(next_pos, cost)

check = [False for _ in range(n)]
for i in range(n):
    if not check[i]:
        dfs(i, 0)

for i in ans[:-1]:
    print(i, end=" ")
print(ans[-1])

### FIXED CODE ###

from sys import setrecursionlimit, stdin

setrecursionlimit(10 ** 9)

def input():
    return stdin.readline()

n, q = map(int, input().split())
root = [[] for _ in range(n)]
ans = [0 for _ in range(n)]
for _ in range(n - 1):
    a, b = map(int, input().split())
    root[a - 1].append(b - 1)
    root[b - 1].append(a - 1)
for _ in range(q):
    p, x = map(int, input().split())
    ans[p - 1] += x
    
def dfs(pos, before):
    for next_pos in root[pos]:
        if next_pos == before:
            continue
        ans[next_pos] += ans[pos]
        dfs(next_pos, pos)

dfs(0, -1)

for i in range(n):
    print(ans[i], end=" ")
### BUGGY CODE ###

N,Y = (int(x) for x in input().split())
temp = [-1 for n in range(3)]
myflag = False
for x in range(N+1):
  if myflag:break
  for y in range(N+1-x):
    if myflag:break
    for z in range(N+1-x-y):
      if myflag :break
      if x+y+z == N and 10000*x + 5000*y + 1000*z ==Y:
        temp = [x,y,z]
        myflag = True

print('{} {} {}'.format(temp[0],temp[1],temp[2]))

### FIXED CODE ###

N,Y = (int(x) for x in input().split())
temp = [-1 for n in range(3)]
myflag = False
for x in range(N+1):
  if myflag:break
  for y in range(N+1-x):
    if myflag:break
    z = N - x - y
    if 10000*x + 5000*y + 1000*z == Y:
      temp=[x,y,z]

print('{} {} {}'.format(temp[0],temp[1],temp[2]))
### BUGGY CODE ###

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


dp = [[0] * (s + 1) for _ in range(n+1)]


for i in range(1, n+1):
    for j in range(1, s+1):
        if a[i-1] > j:
            dp[i][j] = dp[i-1][j]
        elif a[i-1] == j:
            dp[i][j] = dp[i-1][j] + i
        else:
            dp[i][j] = dp[i-1][j] + dp[i-1][j-a[i-1]]

ans = 0

for i in range(1, n+1):
    ans += dp[i][s]
    ans %= 998244353


print(ans)

### FIXED CODE ###

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


dp = [[0] * (s + 1) for _ in range(n+1)]


for i in range(1, n+1):
    for j in range(1, s+1):
        if a[i-1] > j:
            dp[i][j] = dp[i-1][j]
        elif a[i-1] == j:
            dp[i][j] = (dp[i-1][j] + i)%998244353
        else:
            dp[i][j] = (dp[i-1][j] + dp[i-1][j-a[i-1]])%998244353

ans = 0

for i in range(1, n+1):
    ans += dp[i][s]
    ans %= 998244353


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

H,K=map(int,input().split())
lst_0=list(map(int,input().split()))
DP=[float("INF")]*H
DP[0]=0
lst_2=[]
for i in range(1,H):
    lst_1=[]
    for j in range(1,K+1):
        if i - j >= 0:
            DP[i]=abs(lst_0[i]-lst_0[i-j])+DP[i-j]
            lst_1.append(DP[i])
    DP[i]=min(lst_1)
print(DP[-1])

### FIXED CODE ###

import sys
input = sys.stdin.readline
H, K = map(int, input().split())
lst_0=list(map(int,input().split()))
DP=[float("INF")]*H
DP[0]=0
for i in range(1,H):
    for j in range(1,K+1):
        if i - j >= 0:
            DP[i]=min(DP[i],abs(lst_0[i]-lst_0[i-j])+DP[i-j])
print(DP[H-1])
### BUGGY CODE ###

import math
b=int(input())+1
sum=0
for x in range(1,b):
    for y in range(1,b):
        for z in range(1,b):
            if x==y and x==z:
                sum+=x
            elif x==y or z==y:
                sum+=math.gcd(x, z)
            elif x==z:
                sum+=math.gcd(y, z)
            else:
                sum+=math.gcd(x, math.gcd(y, z))
print(sum)

### FIXED CODE ###


b=int(input())-1
ary=[1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836, 194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709, 397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712, 709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467, 1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772,10813692]
print(ary[b])
### BUGGY CODE ###

import sys

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

for i in range(N):
    if a[i] == 0:
        print("0")
        exit(0)

ans = a[i]
for i in range(1, N):
    ans *= a[i]

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


### FIXED CODE ###

import sys

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

for val in a:
    if val == 0:
        print("0")
        exit(0)

ans = 1
for val in a:
    ans *= val
    if ans > 1000000000000000000:
        print("-1")
        exit(0)

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

import itertools
k = int(input())

d = [[] for _ in range(k)]
for i in range(1, k+1):
    for ii in range(1, k+1):
        if i % ii == 0:
            d[i-1].append(ii)

seq = [i for i in range(1, k+1)]
ans = 0
A = list(itertools.combinations_with_replacement(seq, 3))
for a in A:
    a1 = a[0]
    a2 = a[1]
    a3 = a[2]
    if a1 == a2 == a3:
        m = 1
    elif a1 == a2 or a1 == a3 or a2 == a3:
        m = 3
    else:
        m = 6
    ans += max(set(d[a1-1]) & set(d[a2-1]) & set(d[a3-1])) * m

print(ans)

### FIXED CODE ###

import itertools
k = int(input())

d = [[] for _ in range(k)]

for i in range(1, k+1):
    n = 1
    while i*n <= k:
        d[i*n-1].append(i)
        n += 1

seq = [i for i in range(1, k+1)]
ans = 0
A = list(itertools.combinations_with_replacement(seq, 3))
for a in A:
    a1 = a[0]
    a2 = a[1]
    a3 = a[2]
    if a1 == a2 == a3:
        m = 1
    elif a1 == a2 or a1 == a3 or a2 == a3:
        m = 3
    else:
        m = 6
    ans += max(set(d[a1-1]) & set(d[a2-1]) & set(d[a3-1])) * m

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

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

ans = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            head = 0
            pin = [i, j, k]
            for c in S:
                if c == str(pin[head]):
                    head += 1
                if head == 3:
                    ans += 1
                    break

print(ans)


### FIXED CODE ###

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

ans = 0

for n in range(1000):
    pin = str(n).zfill(3)
    head = 0
    for c in S:
        if c == pin[head]:
            head += 1
        if head == 3:
            ans += 1
            break

print(ans)