Harryxun/stf_run huggingface dataset:
n=int(input())
s=int(input())

No=0
if n==s:
    print(n+1)
    No =1
else:
    for b in range(2,int(n**0.5)+1):
        m=0
        N=n
        while N!=0:
            m+=N%b
            N=N//b
            if m>s:
                break    
        if m==s:
            print(b)
            No=1
            exit()
    for p in range(int(n**0.5-1),0,-1):
        b = float(n-s)/float(p)+1.0
        if abs(b-int(b))<10**(-10):
            b=int(b)
            m=0
            N=n
            while N!=0:
                m+=N%b
                N=N//b
                if m>s:
                    break    
            if m==s:
                print(b)
                No=1
                exit()
if No==0:
    print(-1)

### FIXED CODE ###

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

No=0
if n==s:
    print(n+1)
    No =1
else:
    for b in range(2,int(n**0.5)+2):
        m=0
        N=n
        while N!=0:
            m+=N%b
            N=N//b
            if m>s:
                break    
        if m==s:
            print(b)
            No=1
            exit()
    for p in range(int(n**0.5-1),0,-1):
        b = float(n-s)/float(p)+1.0
        if abs(b-int(b))<10**(-10)and b>0:
            b=int(b)
            m=0
            N=n
            while N!=0:
                m+=N%b
                N=N//b
                if m>s:
                    break    
            if m==s:
                print(b)
                No=1
                exit()
if No==0:
    print(-1)
s, w = map(str, input().split())
if w >=  s:
  print('unsafe')
elif:
  print('safe')

### FIXED CODE ###

s, w = input().split()
if int(w) >=  int(s):
  print('unsafe')
else:
  print('safe')
H, N = map(int, input().split())
PP = list(map(int, input().split()))
print("Yes" if sum(PP)>=H else(No))

### FIXED CODE ###

H, N = map(int, input().split())
PP = list(map(int, input().split()))
print("Yes" if sum(PP) >= H else "No")
"""
NTC here
"""
from sys import stdin, setrecursionlimit
setrecursionlimit(10**7)

def iin(): return int(stdin.readline())
 
 
def lin(): return list(map(int, stdin.readline().split()))

# range = xrange
# input = raw_input
from math import gcd
gcd=gcd
def lcm(a,b):
    return (a*b)//(gcd(a,b))
def main():
    n=iin()
    a=lin()
    s2=sum(a)
    s1=0
    mn=abs(s2-s1)
    for i in range(n-1):
        s1+=a[i]
        s2-=a[i]
        mn=min(mn,abs(s1-s2))
    print(mn)

"""
1 2 5 8 15 20 23 11 45
"""
        


    
    
            



    
                











main()

### FIXED CODE ###

"""
NTC here
"""
from sys import stdin, setrecursionlimit
setrecursionlimit(10**7)

def iin(): return int(stdin.readline())
 
 
def lin(): return list(map(int, stdin.readline().split()))

# range = xrange
# input = raw_input
def main():
    n=iin()
    a=lin()
    s2=sum(a)
    s1=0
    mn=abs(s2-s1)
    for i in range(n-1):
        s1+=a[i]
        s2-=a[i]
        mn=min(mn,abs(s1-s2))
    print(mn)

"""
1 2 5 8 15 20 23 11 45
"""
        


    
    
            



    
                











main()
N = int(input())
L = [list(map(int, input().split())) for i in range(N-1)]

A = [0] * (N)
L.sort()
for i in L:
    if i[2]%2 != 0 and L[i[0]] == L[i[1]]:
        L[i[0]] = (L[i[0]]+1)%2
    elif i[2]%2 == 0:
        L[i[1]] = L[i[0]]
for i in A:
    print(i)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N = int(input())
W = [list(map(int, input().split())) for _ in range(N-1)]
nodes = [[] for _ in range(N+1)]
for w in W:
    nodes[w[0]].append((w[1], w[2]))
    nodes[w[1]].append((w[0], w[2]))
ans = [-1] * (N+1)
ans[1] = 0
def search(num, root, dis):
    for node in nodes[num]:
        sum_d = dis
        if node[0] != root:
            idx = node[0]
            sum_d += node[1]%2
            if sum_d%2 != 0:
                ans[idx] = 1
            else:
                ans[idx] = 0
            search(idx, num, sum_d)

