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

import numpy as np

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

bins = np.array([i for i in range(A, B+1)], dtype='int64')
if A % 2 == 0:
    if B % 2 == 0:
        # 偶偶
        if ((B - A) / 2) % 2 == 0:
            print(int(bin(B ^ 0), 2))
        else:
            print(int(bin(B ^ 1), 2))
    else:
        # 偶奇
        if ((B - A + 1) / 2) % 2 == 0:
            print(0)
        else:
            print(1)
else:
    if B % 2 == 0:
        # 奇遇
        if ((B-A-1) / 2) % 2 == 0:
            print(int(bin(B ^ A), 2))
        else:
            print(int(bin(B ^ A ^ 1), 2))
    else:
        # 奇奇
        if ((B-A) / 2) % 2 == 0:
            print(A)
        else:
            print(A ^ 1)


### FIXED CODE ###

import numpy as np

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

# bins = np.array([i for i in range(A, B+1)], dtype='int64')
if A % 2 == 0:
    if B % 2 == 0:
        # 偶偶
        if ((B - A) / 2) % 2 == 0:
            print(int(bin(B ^ 0), 2))
        else:
            print(int(bin(B ^ 1), 2))
    else:
        # 偶奇
        if ((B - A + 1) / 2) % 2 == 0:
            print(0)
        else:
            print(1)
else:
    if B % 2 == 0:
        # 奇遇
        if ((B-A-1) / 2) % 2 == 0:
            print(int(bin(B ^ A), 2))
        else:
            print(int(bin(B ^ A ^ 1), 2))
    else:
        # 奇奇
        if ((B-A) / 2) % 2 == 0:
            print(A)
        else:
            print(A ^ 1)
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

N,M = map(int,readline().split())
UVST = np.array(read().split(),np.int32)
S,T = UVST[-2:]
UV = UVST[:-2]; U = UV[::2]; V = UV[1::2]

rows = []
cols = []
U1 = U+N; U2 = U1+N
V1 = V+N; V2 = V1+N
# ken
rows.append(U); cols.append(V1)
# ken
rows.append(U1); cols.append(V2)
# pa
rows.append(U2); cols.append(V)
row = np.concatenate(rows)
col = np.concatenate(cols)
graph = csr_matrix((np.ones(len(row)),(row,col)),(N+N+N+1,N+N+N+1))

dist = dijkstra(graph,directed=True,indices=S)[T]

answer = -1 if dist == np.inf else int(dist)//3
print(answer)

### FIXED CODE ###

# 頂点を3回ずつに持つ (x歩目の着地）
# 最短路

import sys
input = sys.stdin.readline
N,M = map(int,input().split())
if M == 0:
  print(-1)
  exit()
edge = [[] for _ in range(N+1)]
for _ in range(M):
  u,v = map(int,input().split())
  edge[u].append(v)
S,T = map(int,input().split())

INF = 10 ** 9
dist = [[INF,INF,INF] for _ in range(N+1)]

d = 0
q = [S]
while q:
  d += 1
  r = d % 3
  qq = []
  for u in q:
    for v in edge[u]:
      if dist[v][r] == INF:
        dist[v][r] = d
        qq.append(v)
  q = qq

d = dist[T][0]
answer = -1 if d == INF else d // 3
print(answer)
### BUGGY CODE ###

N, M = map(int, input().split())
MOD = 10**9+7
broken = [int(input()) for _ in range(M)]
l = [0]*(N+1)

for i in range(N+1):
    if i in broken:
        continue
    elif i==0 or i==1:
        l[i] = 1
    else:
        l[i] = l[i-1] + l[i-2]
    l[i] %= MOD

print(l[N])

### FIXED CODE ###

import sys
sys.setrecursionlimit(150000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))
### BUGGY CODE ###

from collections import deque
import sys
input = sys.stdin.readline

r, c = list(map(int, input().split()))
sy, sx = [0, 0]
gy, gx = [r-1, c-1]

s = [list(map(str, list(input()))) for i in range(r)]

N = r*c
G = [[] for _ in range(N)]
dist = [-1]*N
que = deque()
for i in range(r):
    for j in range(c):
        if s[i][j] == '#':
            que.append(i*c+j)
            dist[i*c+j] = 0
        for x, y in ([0, 1], [0, -1], [1, 0], [-1, 0]):
            if 0 <= i+y <= r-1 and 0 <= j+x <= c-1:
                G[i*c+j].append((i+y)*c+j+x)

