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

import fractions

def prime_divs(n):
    divs = {}
    for i in range(2, n+1):
        while n % i == 0:
            if i not in divs:
                divs[i] = 0
            divs[i] += 1
            n //= i
    return divs

  
A, B = map(int, input().split())
print(len(prime_divs(fractions.gcd(A, B))) + 1)

### FIXED CODE ###

import sys
from itertools import combinations
from fractions import gcd

def get_divs(n):
  divs = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divs.append(i)
      if i != n // i:
        divs.append(n//i)
  return divs

input = sys.stdin.readline
A,B= map(int,input().split())
mem = {}
com_divs = list(set(get_divs(A)).intersection(get_divs(B)))
if len(com_divs) == 1:
  print(1)
  exit()

ans = 1
for div in com_divs:
  if len(get_divs(div)) == 2: ans += 1
print(ans)
### BUGGY CODE ###

N,K=map(int,input().split())
a=list(map(int,input().split()))
pre=1
for i in range(K):
    pre*=a[i]
for i in range(K,N,1):
    now=pre*a[i]//a[i-K]
    if now>pre:
        print("Yes")
    else:
        print("No")
    pre=now


### FIXED CODE ###

N,K=map(int,input().split())
a=list(map(int,input().split()))
for i in range(K,N,1):
    if a[i]>a[i-K]:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

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

for number in A:
  result *= number

if (result > 10 ** 18):
  print(-1)
else:
  print(result)


### FIXED CODE ###

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

if 0 in A:
  print(0)
else:
  for number in A:
    result *= number
    if (result > 10 ** 18):
      print(-1)
      break
  else:
    print(result)
### BUGGY CODE ###

import math
def equal(x,y,z):
    return x**2 + y**2 + z**2 +x*y+y*z+z*x

N = int(input())

for i in range(1,N+1):
    cnt = 0
    for x in range(1,math.ceil(math.sqrt(i))+1):
        for y in range(1,math.ceil(math.sqrt(i))+1):
            for z in range(1,math.ceil(math.sqrt(i))+1):
                if equal(x,y,z) == i:
                    #print(x,y,z)
                    cnt+=1
                elif equal(x,y,z) > i:
                    continue
    print(cnt)


### FIXED CODE ###

import math
def equal(x,y,z):
    return x**2 + y**2 + z**2 +x*y+y*z+z*x

N = int(input())
ans = [0 for _ in range(10050)]
for x in range(1,105):
        for y in range(1,105):
            for z in range(1,105):
                v = equal(x,y,z)
                if v < 10050:
                    ans[v]+=1
for i in range(N):
    print(ans[i+1])
### BUGGY CODE ###

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

sub = [i for i in range(A,B+1) if A<= i<= A+K-1 or B-K+1 <= i <= B]
for i in sub:
    print(i)

### FIXED CODE ###

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

sub1 = [i for i in range(A,A+K)]
sub2 = [i for i in range(B-K+1,B+1)]
sub = set(sub1) | set(sub2)
sub = sorted(sub)
for i in sub:
    if A<= i <= B:
        print(i)
### BUGGY CODE ###

def f(n,m):
     a = list(map(int,input().split()))
     min_a = min(a)
     a = [[1,i] for i in a]
     for i in range(m):
          b_c = list(map(int,input().split()))
          if b_c[1]>min_a:
               a += [b_c]
     a.sort(reverse=True,key=lambda x:x[1])
     ans = 0
     while True:
          if n>a[0][0]:
               ans += a[0][0]*a[0][1]
               n -= a[0][0]
               a.pop(0)
          else:
               ans += a[0][1]*n
               break
     print(ans)

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

### FIXED CODE ###

def f(n,m):
     a = list(map(int,input().split()))
     min_a = min(a)
     a = [(1,i) for i in a]
     b_c = [tuple(map(int,input().split())) for i in range(m)]
     a += b_c
     a.sort(key=lambda x:x[1])
     ans = 0
     while True:
          if n>a[-1][0]:
               ans += a[-1][0]*a[-1][1]
               n -= a[-1][0]
               a.pop()
          else:
               ans += a[-1][1]*n
               break
     print(ans)

n,m = map(int,input().split())
f(n,m)
### BUGGY CODE ###

l,r = map(int,input().split())
number_list=[i for i in range(l,r+1)]
c=2019
for i in number_list:
  if i%2019==0:
    print(0)
    break
else:
  for j in number_list:
    for k in number_list[(number_list.index(j)+1):]:
      if c>(j*k%2019):
        c=(j*k%2019)
  print(c)

### FIXED CODE ###

l,r = map(int,input().split())
c=2019
for i in range(l,r+1):
  if i%2019==0:
    print(0)
    break
else:
  for j in range(l,r+1):
    for k in range(j+1,r+1):
      if c>(j*k%2019):
        c=(j*k%2019)
  print(c)
### BUGGY CODE ###

S = input()
Q = int(input())
T = [input() for i in range(Q)]

count = True

for i in range(Q):
  t = T[i]
  if(int(t[0]) == 1):
    count = not count
  else:
    if(int(t[2]) == 1):
      if(count):
        list = [t[4], S]
        S = "".join(list)
      else:
        list = [S, t[4]]
        S = "".join(list)
    else:
      if(count):
        list = [S, t[4]]
        S = "".join(list)
      else:
        list = [t[4], S]
        S = "".join(list)

if(count):
  print(S)
else:
  print(S[::-1])


### FIXED CODE ###

from collections import deque
S = input()
Q = int(input())
T = [input() for i in range(Q)]

d =deque(S)

count = True

for i in range(Q):
  t = T[i]
  if(int(t[0]) == 1):
    count = not count
  else:
    if(int(t[2]) == 1):
      if(count):
        d.appendleft(t[4])
      else:
        d.append(t[4])
    else:
      if(count):
        d.append(t[4])
      else:
        d.appendleft(t[4])

ans = list(d)

if(count):
  print("".join(ans))
else:
  print("".join(ans[::-1]))
### BUGGY CODE ###

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

d = {}
for ai in a:
    if ai in d.keys():
        d[ai] += 1
    else:
        d[ai] = 1

ans = 0
for k, v in d.items():
    if k > v:
        ans += v
    else:
        ans += v - k

print(ans)

### FIXED CODE ###

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

x = a[0]
cnt = 0
ans = 0
for i in range(n):
    if x == a[i]:
       cnt += 1
    else:
        if cnt < x:
            ans += cnt
        else:
            ans += cnt - x
        x = a[i]
        cnt = 1

if cnt < x:
    ans += cnt
else:
    ans += cnt - x

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

n,m,q=map(int,input().split())
LR = [list(map(int,input().split())) for i in range(m)]
PQ = [list(map(int,input().split())) for i in range(q)]
#print(LR,PQ)

d = [[0]*n for i in range(n)]

for i in range(m):
    l = LR[i][0]-1
    r = LR[i][1]-1
    d[l][r] += 1
#print(d)

for i in range(q):
    l = PQ[i][0]-1
    r = PQ[i][1]-1
    cnt = 0
    for j in range(l,r+1):
        for k in range(l,r+1):
            cnt += d[j][k]
    print(cnt)

### FIXED CODE ###

n,m,q=map(int,input().split())
LR = [list(map(int,input().split())) for i in range(m)]
PQ = [list(map(int,input().split())) for i in range(q)]
#print(LR,PQ)

d = [[0]*n for i in range(n)]

for i in range(m):
    l = LR[i][0]-1
    r = LR[i][1]-1
    d[l][r] += 1
#print(d)

c = [[0]*n for i in range(n)]
for i in range(n):
    for j in range(n):
        if j == 0:
            c[i][j] = d[i][j]
        else:
            c[i][j] = c[i][j-1] + d[i][j]
#print(c)
for i in range(q):
    l = PQ[i][0]-1
    r = PQ[i][1]-1
    res = 0
    for j in range(l,r+1):
        if j == 0 or l == 0:
            res += c[j][r]
        else:
            res += (c[j][r]-c[j][l-1])
    print(res)
### BUGGY CODE ###

N = int(input())
S = input()
res = 0
twices = list()
for i in range(N-1):
    for j in range(i + 1, N):
        t = ''
        si, sj = i, j
        length = 0
        while sj < N and S[si] == S[sj] and i+length<=j:
            t = t + S[si]
            si += 1
            sj += 1
            length += 1
        if i + length <= j:
            res = max(res, length)
print(res)

### FIXED CODE ###

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

res = 0
for k in range(1, N):
    cnt = 0
    for i in range(N - k):
        if i + k < N and S[i + k] == S[i]:
            cnt += 1
        else:
            cnt = 0
        cnt = min(k, cnt)
        res = max(cnt, res)

print(res)
### BUGGY CODE ###

from collections import defaultdict
d = defaultdict(int)


def main():
    n = int(input())
    polls = [input() for i in range(n)]

    for i in polls:
        d[i] += 1

    max_k_list = sorted([kv[0] for kv in d.items() if kv[1] == max(d.values())])
    # max_k_list.sort()

    for ans in max_k_list:
        print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import collections

n = int(input())
polls = [input() for i in range(n)]

c = collections.Counter(polls)
maxval = c.most_common()[0][1]

values, counts = zip(*c.most_common())

ans = []

for i in c.most_common():
    if i[1] == maxval:
        ans.append(i[0])
    else:
        break

ans.sort()

for i in ans:
    print(i)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
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()

stop = set()

ans = {}
for t, e, x in event:
    if e > 0:
        stop.add(x)
    elif e < 0:
        stop.remove(x)
    else:
        if len(stop) != 0:
            ans[x] = min(stop)
        else:
            ans[x] = -1

for i in range(q):
    print(ans[i])


### 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)))
### BUGGY CODE ###

from collections import deque

h, w = map(int, input().split())
maze = [input() for _ in range(h)]

max_move = 0
for start_i in range(h):
  for start_j in range(w):
    if maze[start_i][start_j] == '.':
      queue = deque([(0, start_i, start_j)])
      yet = [[True] * w for _ in range(h)]
      while queue:
        move, i, j = queue.popleft()
        yet[i][j] = False
        if i != 0 and maze[i-1][j] == '.' and yet[i-1][j]:
          queue.append((move + 1, i - 1, j))
        if i != h - 1 and maze[i+1][j] == '.' and yet[i+1][j]:
          queue.append((move + 1, i + 1, j))
        if j != 0 and maze[i][j-1] == '.' and yet[i][j-1]:
          queue.append((move + 1, i, j - 1))
        if j != w - 1 and maze[i][j+1] == '.' and yet[i][j+1]:
          queue.append((move + 1, i, j + 1))
      if move > max_move:
        max_move = move

print(max_move)

### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
maze = [input() for _ in range(h)]

max_move = 0
for start_i in range(h):
  for start_j in range(w):
    if maze[start_i][start_j] == '.':
      queue = deque([(0, start_i, start_j)])
      yet = [[True] * w for _ in range(h)]
      yet[start_i][start_j] = False
      while queue:
        move, i, j = queue.popleft()
        if i != 0 and maze[i-1][j] == '.' and yet[i-1][j]:
          queue.append((move + 1, i - 1, j))
          yet[i-1][j] = False
        if i != h - 1 and maze[i+1][j] == '.' and yet[i+1][j]:
          queue.append((move + 1, i + 1, j))
          yet[i+1][j] = False
        if j != 0 and maze[i][j-1] == '.' and yet[i][j-1]:
          queue.append((move + 1, i, j - 1))
          yet[i][j-1] = False
        if j != w - 1 and maze[i][j+1] == '.' and yet[i][j+1]:
          queue.append((move + 1, i, j + 1))
          yet[i][j+1] = False
      if move > max_move:
        max_move = move

print(max_move)
### BUGGY CODE ###

import sys, math, itertools, bisect, copy, re
from collections import Counter, deque, defaultdict

# from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
# from functools import reduce
# from math import ceil, floor, log10, log2, factorial
# from pprint import pprint

INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** -7
sys.setrecursionlimit(1000000)

# N = int(input())
# N,M = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
# DP = [[0] * 100 for _ in range(100)]
# DP = defaultdict(lambda: float('inf'))

S = input()
N = len(S)
sum = 0
dp = [0] * 13
dp[0] = 1

for i, s in enumerate(S):
    n = N - i - 1
    if s == '?':
        # print("{}".format(10 ** n))
        a = [0] * 13
        for j in range(10):
            m = j * (10 ** n) % 13
            a[m] += 1

        newDP = [0] * 13
        for j1 in range(13):
            for j2 in range(13):
                newDP[(j1 + j2) % 13] += ((dp[j1] * a[j2]) % MOD)
        dp = [x % MOD for x in newDP]

    else:
        sum += (int(s) * (10 ** n))
        sum = sum % 13

print(dp[(-sum + 5 + 13) % 13])


### FIXED CODE ###

import sys, math, itertools, bisect, copy, re
from collections import Counter, deque, defaultdict

# from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
# from functools import reduce
# from math import ceil, floor, log10, log2, factorial
# from pprint import pprint

INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** -7
sys.setrecursionlimit(1000000)

# N = int(input())
# N,M = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
# DP = [[0] * 100 for _ in range(100)]
# DP = defaultdict(lambda: float('inf'))

S = input()
M = 13
DP = [0] * M
DP[0] = 1

mul = 1
for i in range(len(S) - 1, -1, -1):
    s = S[i]
    newDP = [0] * M
    if s == '?':
        for k in range(10):
            for j in range(M):
                newDP[(mul * k + j) % M] += DP[j]
    else:
        k = int(s)
        for j in range(M):
            newDP[(mul * k + j) % M] += DP[j]
    DP = [x % MOD for x in newDP]
    mul *= 10
    mul %= M

print(DP[5])
### BUGGY CODE ###

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

cums = [0]
for a in A:
    cums.append(cums[-1] + a)

ans = 0
for d in range(1,min(K,N+1)):
    for i in range(N+1-d):
        v = (cums[i+d] - cums[i]) % K
        if v==d:
            ans += 1
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
B = [a%K for a in A]
cs = [0]
for b in B:
    c = (cs[-1] + b-1) % K
    cs.append(c)

from collections import deque
from collections import defaultdict
qs = defaultdict(lambda: deque())

ans = 0
for i,c in enumerate(cs):
    while qs[c] and qs[c][0] + K <= i:
        qs[c].popleft()
    ans += len(qs[c])
    qs[c].append(i)
print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
array = []
for _ in range(M):
    tmp = list(map(int, input().split()))
    array.append(tmp)
    
array.sort(key=lambda x: x[1], reverse=True)

for i in range(M):
    A.sort()
    if A[0] < array[i][1]:
        j = 0
        while j < array[i][0]:
            if A[j] < array[i][1]:
                A[j] = array[i][1]
                j += 1
            else:
                break
    else:
        break
    
print(sum(A))

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
array = []
for _ in range(M):
    tmp = list(map(int, input().split()))
    array.append(tmp)
array.sort(key=lambda x: x[1], reverse=True)

_sum = 0
_num = 0

for i in range(N+M):
    if A[0] > array[0][1]:
        _sum += A.pop(0)
        _num += 1
        
    else:
        a = array[0][0] if array[0][0] < N - _num else N - _num
        _sum += array.pop(0)[1] * a
        _num += a
        if not array:
            break
        
    if _num == N:
        break
    
if _num != N:
    while _num < N:
        _sum += A.pop(0)
        _num += 1
        
print(_sum)
### BUGGY CODE ###

def kaiten(parts):
    parts = reversed(parts)
    parts = ''.join(parts)
    parts = parts.replace('L', 'Z')
    parts = parts.replace('R', 'L')
    parts = parts.replace('Z', 'R')
    return list(parts)

def occurrences(string, sub):
    count = start = 0
    while True:
        start = string.find(sub, start) + 1
        if start > 0:
            count += 1
        else:
            return count

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

for _ in range(k):
    l = s.find('LR')
    r = s.find('RL', l)
    l2 = s.find('RL')
    r2 = s.find('LR', l2)
    if l == r == l2 == r2 == -1:
        break
    _s = list(s)
    if 0 <= l and l < r:
        p = _s[l+1:r+1]
        _s[l+1:r+1] = kaiten(p)
    elif 0 <= l2 and l2 < r2:
        p = _s[l2+1:r2+1]
        _s[l2+1:r2+1] = kaiten(p)
    elif 0 <= l:
        p = _s[l+1:]
        _s[l+1:] = kaiten(p)
    elif 0 <= r:
        p = _s[:r+1]
        _s[:r+1] = kaiten(p)
    elif 0 <= l2:
        p = _s[l2+1:]
        _s[l2+1:] = kaiten(p)
    elif 0 <= r2:
        p = _s[:r2+1]
        _s[:r2+1] = kaiten(p)
    s = ''.join(_s)

score = occurrences(s, 'LL') + occurrences(s, 'RR')
print(score)


### FIXED CODE ###

n, k = map(int, input().split())
s = input()
h = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        h += 1
print(min(h + 2 * k, n - 1))
### BUGGY CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = input()
    K = int(input())
    result = set()

    for i in range(len(S) + 1):
        for j in range(i + 1, len(S) + 1):
            result.add(S[i:j])

    print(sorted(result)[K - 1])


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = input()
    K = int(input())
    result = set()

    for i in range(5):
        for j in range(len(S)):
            result.add(S[j:j + i + 1])

    print(sorted(result)[K - 1])


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

import sys
sys.setrecursionlimit(10000)
N,m,k = [int(x) for x in input().split()]
p = []
q = []
roots = [0]*(N+1)
rootmatome = [0]*(N+1)
tonari = [0]*(N+1)
dame = [0]*(N+1)
for i in range(m):
    p.append(list(map(int, input().split())))
for i in range(k):
    q.append(list(map(int, input().split())))
par = []
for i in range(N+1):
    par.append(i)
def root(x):
    if par[x] == x:
        return x
    return root(par[x])
def unite(x,y):
    rx = root(x)
    ry = root(y)
    if rx == ry:
        return
    par[rx] = ry
def same(x,y):
    rx = root(x)
    ry = root(y)
    return rx == ry
for i in range(m):
    unite(p[i][0],p[i][1])
for i in range(1,N+1):
  roots[i] = root(i)
for i in range(1,N+1):
    rootmatome[roots[i]] += 1
for i in range(m):
    tonari[p[i][0]] += 1
    tonari[p[i][1]] += 1
for i in range(k):
    if roots[q[i][0]] == roots[q[i][1]]:
        dame[q[i][0]] += 1
        dame[q[i][1]] += 1
for i in range(1,N+1):
    print(rootmatome[roots[i]] - tonari[i] - dame[i] - 1,end=" ")          

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
N,m,k = [int(x) for x in input().split()]
p = []
q = []
roots = [0]*(N+1)
rootmatome = [0]*(N+1)
tonari = [0]*(N+1)
dame = [0]*(N+1)
for i in range(m):
    p.append(list(map(int, input().split())))
for i in range(k):
    q.append(list(map(int, input().split())))
par = []
for i in range(N+1):
    par.append(i)
def root(x):
    if par[x] == x:
        return x
    par[x] = root(par[x])#この一文で早くなる
    return root(par[x])
def unite(x,y):
    rx = root(x)
    ry = root(y)
    if rx == ry:
        return
    par[rx] = ry
for i in range(m):
    unite(p[i][0],p[i][1])
for i in range(1,N+1):
  roots[i] = root(i)
for i in range(1,N+1):
    rootmatome[roots[i]] += 1
for i in range(m):
    tonari[p[i][0]] += 1
    tonari[p[i][1]] += 1
for i in range(k):
    if roots[q[i][0]] == roots[q[i][1]]:
        dame[q[i][0]] += 1
        dame[q[i][1]] += 1
for i in range(1,N+1):
    print(rootmatome[roots[i]] - tonari[i] - dame[i] - 1,end=" ")
### BUGGY CODE ###

import sys

n, k = map(int, sys.stdin.readline().split())

dp = [0 for i in range(k+1)]


for i in range(n):
    w, v = map(int, sys.stdin.readline().split())
    
    temp = dp.copy()
    for j in range(k+1):
        if j+w <= k:
            dp[j+w] = max(temp[j+w], temp[j]+v)
            
print(max(dp))

### FIXED CODE ###

import sys
import numpy as np

n, k = map(int, sys.stdin.readline().split())

dp = np.zeros((n+1, k+1))

for i in range(1,n+1):
    w, v = map(int, sys.stdin.readline().split())
    dp[i] = dp[i-1]
    dp[i][w:] = np.maximum(dp[i-1][:-w]+v, dp[i-1][w:])

print(int(np.max(dp[n])))
### BUGGY CODE ###

# minimum power to give i damage to the enemy
import math

h,n=map(int,input().split())
ablist=[]
amax=0
for i in range(n):
    a,b=map(int,input().split())
    ablist.append([a,b])
    amax=max(a,amax)

powlist=[]
for i in range(h+amax):
    powlist.append(math.ceil((i+1)/ablist[0][0])*ablist[0][1])

for i in range(1,n):
    for j in range(h+amax):
        if j+1 <= ablist[i][0]:
            powlist[j]=min(powlist[j],ablist[i][1])
        else:
            powlist[j]=min(powlist[j],powlist[j-ablist[i][0]]+ablist[i][1])
            

print(min(powlist[h-1:]))





### FIXED CODE ###

# minimum power to give i damage to the enemy
import math

h,n=map(int,input().split())
ablist=[]
amax=0
for i in range(n):
    a,b=map(int,input().split())
    ablist.append([a,b])
    amax=max(a,amax)

powlist=[]
for i in range(h+amax):
    powlist.append(math.ceil((i+1)/ablist[0][0])*ablist[0][1])

for i in range(1,n):
    for j in range(h+amax):
        if j+1 <= ablist[i][0]:
            powlist[j]=min(powlist[j],ablist[i][1])
        else:
            powlist[j]=min(powlist[j],powlist[j-ablist[i][0]]+ablist[i][1])
            

print(min(powlist[h-1:]))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
from collections import Counter
 
(N, X, Y) = (int(i) for i in input().split())
 
# まずは経路情報をd[N][N]の二次元配列に格納
# (i, j)がつながっていれば1, つながってなければ2*10^3
 
d = []
for i in range(N):
    d.append([2 * 10**3]*N)
 
for i in range(N - 1):
    d[i][i] = 0
    d[i][i+1] = 1
    d[i+1][i] = 1
 
d[X-1][Y-1] = 1
d[Y-1][X-1] = 1
#print(d)
 
# ワーシャル・フロイドで全点の最短経路を計算
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])
 