search(1, 0, 0)
for answer in ans[1:]:
    print(answer)
n = raw_input()
a = n.split(" ")
b = int(a[0])
c = int(a[1])
print b*c (b+c)*2

### FIXED CODE ###

n = raw_input()
a = n.split(" ")
b = int(a[0])
c = int(a[1])
print b*c ,(b+c)*2
n = input()
a = list( input().split())
cnt = 0

if (len(a) = 3) and (a[1] = 2):
  cnt = 1

else:
  for i in range ( 1, len(a)-1):
    if (a[i-1]<a[i]<a[i+1]) or (a[i+1]<a[i]<a[i-1]):
      cnt += 1
    
print (cnt)    


### FIXED CODE ###

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

for i in range ( 1, len(a)-1):
  if (a[i-1]<a[i]<a[i+1]) or (a[i+1]<a[i]<a[i-1]):
    cnt += 1
    
print (cnt)
rint(input().count("1"))

### FIXED CODE ###

print(input().count("1"))
import math

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

digit = math.floor(math.log2(max(A))) + 1
bin_A = [format(Ai, '0' + str(digit) + 'b') for Ai in A]

ans = 0

for i in range(digit):
    num0 = 0
    num1 = 0
    for j in range(N):
        if bin_A[j][i] == '1':
            num1 += 1
        else:
            num0 += 1
    ans += (num1 * num0) * (2**(digit-i-1))

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

### FIXED CODE ###

import math

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

ans = 0
fil = 1
for i in range(60):
    num1 = len([1 for j in range(N) if A[j] & fil])
    num0 = N - num1
    ans += (num1 * num0) * fil
    fil <<= 1

print(ans % (10 ** 9 + 7))
n = int(raw_input())
a = map(int, raw_input().split())

memo = dict()
def dp(pos, flag):
  if pos == n - 1:
    if flag == 0:
      return a[pos]
    else:
      return -a[pos]
  if (pos, flag) in memo:
    return memo[(pos, flag)]
  elif flag == 0:
    memo[(pos, flag)] = max(dp(pos + 1, 0) + a[pos], dp(pos + 1, 1) - a[pos])
    return memo[(pos, flag)]
  else:
    memo[(pos, flag)] = max(dp(pos + 1, 0) - a[pos], dp(pos + 1, 1) + a[pos])
    return memo[(pos, flag)]