while que:
    v = que.popleft()
    d = dist[v]
    for w in G[v]:
        if dist[w] > -1:
            continue
        dist[w] = d + 1
        que.append(w)

ans = max(dist)
print(ans)


### FIXED CODE ###

# import numpy as np
# import scipy as sp
# print(a,b,c,sep="") # 半角スペースなしで出力(abc)
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
# import sys ; sys.exit() # プログラム終了
# from copy import deepcopy ; b=deepcopy(a)
# chr(ord('a') + 1)
# s.sort(key=lambda x: x[1], reverse=False) # 2番目の要素で昇順にソート（Trueなら降順）
#
from copy import deepcopy
from collections import deque

d = deque()
h, w = map(int, input().split())
s = [list(map(str, list(input()))) for i in range(h)]
used = [[True for j in range(w)] for i in range(h)]
# used = [[True]*w]*h
for i in range(h):
    for j in range(w):
        if (s[i][j] == "#"):
            d.append([i, j])
            used[i][j] = False


ans = -1
while (d):

    tmp = deque()
    while(d):
        i, j = d.popleft()

        if i+1 < h and used[i+1][j]:
            s[i+1][j] = "#"
            tmp.append([i+1, j])
            used[i+1][j] = False

        if i-1 >= 0 and used[i-1][j]:
            s[i-1][j] = "#"
            tmp.append([i-1, j])
            used[i-1][j] = False

        if j+1 < w and used[i][j+1]:
            s[i][j+1] = "#"
            tmp.append([i, j+1])
            used[i][j+1] = False

        if j-1 >= 0 and used[i][j-1]:
            s[i][j-1] = "#"
            tmp.append([i, j-1])
            used[i][j-1] = False

    d = tmp
    ans += 1

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

import sys
INF = 10**18

if __name__ == "__main__":
    n,k = map(int,input().split())
    h = list(map(int,input().split()))
    dp = [INF]*n
    dp[0] = 0
    for i in range(1,n):
        c = INF
        for j in range(max(i-k,0),i):
            d = dp[j] + abs(h[j]-h[i])
            c = min(c,d)
        dp[i] = c
    print(dp[-1])

### FIXED CODE ###

import sys
INF = 10**18

if __name__ == "__main__":
    n,k = map(int,input().split())
    h = list(map(int,input().split()))
    dp = [INF]*n
    dp[0] = 0
    for i in range(1,n):
        c = INF
        for j in range(max(i-k,0),i):
            d = dp[j] + abs(h[j]-h[i])
            c = min(c,d)
        dp[i] = c
    print(dp[-1])
### BUGGY CODE ###

from bisect import bisect_left,bisect_right

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

A.sort()

hi = 10**18+1
lo = -10**18-1