#print(d)

# dの全リストを連結してあとは0~N-1までカウントする
d_list = []
for i in range(N - 1):
    d_list += d[i][i+1:]

#print(d_list)
c = Counter(d_list)

for i in range(1, N):
    if i in c:
        print(c[i])
    else:
        print(0)

### FIXED CODE ###

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

def update_distance(d, num, N):
    minn = num
    maxx = num
    # 要素数の小さい方に向けて
    while True:
        if minn > 0:
            minn -= 1
        else:
            break
        if d[minn] > d[minn+1] + 1:
            d[minn] = d[minn+1] + 1
        else:
            break
    # 要素数の大きいほうに向けて
    while True:
        if maxx < (N - 1):
            maxx += 1
        else:
            break
        if d[maxx] > d[maxx-1] + 1:
            d[maxx] = d[maxx-1] + 1
        else:
            break

(N, X, Y) = (int(i) for i in input().split())
X = X-1
Y = Y-1

# まずは経路情報をd[N][N]の二次元配列に格納
# (i, j)がつながっていれば1, つながってなければ2*10^3

d = []
for i in range(N):
    dd = []
    for j in range(N):
        dd.append(abs(i - j))
    d.append(dd)

# XとYがつながることで最短経路を修正していく
for i in range(N):
    dd = d[i]
    dd[X] = min(dd[X], dd[Y] + 1)
    dd[Y] = min(dd[Y], dd[X] + 1)
    update_distance(dd, X, N)
    update_distance(dd, Y, N)

# dの全リストを連結してあとは0~N-1までカウントする
d_list = []
for i in range(N - 1):
    d_list += d[i][i+1:]

#print(d_list)
c = Counter(d_list)

for i in range(1, N):
    if i in c:
        print(c[i])
    else:
        print(0)
### BUGGY CODE ###

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

ans = 1
for i in range(N):
    ans *= A[i]
    if ans > 10**18 and 0 not in A:
        print(-1)
        break

if ans <= 10**18:
    print(ans)

### FIXED CODE ###

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

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

ans = 1
for i in range(N):
    ans *= A[i]
    if ans > 10**18:
        print(-1)
        break

if ans <= 10**18:
    print(ans)