print dp(0, 0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

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

memo = dict()
def dp(pos, flag):
  if pos == n - 1:
    if flag == 0:
      return a[pos]
    else:
      return -a[pos]
  if (pos, flag) in memo:
    return memo[(pos, flag)]
  elif flag == 0:
    memo[(pos, flag)] = max(dp(pos + 1, 0) + a[pos], dp(pos + 1, 1) - a[pos])
    return memo[(pos, flag)]
  else:
    memo[(pos, flag)] = max(dp(pos + 1, 0) - a[pos], dp(pos + 1, 1) + a[pos])
    return memo[(pos, flag)]
print dp(0, 0)
N = int(input())
com = [0]
u = [i+1 for i in range(16)]
a = 0
v = 0
j = 0
str1 = "abcdefghijklmnopqrstuvwxyz"

if N < 27:
    print(str1[N-1])
else:
    for i in range(1,17):
        a += 26**i
        com.append(a)
    for i in range(17):
        if N < com[i]+1:
            v = com[i-1]
            j = i
            break
    N = N - v
    ans = []
    for i in range(j-1,-1,-1):
        if i == 0:
            ans.append(str1[N-1])
        else:
            ans.append(str1[N//(26**i)])
        if N >= 26**i:
            N -= N//(26**i) * 26**i

    print("".join(ans))

### FIXED CODE ###

N = int(input())
com = [0]
a = 0
v = 0
j = 0
str1 = "abcdefghijklmnopqrstuvwxyz"

if N < 27:
    print(str1[N-1])
else:
    for i in range(1,13):
        a += 26**i
        com.append(a)
    for i in range(13):
        if N < com[i]+1:
            v = com[i-1]
            j = i
            break
    N = N - v - 1
    ans = []
    for i in range(j-1,-1,-1):
        ans.append(str1[N//(26**i)])
        if N >= 26**i:
            N = N - N//(26**i) * (26**i)

    print("".join(ans))
#-*- coding:utf-8 -*-
N = int(input())
a1 = []
a2 = []
s,t = 0,0
for i in range(N):
	a1.append(int(input()))
for i in range(N):
	a2.append(int(input()))


for i in range(N-1):
	for j in range(i):
		t += a1[j]
	for k in range(N-1-i):
		t += a2[i+k]
	if t > s:
	    s = t
	t = 0
print(s)

### FIXED CODE ###

#-*- coding:utf-8 -*-
N = int(input())
a1 = []
a2 = []
s,t = 0,0

a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))



for i in range(N):
	for j in range(i+1):
		t += a1[j]
	for k in range(N-i):
		t += a2[i+k]
	if t > s:
	    s = t
	t = 0
print(s)
a = int(input())
b = int(input())

if a+b <= 16:
    print("Yay!")
else:
    print(":(")


### FIXED CODE ###

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

if a+b <= 16 and a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")
N = raw_input().split()

if abs(N[2]-N[0]) <= N[3]:
	print(“Yes”)
elif abs(N[1]-N[0])+abs(N[2]-N[1]) <= 2*N[3]:
	print(“Yes”)
else:
	print(“No”)

### FIXED CODE ###

a,b,c,d = map(int, input().split())

if abs(c-a) <= d:
	print('Yes')
elif abs(b-a) <= d and abs(c-b) <= d:
	print('Yes')
else:
	print('No')
import numpy as np
n = int(input())
h = list(map(int, input().split()))
h = np.array(h)

count = 0

for k in range(max(h)):
    j = 0
    for i in range(0,len(h)):
        if h[i]==0 and i!=j:
            h[j:i] = h[j:i] -1
            count = count+1
            j = i + 1
        elif i ==len(h)-1 and h[n]!=0:
            count = count+1
            h[j:]= h[j:]-1
        elif h[i]==0 and i==j:
            j = i+1
print(count)

### FIXED CODE ###


import numpy as np
n = int(input())
h = list(map(int, input().split()))
h = np.array(h)

count = 0

for k in range(max(h)):
    j = 0
    for i in range(0,len(h)):
        if h[i]==0 and i!=j:
            h[j:i] = h[j:i] -1
            count = count+1
            j = i + 1
        elif i ==len(h)-1 and h[n-1]!=0:
            count = count+1
            h[j:]= h[j:]-1
        elif h[i]==0 and i==j:
            j = i+1
print(count)
from math import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))
l = []
for xx in x:
    l.append(abs(xx - X))

g = l[0]

for i in range(1, len(l)):
    g = gcd(g, l[i])

print(g)

### FIXED CODE ###

from fractions import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))
l = []
for xx in x:
    l.append(abs(xx - X))

g = l[0]

for i in range(1, len(l)):
    g = gcd(g, l[i])

print(g)
N, Q = list(map(int, input().split(" ")))
A_list = list(map(int, input().split(" ")))