while hi-lo > 1:
    mid = (hi+lo)//2
    under_mid = 0

    for i in range(N):
        if A[i] == 0:
            if mid > 0:
                under_mid += N
        elif A[i] > 0:
            under_mid += bisect_left(A,-(-mid//A[i]))
        else:
            under_mid += N-bisect_right(A,mid//A[i])
        if A[i]*A[i] < mid:
            under_mid -= 1
    under_mid //= 2

    if under_mid < K:
        lo = mid
    else:
        hi = mid

print(lo)

### FIXED CODE ###

#!/usr/bin/env python3
#import sys; sys.stdin=open('input_file.txt')
#------------------------------------------
import numpy as np

N,K = map(int,input().split())
A = np.array(input().split(),dtype=np.int64)

A = np.sort(A)

pos = A[A>0]
neg = A[A<0]
zero = len(A[A==0])

hi = 10**18+1
lo = -10**18-1

while hi-lo > 1:
    mid = (hi+lo)//2
    under_mid = 0

    if mid > 0: under_mid += N*zero
    under_mid += np.searchsorted(A,-(-mid//pos),side='left').sum()
    under_mid += (N-np.searchsorted(A,mid//neg,side='right')).sum()
    under_mid -= np.count_nonzero(A*A < mid)
    under_mid //= 2

    if under_mid < K:
        lo = mid
    else:
        hi = mid

print(lo)
### BUGGY CODE ###

from sys import stdin
from collections import defaultdict
readline = stdin.readline
read = stdin.buffer.read
def r_map(): return map(int, readline().rstrip().split())
def r_list(): return list(r_map())

MOD = 10 ** 9 + 7
# import numpy as np
# from numba import jit
# stdin = open('sample.txt')

def main():
    N = int(readline().rstrip())
    A = r_list()
    A.sort()
    ans = 0
    a_dic = defaultdict(lambda: 0)
    for i, a in enumerate(A[:-1]):
        for aa in A[i + 1:]:
            a_dic[a] += aa
    for a in A[:-1]:
        ans += a * a_dic[a]
    print(ans % MOD)

if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin
from collections import defaultdict
readline = stdin.readline
read = stdin.buffer.read
def r_map(): return map(int, readline().rstrip().split())
def r_list(): return list(r_map())

MOD = 10 ** 9 + 7
# import numpy as np
# from numba import jit
# stdin = open('sample.txt')

def main():
    N = int(readline().rstrip())
    A = r_list()
    A.sort()
    ans = 0
    a_dic = defaultdict(lambda: 0)
    for j, a in enumerate(A[:0:-1]):
        i = N - 2 - j
        a_dic[i] += a
        if i > 0:
            a_dic[i - 1] = a_dic[i]
    for i, a in enumerate(A[:-1]):
        ans += a * a_dic[i]
    print(ans % MOD)

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

def gcd(a, b):
    while a:
        b, a = a, b % a
    return b


s = 0
n = int(input())


for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
                s += gcd(gcd(i,j), k)
            
print(s)

### FIXED CODE ###

def gcd(a, b):
    while a:
        b, a = a, b % a
    return b


s = 0
n = int(input())


for i in range(1, n+1):
    for j in range(i+1, n+1):
        for k in range(j+1, n+1):
            s += gcd(gcd(i,j), k)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        s += gcd(i, j)

s = s*6 + int(0.5 * n * (n+1))
print(s)
### BUGGY CODE ###

from sys import stdin
n = int(stdin.readline().rstrip())
def lucas(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return lucas(n-1)+lucas(n-2)

print(lucas(n))

### FIXED CODE ###

from sys import stdin
from functools import lru_cache
n = int(stdin.readline().rstrip())
@lru_cache(maxsize=86)
def lucas(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return lucas(n-1)+lucas(n-2)

print(lucas(n))
### BUGGY CODE ###

#d,t,s=map(int,input().split())
n=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans+=A[i]*A[j]
    ans%=10**9+7
print(ans)

### FIXED CODE ###

import itertools
#h,w=map(int,input().split())
#S=[list(map(int,input().split())) for _ in range(h)]
n=int(input())
A=list(map(int,input().split()))
Ar=list(itertools.accumulate(A))
ans=0
for i in range(n-1):
    ans+=A[i]*(Ar[n-1]-Ar[i])
    ans%=10**9+7
print(ans)
### BUGGY CODE ###

class BIT:
    def __init__(self,n):
        self.tree = [0]*(n+1)
        self.size = n
    
    def add(self,i,x):
        while i <= self.size:
            self.tree[i] += x
            i += i&-i
    
    def sum(self,i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i&-i
        return s

N,Q = map(int,input().split())
bit = BIT(N)
C = list(map(int,input().split()))
query = [list(map(int,input().split()))+[i] for i in range(Q)]
query.sort(key=lambda x: x[1])
ans = []
#良い玉のindexを1-indexで管理する
colorMemo = [0]*(N+1)
i = 1
for j in range(Q):
    l,r = query[j][:2]
    #良い玉の情報を更新する
    while i <= r:
        c = C[i-1]
        if colorMemo[c]:
            bit.add(colorMemo[c],-1)
        bit.add(i,1)
        colorMemo[c] = i
        i += 1
    query[j].append(bit.sum(r)-bit.sum(l-1))

query.sort(key=lambda x: x[2])
for l,r,i,a in query:
    print(a)


### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    class BIT:
        def __init__(self,n):
            self.tree = [0]*(n+1)
            self.size = n
        
        def add(self,i,x):
            while i <= self.size:
                self.tree[i] += x
                i += i&-i
        
        def sum(self,i):
            s = 0
            while i > 0:
                s += self.tree[i]
                i -= i&-i
            return s

    N,Q = map(int,input().split())
    bit = BIT(N)
    C = list(map(int,input().split()))
    query = []
    for i in range(Q):
        l,r = map(int,input().split())
        query.append([l,r,i])
    query.sort(key=lambda x: x[1])
    ans = [0]*Q
    #良い玉のindexを1-indexで管理する
    colorMemo = [0]*(N+1)
    cur = 1
    for q in query:
        l,r,j = q
        #良い玉の情報を更新する
        for i in range(cur,r+1):
            c = C[i-1]
            if colorMemo[c]:
                bit.add(colorMemo[c],-1)
            bit.add(i,1)
            colorMemo[c] = i
        cur = r + 1
        ans[j]=bit.sum(r)-bit.sum(l-1)

    print(*ans, sep="\n")
main()
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
while len(a)!=1:
    a = sorted(a)
    a = [i%min(a) for i in a[1:]]+[min(a)]
    a = [i for i in a if i!=0]
print(min(a))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
def gcd(x,y):
    if x<y:
        x,y = y,x
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)
ans = a[0]
for i in a:
    ans = gcd(ans,i)
print(ans)
### BUGGY CODE ###

def comb_mod(n,r,mod):
    ans = 1
    lis = []
    for i in range(r):
        ans *= n+i
        ans *= pow(i+1,-1,mod)
        ans %= mod
        lis.append(ans)
    return lis
def solve():
    ans = 1
    mod = 10**9+7
    K = int(input())
    S = input()
    s = len(S)
    lis = comb_mod(s,K,mod)
    for k in range(K):
        ans *= 26
        ans += lis[k]*pow(25,k+1,mod)
        ans %= mod
    return ans
print(solve())


### FIXED CODE ###

def comb_mod(n,r,mod):
    ans = 1
    lis = []
    for i in range(r):
        ans *= n+i
        ans *= pow(i+1,mod-2,mod)
        ans %= mod
        lis.append(ans)
    return lis
def solve():
    ans = 1
    mod = 10**9+7
    K = int(input())
    S = input()
    s = len(S)
    lis = comb_mod(s,K,mod)
    for k in range(K):
        ans *= 26
        ans += lis[k]*pow(25,k+1,mod)
        ans %= mod
    return ans
print(solve())
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**8)
n = int(input())
data = [[] for i in range(n)]
for i in range(n-1):
    a,b,c = map(int,input().split())
    a -= 1
    b -= 1
    data[a].append([b,c])
    data[b].append([a,c])

dist = [-1 for i in range(n)]
q,k = map(int,input().split())
k -= 1
dist[k] = 0

def dfs(now,pre,d):
    dist[now] = d
    for p,q in data[now]:
        if p == pre:
            continue
        dfs(p,now,d+q)

dfs(k,-1,0)

for i in range(q):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    print(dist[x]+dist[y])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
n = int(input())
data = [[] for i in range(n)]
for i in range(n-1):
    a,b,c = map(int,input().split())
    a -= 1
    b -= 1
    data[a].append([b,c])
    data[b].append([a,c])

dist = [-1 for i in range(n)]
q,k = map(int,input().split())
k -= 1
dist[k] = 0

def dfs(now,pre,d):
    dist[now] = d
    for p,q in data[now]:
        if p == pre:
            continue
        dfs(p,now,d+q)

dfs(k,-1,0)

for i in range(q):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    print(dist[x]+dist[y])
### BUGGY CODE ###

N, M, R = map(int, input().split())
R_LIST = list(map(int, input().split()))
ABC = []
for _ in range(M):
    a,b,c = map(int, input().split())
    ABC.append((a,b,c))
    
edges = ABC[:]


def warshall_floyd(d, n):
    # d: グラフ二次元リスト
    # n: 頂点数 (0始まり)
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# グラフ無効グラフ化
graph = [[float("inf") for i in range(N+1)] for i in range(N+1)] 
for x,y,z in edges:
    graph[x][y] = z
    graph[y][x] = z
for i in range(N+1):
    graph[i][i] = 0 #自身のところに行くコストは０

#最短経路
shortest =  warshall_floyd(graph, N+1)
    
# 順列全探索
import sys
INT_MAX = sys.maxsize # 9223372036854775807
ans = INT_MAX

import itertools
line = R_LIST
for l in itertools.permutations(line):
    #print(l)
    tmp_len = 0
    for a,b in zip(l[:-1], l[1:]):
        tmp_len += shortest[a][b]

    #print(tmp_len)
    ans = min(ans, tmp_len)
print(ans)

### FIXED CODE ###

N, M, R = map(int, input().split())
R_LIST = list(map(int, input().split()))
ABC = []
for _ in range(M):
    a,b,c = map(int, input().split())
    ABC.append((a,b,c))
    
    
edges = ABC[:]


def warshall_floyd(d, n):
    # d: グラフ二次元リスト
    # n: 頂点数 (0始まり)
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# グラフ無効グラフ化
graph = [[float("inf") for i in range(N+1)] for i in range(N+1)] 
for x,y,z in edges:
    graph[x][y] = z
    graph[y][x] = z
for i in range(N+1):
    graph[i][i] = 0 #自身のところに行くコストは０

#最短経路
shortest =  warshall_floyd(graph, N+1)
    
# 順列全探索
import sys
INT_MAX = sys.maxsize # 9223372036854775807
ans = INT_MAX

import queue

rest = set(R_LIST[:])

import copy  
def dfs(cost,pre,rest):
    if len(rest) == 0:
        return cost
    
    ret = INT_MAX
    for r in rest:
        if pre == None:
            next_cost = 0
        else:
            next_cost = cost + shortest[pre][r]
        next_rest = copy.copy(rest)
        next_rest.remove(r)
        
        tmp_ret = dfs(next_cost, r, next_rest)
        ret = min(ret, tmp_ret)
        
    return ret
        
    

print(dfs(0, None, rest))
### BUGGY CODE ###

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

b = [(a[i]-i-1) for i in range(n)]
#print(b)

s = sum(b)
m = int(s/n)
ans = float('inf')
if m<0:
  m = m-1
  for i in range(m, 1, 1):
    res = 0
    for j in range(n):
      res += abs(b[j]-i)
    ans = min(ans, res)
else:
  m = m+1
  for i in range(m+1):
    res = 0
    for j in range(n):
      res += abs(b[j]-i)
    ans = min(ans, res)
  
print(ans)

### FIXED CODE ###

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

b = [(a[i]-i-1) for i in range(n)]
b = sorted(b)

if n % 2 == 1:
  res = b[(n-1)//2]
else:
  res = (b[n//2-1] + b[n//2])//2
  
print(sum(map(abs, [b[i]-res for i in range(n)])))
### BUGGY CODE ###

N,K,S = map(int,input().split())
X = [1000000000 for _ in range(N)]
ans=""
for i in range (K):
    X[i]=S

for i in range(N):
    ans=ans+" "+str(X[i])

print(ans)

### FIXED CODE ###

N,K,S = map(int,input().split())
X = [26845184 for _ in range(N)]
ans=""
for i in range (K):
    X[i]=S

print(*X)
### BUGGY CODE ###

def main():
    N=int(input())
    P=[int(_) for _ in input().split()]
    ans = 0

    for i in range(1,N+1):
        flag=0
        for j in range(1,i+1):
            if P[i-1] > P[j-1]:
                flag=1
            if flag:
                continue
        ans += abs(flag-1)
    print(ans)

main()


### FIXED CODE ###

INF=float('inf')

def main():
    N=int(input())
    P=[int(_) for _ in input().split()]
    tmp=INF
    ans = 0

    for i in range(N):
        if tmp > P[i]:
            ans += 1
        tmp = min(tmp, P[i])
    print(ans)

main()
### BUGGY CODE ###

n = int(input())
A = list(map(int,input().split()))
mod = (10**9) + 7
t = 0
for i in range(n-1):
    for j in range(i+1,n):
        t += (A[i] * A[j])
s = t%mod
print(s)

### FIXED CODE ###

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

N=int(input())
A=list(map(int,input().split()))
ans=-1
for i in range(len(A)):
    base=A[i]
    count=0
    for j in range(len(A)):
        if abs(A[j]-base)<=1:
            count+=1
    ans=max(ans,count)
print(ans)
    


    

### FIXED CODE ###

from collections import Counter
#先に数えておく
N=int(input())
A=list(map(int,input().split()))
low=min(A)
high=max(A)

c_l=Counter(A)
ans=-1
for x in range(low,high+1):
    #範囲
    a=x-1
    b=x
    c=x+1
    num=c_l[a]+c_l[b]+c_l[c]
    ans=max(num,ans)
print(ans)
### BUGGY CODE ###

N=int(input())
def make_divisors(n):
    divisors = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors+=1
            if i != n // i:
                divisors+=1
    return divisors
a=0
for i in range(1,N):
    a+=make_divisors(i)
print(a)

### FIXED CODE ###

N=int(input())
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
print(sum(num_divisors_table(N-1)))
### BUGGY CODE ###

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

ans = 1
for i in range(n):
  ans = ans * As[i]
  
if (ans > 10**18):
  print(-1)
else:
  print(ans)

### FIXED CODE ###

import sys

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

Flag = True
ans = 1

if (0 in As):
  print(0)
  sys.exit()


for i in range(n):
  ans = ans * As[i]
  if (ans > 10**18):
    if (Flag):
      print(-1)
      Flag = False
      sys.exit()
  
if (Flag):
  print(ans)
### BUGGY CODE ###

import sys
from collections import defaultdict

lines = 1
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())


s = inp[0]
n = len(s)

tmp = defaultdict(int)
tmp[0] = 1

for k in range(1, n + 1):
    t = int(s[n-k:n])
    tmp[t % 2019] += 1


result = 0

for v in tmp.values():
    result += int(v * (v - 1) / 2)


print(n - len(tmp) + 1)


### FIXED CODE ###

import sys
from collections import defaultdict

lines = 1
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())


s = inp[0]
n = len(s)

tmp = defaultdict(int)
tmp[0] = 1

b = 0
d = 1

for i in range(1, n + 1):
    a = int(s[n - i])
    b = ((d * a) + b) % 2019
    tmp[b] += 1
    d = (d * 10) % 2019

result = 0

for v in tmp.values():
    result += int(v * (v - 1) / 2)

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

n,q = map(int,input().split())
s = list(input())
ac = []

for i in range(n-1):
    if s[i] == "A":
        if s[i+1] == "C":
            ac.append(i)

for _ in range(q):
    l,r = map(int,input().split())
    l -= 1
    r -= 1
    ans = 0
    
    for i in ac:
        if r <= i:
            break
            
        if l <= i < r:
            ans += 1
            
    print(ans)

### FIXED CODE ###

n,q = map(int,input().split())
s = input()
ac = [0] * (n+1)
num = 0

for i in range(n):
    if i != 0:
        if s[i-1:i+1] == "AC":
            num += 1
            
    ac[i+1] = num
    
for i in range(q):
    l,r = map(int,input().split())
    print(ac[r]-ac[l])
### BUGGY CODE ###

n = int(input())
A = list()
for i in range(0, n):
    A.append(int(input()))
m = 0
cnt = 0
G = [1]
flag = True
# G[i] = 3*Gi-1 + 1
for i in range(1, 100):
    h = 3 * G[0] + 1
    if h > n:  # h???n?¶???????????????§?????????4n+3*2n-1+1
        m = i
        break
    else:
        G.insert(0, h)


for g in G:
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v


print(m)
print(" ".join(str(x) for x in G))
print(cnt)

print("\n".join(str(x) for x in A))

### FIXED CODE ###

n = int(input())
A = list()
G = [1]
cnt = 0

for i in range(0, n):
    A.append(int(input()))


def insertion_sort(A, n, g):
    global cnt
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j -= g
            cnt += 1
        A[j+g] = v


# G[i] = 3*Gi-1 + 1
def shell_sort():
    for i in range(1, 101):
        h = 3 * G[0] + 1
        if h > n:  # h???n?¶???????????????§?????????4n+3*2n-1+1
            break
        else:
            G.insert(0, h)
    for g in G:
        insertion_sort(A, n, g)

shell_sort()
print(len(G))
print(" ".join(str(x) for x in G))
print(cnt)
print("\n".join(str(x) for x in A))
### BUGGY CODE ###

import math
n = int(input() )
n+=1
sum = 0
for i in range (1,n):
    for j in range (1,n): 
        for k in range (1,n):
            sum += math.gcd(  math.gcd(i,j) ,k )
            #print(i,j,k)

print( sum )

### FIXED CODE ###

import math
n = int(input() )
n+=1
sum = 0
for i in range (1,n):
    for j in range (1,n):
        gcdIJ = math.gcd(i,j)
        for k in range (1,n):
            sum += math.gcd( gcdIJ  ,k )
            #print(i,j,k)

print( sum )