def game(A_list, X, N):
    aoki_A_list = sorted(A_list, key=lambda val: abs(val-X))

    count = 0
    aoki_last_plus = None 
    aoki_minus_plus = None
    aoki_last_minus = None
    while True:
        taka_val = A_list[-count-1]
        aoki_val = aoki_A_list[count]
        aoki_view_val = aoki_val - X

        if aoki_view_val >= 0:
            aoki_last_plus = aoki_val
            now_plus = True
        else:
            now_plus = False

        #print(taka_val, aoki_val, aoki_last_plus, aoki_view_val)

        if aoki_last_plus is not None and aoki_last_plus >= taka_val:
            if not now_plus:
                aoki_fail = False
            if now_plus:
                if aoki_last_plus == taka_val:
                    aoki_fail = True
                else:
                    aoki_fail = False

            break

        if aoki_view_val < 0:
            aoki_last_minus = aoki_val
        
        count += 1

    conflict_count = count

    first_sum = sum(aoki_A_list[:conflict_count])
    if aoki_last_minus is not None:
        aoki_minus_last_i = A_list.index(aoki_last_minus)
    else:
        if conflict_count >= 1:
            aoki_minus_last_i = A_list.index(aoki_A_list[0])
        else:
            aoki_minus_last_i = None

    last_i = aoki_minus_last_i
    if last_i is not None:
        if aoki_fail:
            if last_i >= 1:
                if last_i % 2 == 1:
                    nokori_sum = sum(A_list[0:last_i:2])
                else:
                    nokori_sum = sum(A_list[1:last_i:2])
                
            else:
                nokori_sum = 0
        else:
            if last_i >= 2:
                nokori_sum = sum(A_list[(last_i%2):last_i-1:2])
            else:
                nokori_sum = 0

        out = sum(A_list) - (first_sum + nokori_sum)
    else:
        if N % 2 == 1:
            out = sum(A_list[0::2])
        else:
            out = sum(A_list[1::2])

    return out
        
for i in range(Q):
    X = int(input())
    out = game(A_list, X, N)
    print(out)


### FIXED CODE ###

N, H, W = [int(input()) for i in range(3)]

print((N - H + 1) * (N - W + 1))
N, limit = map(int, input().split())
bounce = input().split()
b = [0]
count = 0
for i in range(len(bounce)):
  b.append(bounce[i]+i)
  
for j in range(len(b)):
  if b[j] <= limit:
    count += 1
print(count)

### FIXED CODE ###

N, limit = map(int, input().split())
bounce = input().split()
b = [0]
count = 0
for i in range(len(bounce)):
  b.append(b[i]+int(bounce[i]))
  
for j in range(len(b)):
  if b[j] <= limit:
    count += 1
print(count)
import math,fractions
A,B = map(int,input().split())
def get_sieve_of_eratosthenes(n):
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

GCD = fractions.gcd(A,B)
 
prime_list = get_sieve_of_eratosthenes(GCD)
counter = 1
for p in prime_list:
    if GCD % p == 0:
        counter += 1
        while(GCD % p == 0):
            GCD = GCD // p
        
print(counter)

### FIXED CODE ###

import fractions
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A,B = map(int,input().split())
GCD = fractions.gcd(A,B)
pf = prime_factorize(GCD)
print(len(set(pf))+1)
import numpy as np
n = int(input())
l = np.array(list(map(int, input().split())))
b = 1
def multi(b,l):
    for a in l:
        b = b * a 
    if b > 10 ** 18:
        b = -1
    return b
b = multi(b,l)
print(b)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

def input():
    return sys.stdin.readline()[:-1]
n = int(input())
l = list(map(int, input().split(" ")))
output = 1

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

for i in range(n):
    output = output * int(l[i])
    if output > 10 ** 18:
        output = -1
        break
print(output)
import itertools

n = int(input())
p = tuple(map(int, input().split())
q = tuple(map(int, input().split())

l = list(itertools.permutations(range(1, n+1)))
a = l.index(p)
b = l.index(q)

print(abs(a-b))

### FIXED CODE ###

import itertools
 
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
 
l = list(itertools.permutations(range(1, n+1)))
a = l.index(p)
b = l.index(q)
 
print(abs(a-b))
a=input()
cnt=0
for i in a::
  if i=="7":
    cnt+=1
    break
print(["No","Yes"][cnt])

### FIXED CODE ###

a=input()
cnt=0
for i in a:
  if i=="7":
    cnt+=1
    break
print(["No","Yes"][cnt])
n = int(input())
a = list(map(int,input().split()))
cnt = 0
ans = []

for i in range(n):
    cnt += 1
    ind = a.index(cnt)
    ans.append(str(ind + 1))

print(" ".join(ans))

### FIXED CODE ###

n = int(input())

if n % 2 == 0:
    print("0.5")
else:
    print(((n - 1)/2 + 1)/n)
n  = []
while True:
    try:n.append(int(raw_input()))
    except:break
R = max(n)+1
p = [1]*R
p[0] = p[1] = 0
p[4::2] = [0 for i in range(4,R,2)]
for i in range(3,int(R**0.5)+1,2):
    if p[i]:
        p[2*i::i] = [0]*((R-2*i+1)/i)
for i in n:
    print sum(p[:i+1])

### FIXED CODE ###

import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])
import sys
import re
import math
import collections
import decimal
import bisect
import itertools

# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
INF = sys.maxsize
# MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    d = na()
    c = collections.Counter(d)

    total = 0
    for v in c.values():
        if v - 2 > -1:
            total += math.factorial(v) / math.factorial(2) / math.factorial(v - 2)

    for i in range(n):
        v = c[d[i]]
        tmp1 = 0
        if v - 2 > -1:
            tmp1 = math.factorial(v) / math.factorial(2) / math.factorial(v - 2) * (2 / v)

        print(int(total - tmp1))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import re
import math
import collections
import decimal
import bisect
import itertools

# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
INF = sys.maxsize
# MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    d = na()
    c = collections.Counter(d)

    total = 0
    for v in c.values():
        total += v * (v - 1) // 2

    for i in range(n):
        v = c[d[i]]

        print(int(total - v + 1))


if __name__ == '__main__':
    main()
a = input()
print(a ** 3)



### FIXED CODE ###

a = int(input())
print(a ** 3)
X,N=map(int,input().split())
p=list(map(int,input().split()))
  
def abs_search(o,*l):
    if X  not in p:
        print(X)
        return
    
    for pl_num in range(X+1,102):
        if pl_num not in p:
            break
            
    for mi_num in range(X-1,-1,-1):
        if mi_num not in p:
            break
            
    abs_pl=abs(pl_num-X)
    abs_mi=abs(mi_num-X)
    
    if abs_pl<abs_mi:
        print(pl_num)
    else:
        print(mi_num)
        
abs_search(*p)

### FIXED CODE ###

import sys
X,N=map(int,input().split())
if N==0:
    print(X)
    sys.exit()
p=list(map(int,input().split()))

def abs_search(o,*l):
    if X  not in p:
        print(X)
        return
    
    for pl_num in range(X+1,102):
        if pl_num not in p:
            break
            
    for mi_num in range(X-1,-1,-1):
        if mi_num not in p:
            break
            
    abs_pl=abs(pl_num-X)
    abs_mi=abs(mi_num-X)
    
    if abs_pl<abs_mi:
        print(pl_num)
    else:
        print(mi_num)
        
abs_search(*p)
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
i=0
j=0
while k>=0:
    if i==n and j<m:
        k=k-b[j]
        j+=1
        ans+=1
    elif j==m and i<n:
        k=k-b[i]
        i+=1
        ans+=1
    elif i<n and j<m:
        if a[i]<b[j]:
            k=k-a[i]
            i+=1
            ans+=1
        else:
            k=k-b[j]
            j+=1
            ans+=1
    else:break
if k<0:
    print(ans-1)
else:
    print(ans)

### FIXED CODE ###

n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=[0];b=[0];ans=0;j=m
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])
for i in range(n+1):
    if a[i]>k:
        break
    while b[j]>k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
import sys
n, k =map(int,input().split())
d = int(input())

n_meajor = [0 for i in range(0,n)]

sunuke=[]
count=0

for i in sys.stdin:
    sunuke.append(int(input()))

for j in range(0,n):
    if j in sunuke:
        n_meajor[j]=1


sunuke_people = sum(n_meajor)

if sunuke_people<d:
    print(n-d)

else:
    print(n-sunuke_people)


### FIXED CODE ###

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

sunuke = []

for i in range(0,k):
    d = int(input())
    a = list(map(int,input().split()))
    sunuke +=a

print(n-len(set(sunuke)))
a,b,c=map(int,input().split())
k=int(input())
if 0<k<11 and 0<a<=50 and 0<b<=50 and 0<c<=50: 
    l=[a,b,c]
    l.reverse()
    l[0]=l[0]*(2**k)
else:
    print("No")
print(sum(l))

### FIXED CODE ###

a,b=map(int,input().split())
if a>12 or b>31 :
    print("none")
else:
    if a>b:
        print(a-1)
    else:
        print(a)
def main():
    N = int(input())
    dp = [[[[0 for _ in range(4)] for _ in range(4)]
           for _ in range(4)] for _ in range(101)]
    dp[0][3][3][3] = 1
    mod = 1_000_000_007
    for n in range(100):
        for i in range(4):
            for j in range(4):
                for k in range(4):
                    if dp[n][i][j][k] == 0:
                        continue
                    for a in range(4):
                        if (j == 0 and i == 1 and a == 2) or \
                            (j == 0 and i == 2 and a == 1) or \
                            (j == 1 and i == 0 and a == 2) or \
                            (k == 0 and j == 1 and a == 2) or \
                                (k == 0 and i == 1 and a == 2):
                            continue
                        dp[n + 1][a][i][j] += dp[n][i][j][k]
                        dp[n + 1][a][i][j] %= mod
    ans = 0
    for i in range(4):
        for j in range(4):
            for k in range(4):
                ans += dp[N][i][j][k]
                ans %= mod
    print(ans)


main()


### FIXED CODE ###

def main():
    N = int(input())
    dp = [[[[0 for _ in range(4)] for _ in range(4)]
           for _ in range(4)] for _ in range(101)]
    dp[0][3][3][3] = 1
    mod = 10 ** 9 + 7
    for n in range(100):
        for i in range(4):
            for j in range(4):
                for k in range(4):
                    if dp[n][i][j][k] == 0:
                        continue
                    for a in range(4):
                        if (j == 0 and i == 1 and a == 2) or \
                            (j == 0 and i == 2 and a == 1) or \
                            (j == 1 and i == 0 and a == 2) or \
                            (k == 0 and j == 1 and a == 2) or \
                                (k == 0 and i == 1 and a == 2):
                            continue
                        dp[n + 1][a][i][j] += dp[n][i][j][k]
                        dp[n + 1][a][i][j] %= mod
    ans = 0
    for i in range(4):
        for j in range(4):
            for k in range(4):
                ans += dp[N][i][j][k]
                ans %= mod
    print(ans)


main()
i = int(input().split())
if (i[0] <= i[2]) && (i[1] >= i[2]):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

i = input().split()
if int(i[0]) <= int(i[2]) <= int(i[1]):
 print("Yes")
else:
 print("No")
n,m = map(int,input().split())
print(n*m-2(n+m)+4)

### FIXED CODE ###

a,b = map(int,input().split())
print((a-1)*(b-1))
import sys;input=sys.stdin.readline

n,q=map(int, input().split())
event=[]
for _ in range(n):
    s,t,x=map(int,input().split())
    event.append((s-x-0.5,1,x))
    event.append((t-x-0.5,-1,x))
for i in range(q):
    event.append((int(input()),0,i))
    
event.sort(key=lambda x:x[0])
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*q
for t,e,x in event:
    if e > 0:
        stop.add(x)
        if x<minstop:
            minstop=x
            is_stop=True
    elif e<0:
        stop.remove(x)
        if minstop==x:
            is_stop=False
    elif len(stop)>0:
        if not is_stop:
             minstop=min(stop)
             is_stop=True
        ans[x]=minstop
print('\n'.join(map(str, ans)))

### FIXED CODE ###

import sys;input=sys.stdin.readline

n,q=map(int, input().split())
event=[]
for _ in range(n):
    s,t,x=map(int,input().split())
    event.append((s-x-0.5,1,x))
    event.append((t-x-0.5,-1,x))
for i in range(q):
    event.append((int(input()),0,i))
    
event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*q
for t,e,x in event:
    if e > 0:
        stop.add(x)
        if x<minstop:
            minstop=x
            is_stop=True
    elif e<0:
        stop.remove(x)
        if minstop==x:
            is_stop=False
    elif len(stop)>0:
        if not is_stop:
             minstop=min(stop)
             is_stop=True
        ans[x]=minstop
        
print('\n'.join(map(str, ans)))
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    B = B * A[i]
    if B > 10 ** 18:
        print(-1)
        break
if B <= 10 ** 18:
    print(B)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
 
 
ans = 1
if 0 in a:
    print(0)
    exit()
 
for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()
 
print(ans)