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

a = input()
count = [0 for _ in range(len(a))]
for i in range(len(a)):
    temp = i
    idex = i
    c = 0
    while(1):
        if a[idex]=='R' and a[idex+1]=='L':
            if c%2==0:
                count[idex]+=1
            else:
                count[idex+1] += 1
            break
        elif a[idex]=='L' and a[idex-1]=='R':
            if c%2==0:
                count[idex]+=1
            else:
                count[idex-1] += 1
            break
        else:
            idex =idex+1 if a[idex]=='R' else idex-1
        c+=1

print(* count)

### FIXED CODE ###

a = input()
count = [0 for _ in range(len(a))]
walk_Right = [0 for _ in range(len(a))]
walk_Left = [0 for _ in range(len(a))]
c = 0
for i in range(len(a)-1,-1,-1):
    if a[i] == 'R':
        c += 1
        walk_Right[i]=c
    else:
        c = 0
        walk_Right[i]=c

c=0
for i in range(len(a)):
    if a[i] == 'L':
        c += 1
        walk_Left[i]=c
    else:
        c = 0
        walk_Left[i]=c

for i in range(len(a)):
    if a[i] == 'R':
        if walk_Right[i] % 2 == 0:
            count[i+ walk_Right[i]] += 1
        else:
            count[i + walk_Right[i] - 1] += 1
    else:
        if walk_Left[i] % 2 == 0:
            count[i - walk_Left[i]] += 1
        else:
            count[i- walk_Left[i] + 1] += 1
print(* count)
### BUGGY CODE ###

def serch(cur):
    if A[cur] == A[0]:
        return 

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

serch(A[1])

i2p = {
    0: 1
}
cur = A[0]

i = 1
remove_list = []
while True:
    i2p[i] = cur
    remove_list.append(cur)
    if A[cur-1] in i2p.values():
        break
    cur = A[cur-1]
    i+=1

for i in i2p.keys():
    if A[cur-1] == i2p[i]:
        break


num_loop = len(i2p) - i 

if K < i:
    print(i2p[K])
else:
    print(i2p[i+(K-i)%num_loop])

### FIXED CODE ###

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

i2p = {0:1}
p2i = {1:0}
cur = A[0]
is_loop = {}
for i in range(N+1):
    is_loop[i] = False
i = 1
while True:
    i2p[i] = cur
    p2i[cur] = i
    is_loop[cur] = True
    if is_loop[A[cur-1]]:
        break
    cur = A[cur-1]
    i+=1
i = p2i[A[cur-1]]
num_loop = len(i2p) - i 
if K < i:
    print(i2p[K])
else:
    print(i2p[i+(K-i)%num_loop])
### BUGGY CODE ###

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

memo = [0] * (N+1)
memo[0] = 1
cnt = 1
while cnt <= N:
  if cnt in broken:
    memo[cnt] = 0
  elif cnt == 1:
    memo[cnt] = 1
  else:
    memo[cnt] = (memo[cnt-1] + memo[cnt-2])%MOD
  cnt += 1
  
print(memo[N])

### FIXED CODE ###

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

memo = [1]
cnt = 1
while cnt <= N:
  if len(broken) > 0 and cnt == broken[0]:
    del broken[0]
    memo.append(0)
  elif cnt == 1:
    memo.append(1)
  else:
    memo.append((memo[-1] + memo[-2])%MOD)
  cnt += 1
  
print(memo[-1])
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
B=0
for i in range(N):
    L = [A[j] for j in range(i+1)]
    L.sort()
    B += L[i]-A[i]
print(B)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=0
Mi=A[0]

for i in range(1,N):
    if A[i] > Mi:
        Mi = A[i]
    B += Mi - A[i]
print(B)
### BUGGY CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(n):
  g=[]
  for j in range(1,k+1):
    if 0<=i-j<=n-1:
       g.append(dp[i-j]+abs(h[i]-h[i-j]))
  if g!=[]:
    dp[i]=min(g)
  else:
    dp[i]=0
print(dp[n-1])

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(n):
  g=[]
  for j in range(1,k+1):
    if 0<=i-j<=n-1:
       g.append(dp[i-j]+abs(h[i]-h[i-j]))
  if g!=[]:
    dp[i]=min(g)
  else:
    dp[i]=0
print(dp[n-1])
### BUGGY CODE ###

def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
S = input()

ans = 0

# for i in range(0, N-2):
#     for k in range(i+2, N):
#         if S[i]==S[k]:
#             continue
#         for j in range(i+1, k):
#             # print(S[i], S[j], S[k])
#             if j-i!=k-j and S[i]!=S[j] and S[j]!=S[k]:
#                 ans += 1


for i in range(0, N-3):
    for j in range(i+1, N-1):
        if S[i] == S[j]:
            continue
        for c in "RGB":
            if S[i] != c and S[j] != c:
                last_color = c
        ans += S[j+1:].count(last_color)
        if j+j-i <= N-1 and S[j+j-i] == last_color:
            ans -= 1

print(ans)

### FIXED CODE ###

def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
S = input()

ans = 0

count_S = {
    "R": [0] * N,
    "G": [0] * N,
    "B": [0] * N,
}

count_S[S[-1]][-1] = 1
for i in reversed(range(N-1)):
    count_S["R"][i] = count_S["R"][i+1]
    count_S["B"][i] = count_S["B"][i+1]
    count_S["G"][i] = count_S["G"][i+1]
    count_S[S[i]][i] += 1


# for i in range(0, N-2):
#     for k in range(i+2, N):
#         if S[i]==S[k]:
#             continue
#         for j in range(i+1, k):
#             # print(S[i], S[j], S[k])
#             if j-i!=k-j and S[i]!=S[j] and S[j]!=S[k]:
#                 ans += 1


for i in range(0, N-3):
    for j in range(i+1, N-1):
        if S[i] == S[j]:
            continue
        for c in "RGB":
            if S[i] != c and S[j] != c:
                last_color = c
        ans += count_S[last_color][j+1]
        if j+j-i <= N-1 and S[j+j-i] == last_color:
            ans -= 1

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

A,B,K = map(int, input().split())
[print(i) for i in range(A,B+1) if i - K < A or i + K > B]

### FIXED CODE ###

A,B,K = map(int, input().split())
if B-A > 2 * K:
  [print(i) for i in range(A,A+K)]
  [print(i) for i in range(B+1-K,B+1)]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]
### BUGGY CODE ###

# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#n,m = [int(i) for i in readline().split()]
#d = [int(i) for i in readline().split()]
MOD = 10**9+7

n = int(input())
a = [int(i) for i in readline().split()]

from fractions import gcd
m = a[0]
for i in a:
    m = i//gcd(m,i)*m

ans = 0
for i in a:
    ans += (m//i)%MOD

print(ans%MOD)




### FIXED CODE ###

def Eratosthenes(N): #N以下の素数のリストを返す
    #iが素数のときis_prime_list[i]=1，それ以外は0
    N+=1
    is_prime_list = [True]*N
#    is_prime_list[0], is_prime_list[1] = False, False #リストが必要なときはこの2行を有効化
#    for j in range(4,N,2): is_prime_list[j] = False
    m = int(N**0.5)+1
    for i in range(3,m,2):
        if is_prime_list[i]:
            is_prime_list[i*i::2*i]=[False]*((N-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,N,2) if is_prime_list[i]]
#    return is_prime_list


# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#n,m = [int(i) for i in readline().split()]
#d = [int(i) for i in readline().split()]
MOD = 10**9+7

n = int(input())
a = [int(i) for i in readline().split()]

#m = 1000000
#a = list(range(m,m+2000))

from fractions import gcd
m = a[0]
for i in a:
    m = m//gcd(m,i)*i

ans = 0
M = m%MOD
for i in a:
    ans += M*pow(i,MOD-2,MOD)%MOD

print(ans%MOD)
### BUGGY CODE ###

N=int(input())
A=[]
count=0
for i in range(N):
    S=''.join(sorted(input()))
    A.append(S)

for i in range(N):
    for j in range(i,N):
        if A[i]==A[j] and i!=j:
            count+=1
print(count)

### FIXED CODE ###

N=int(input())
A=[]
D={}
count=0
for i in range(N):
    S=''.join(sorted(input()))
    A.append(S)

for s in A:
    if s in D:
        count+=D[s]
        D[s]+=1
    else:
        D[s]=1
print(count)
### BUGGY CODE ###

#import pysnooper
import os,re,sys,operator,math,heapq,string
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy

setrecursionlimit(10**6)
def rec(pp,xx):
    for i in range(n):
        if gragh[pp][i]:
            cnt[i]+=xx
            rec(i,xx)
    return
n,q=map(int,stdin.readline().rstrip().split())
gragh=[[0]*n for _ in range(n)]
cnt=[0]*n
for i in range(n-1):
    a,b=map(int,stdin.readline().rstrip().split())
    gragh[a-1][b-1]=1

for i in range(q):
    p,x=map(int,stdin.readline().rstrip().split())
    cnt[p-1]+=x
    rec(p-1,x)
print(*cnt)

### FIXED CODE ###

#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)

def rec(pp,xx=-1):
    for i in gragh[pp]:
        if i==xx:
            continue
        ans[i]+=ans[pp]
        rec(i,pp)

n,q=map(int,stdin.readline().rstrip().split())
ans=[0]*n
gragh=[[]*n for _ in range(n)]
for _ in range(n-1):
    a,b=map(int,stdin.readline().rstrip().split())
    a-=1
    b-=1

    gragh[a].append(b)
    gragh[b].append(a)
for _ in range(q):
    p,x=map(int,stdin.readline().rstrip().split())
    ans[p-1]+=x
rec(0)
print(*ans)
### BUGGY CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

from functools import lru_cache

N,M = II()
A = III()
num = [0]*10
num[1],num[2],num[3],num[4],num[5] = 2,5,5,4,5
num[6],num[7],num[8],num[9] = 6,3,7,6

x = [-1]*(N+1)
for n in range(1,N+1):
    val = []
    for i in range(M):
        if n-num[A[i]] < 0:
            continue
        elif n-num[A[i]] == 0:
            val.append(A[i])
        else:
            if x[n-num[A[i]]]>0:
                val.append(int(str(A[i]) + str(x[n-num[A[i]]])))
    if val:
        x[n] = max(val)
    else:
        x[n] = -1    

print(x[N])

### FIXED CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

from functools import lru_cache

N,M = II()
A = III()
num = [0]*10
num[1],num[2],num[3],num[4],num[5] = 2,5,5,4,5
num[6],num[7],num[8],num[9] = 6,3,7,6

@lru_cache(maxsize=10**5)
def rec(n):
    val = []
    for i in range(M):
        if n-num[A[i]] < 0:
            continue
        elif n-num[A[i]] == 0:
            val.append(A[i])
        else:
            if rec(n-num[A[i]])>0:
                val.append(10*rec(n-num[A[i]])+A[i])
    if val:
        return max(val)
    else:
        return -1

print(rec(N))
### BUGGY CODE ###

n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
idx=1
li=[]
idx_li=[1]
flag=False
for i in range(k):
    idx=a[idx-1]
    if idx in idx_li:
        flag=True
        break
    idx_li.append(idx)
if flag:
    non_loop=idx_li[:idx_li.index(idx)]
    loop = idx_li[idx_li.index(idx):]
    size=len(loop)
    print(loop[(k-len(non_loop))%size])
else:
    print(idx)

### FIXED CODE ###

n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
idx=1
idx_li=[]
ord_=[-1]*n
flag=False
for i in range(k):
    idx_li.append(idx)
    ord_[idx-1]=1
    idx=a[idx-1]
    if ord_[idx-1]==1:
        flag=True
        break
if flag:
    #non_loop=idx_li[:idx_li.index(idx)]
    loop = idx_li[idx_li.index(idx):]
    
    size=len(loop)
    print(loop[(k-(len(idx_li)-len(loop)))%size])
else:
    print(idx)
### BUGGY CODE ###

n,k,q=map(int,input().split())
a=[]
for i in range(q):
  a.append(int(input()))
for j in range(n):
  if k-q+(a.count(j+1))>0:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

import sys
n,k,q=map(int,input().split())
if k-q>0:
  for i in range(n):
    print('Yes')
  sys.exit()
a=[0]*n
for i in range(q):
  b=int(input())
  a[b-1]+=1
for j in range(n):
  if k-q+a[j]>0:
    print('Yes')
  else:
    print('No')
### BUGGY CODE ###

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


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

count = 0
for i in range(n):
    if i == 0:
        count += 1
    else:
        if min(p[:i]) >= p[i]:
            count += 1
        else:
            pass

print(count)

### FIXED CODE ###

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

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

count = 1
min_dp = p[0]
for i in range(1, n):
    if p[i] < min_dp:
        count += 1
        min_dp = p[i]

print(count)
### BUGGY CODE ###

n = int(input())
a = [-int(i) for i in input().split()]


class SparseTable:
    def __init__(self, a, func=max, one=-10**18):
        self.table = [a[:]]
        self.n = len(a)
        self.logn = self.n.bit_length()
        self.func = func
        self.one = one

        for i in map(lambda x: 1 << x, range(self.logn - 1)):
            self.table.append([])
            for j in range(self.n - i * 2 + 1):
                self.table[-1].append(self.func(self.table[-2][j],
                                                self.table[-2][j + i]))

    def get_section(self, i, j):
        length = j - i
        log = length.bit_length() - 1
        if length <= 0:
            return self.one
        return self.func(self.table[log][i], self.table[log][j - (1 << log)])


sp = SparseTable(a)
ans = 0
for i in range(n):
    mi = 0
    ma = i
    while mi != ma:
        mm = (mi + ma) // 2
        if sp.get_section(mm, i) <= a[i]:
            ma = mm
        else:
            mi = mm + 1
    j = i - mi + 1

    mi = i - 1
    ma = n - 1
    while mi != ma:
        mm = (mi + ma) // 2 + 1
        if sp.get_section(i, mm + 1) <= a[i]:
            mi = mm
        else:
            ma = mm - 1
    k = mi - i + 1
    ans += j * k * a[i]
print(-ans)


### FIXED CODE ###

n = int(input())
a = [-int(i) for i in input().split()]


class SparseTable:
    def __init__(self, a, func=max, one=-10**18):
        self.table = [a[:]]
        self.n = len(a)
        self.logn = self.n.bit_length()
        self.func = func
        self.one = one

        for i in map(lambda x: 1 << x, range(self.logn - 1)):
            self.table.append([])
            for j in range(self.n - i * 2 + 1):
                self.table[-1].append(self.func(self.table[-2][j],
                                                self.table[-2][j + i]))

    def get_section(self, i, j):
        length = j - i
        log = length.bit_length() - 1
        if length <= 0:
            return self.one
        return self.func(self.table[log][i], self.table[log][j - (1 << log)])


sp = SparseTable(a)
ans = 0
for i in range(n):
    mi = 0
    ma = i
    while mi != ma:
        mm = (mi + ma) // 2
        if sp.get_section(mm, i) <= a[i]:
            ma = mm
        else:
            mi = mm + 1
    j = i - mi + 1

    mi = i - 1
    ma = n - 1
    while mi != ma:
        mm = (mi + ma) // 2 + 1
        if sp.get_section(i, mm + 1) <= a[i]:
            mi = mm
        else:
            ma = mm - 1
    k = mi - i + 1
    ans += j * k * a[i]
print(-ans)
### BUGGY CODE ###

S = input()
S = list(S.replace("BC", "X"))
N = len(S)
pos = 1
ans = 0

c = True
while c:
    c = False
    pos = 1
    while pos<N:
        if S[pos-1]=="A" and S[pos]=="X":
            S[pos-1], S[pos] = S[pos], S[pos-1]
            c = True
            ans += 1
        pos += 1
print(ans)

### FIXED CODE ###

S = list(input().replace("BC", "X"))
N = len(S)
pos, ans = 0, 0
ca = 0

while pos<N:
    ca = 0
    if S[pos]=="A" or S[pos]=="X":
        while pos<N and (S[pos]=="A" or S[pos]=="X"):
            if S[pos]=="A":
                ca += 1
            else:
                ans += ca
            pos += 1
    else:
        pos += 1

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

s=input()
k=int(input())

l=len(s)

se = set( s[i:j+1] for i in range(l) for j in range(i,l) )
print( sorted(se )[k-1] )

### FIXED CODE ###

s=input()
k=int(input())
l=len(s)
def find_substring_from_a(a):
    a_s=[]
    for i in range(l):
        if s[i]==a:
            for j in range(1,min(6,l-i+1 )):
                a_s.append(s[i:i+j])
    return sorted(set(a_s) )
moji_list = sorted(set(s))
length = 0
for a in moji_list:
    a_s=find_substring_from_a(a)
    lenas = len(a_s)
    if length+lenas >=k:
        break
    else:
        length+=lenas
print(a_s[k-length-1])
### BUGGY CODE ###

n,m=map(int,input().split())
edges=[[] for i in range(3+3*n)]
for i in range(m):
    """#weighted->erase_,__,___=map(int,input().split())
    edges[_].append((__,___))
    #undirected->erase#edges[__].append((_,___))
    """
    _,__=map(int,input().split())
    _*=3;__*=3
    edges[_].append(__+1)
    edges[_+1].append(__+2)
    edges[_+2].append(__)

    #undirected->erase#edges[__].append(_)
    """
"""#weighted->erase

s,T=map(int,input().split())
from collections import deque
dq=deque([])
dq.append((3*s,0))
T*=3
seen=set()
while dq:
    now,c=dq.popleft()
    seen.add(now)
    for t in edges[now]:
        if t==T :print((c+1)//3);exit()
        if t not in seen:
            dq.append((t,c+1))
print("-1")

### FIXED CODE ###

import sys
input=sys.stdin.buffer.readline
inputs=sys.stdin.buffer.readlines
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
edges=[[] for i in range(3+3*n)]
o=inputs()
s,T=map(int,o.pop().split())
for i in o:
    _,__=map(int,i.split())
    _*=3;__*=3
    edges[_].append(__+1)
    edges[_+1].append(__+2)
    edges[_+2].append(__)

from collections import deque
dq=deque([])
dq.append((3*s,0))
T*=3
seen=[0]*(3*n+3)
seen[3*s]=1
while dq:
    now,c=dq.popleft()
    if now==T :print(c//3);exit()
    for t in edges[now]:
        if seen[t]==0:
            dq.append((t,c+1))
            seen[t]=1
print("-1")
### BUGGY CODE ###

from math import ceil

N,K = map(int,input().split())
A = sorted([int(i) for i in input().split()]) # 消化コスト
F = sorted([int(i) for i in input().split()],reverse = True) # 食べにくさ
# K: 修行の回数

cost = [a*f for a,f in zip(A,F)]

# にぶたん
# K回以下の修行でチーム成績がMになるか
# Mを固定して考える
def grade_is(M:int):
    training = 0
    for i in range(N):
        if cost[i] > M:
            training += ceil((cost[i] - M) / F[i])
        if training > K:
            return False
    return True

ok = 10 ** 18 + 1
ng = -1
while ok - ng > 1:
    mid = (ok + ng) // 2
    if grade_is(mid):
        ok = mid
    else:
        ng = mid

print(ok)

### FIXED CODE ###

from math import ceil
 
N, K = map(int,input().split())
A = sorted([int(i) for i in input().split()])
F = sorted([int(i) for i in input().split()],reverse=True)
# メンバーそれぞれが完食にかかる時間のリスト
cost = [A[i]*F[i] for i in range(N)]
 
# K回の修行でチーム成績がxになるか
def grade_is_x(x):
    training = 0
    for i in range(N):
        if cost[i] > x:
            training += ceil((cost[i]-x)/F[i])
            if training > K:
                return False
    return True
 
# 二分探索でxの最小値を求める
cost_max = max(cost)
ok = cost_max
ng = max(-1,max(cost)-K*F[cost.index(cost_max)])
while (ok - ng) != 1:
    mid = (ok + ng) // 2
    if grade_is_x(mid):
        ok = mid
    else:
        ng = mid
print(ok)
### BUGGY CODE ###

#!/usr/bin/python

# AtCoder Beginner Contest 075
# D - Axis-Parallel Rectangle

from sys import stdin

def nPointsInRect(x0, y0, x1, y1, points):
  return len([p for p in points
              if x0 <= p[0] <= x1 and y0 <= p[1] <= y1])

def solve(K, points):
  xs = sorted([p[0] for p in points])  # sorted x-coordinates
  ys = sorted([p[1] for p in points])  # sorted y-coordinates
  minArea = (xs[-1] - xs[0]) * (ys[-1] - ys[0])  # the biggest rect
  for i in range(len(ys)):
    y0 = ys[i]
    for y1 in ys[i + K - 1:]:
      for j in range(len(xs)):
        x0 = xs[j]
        for x1 in xs[j + K - 1:]:
          if nPointsInRect(x0, y0, x1, y1, points) >= K:
            area = (x1 - x0) * (y1 - y0)
            minArea = min(minArea, area)
  return minArea

def splitToInt(line):
  words = line.strip().split()
  return [int(w) for w in words]

N, K = splitToInt(stdin.readline())
points = []
for i in range(N):
  x, y = splitToInt(stdin.readline())
  points.append((x, y))
print(solve(K, points))

### FIXED CODE ###

#!/usr/bin/python

# AtCoder Beginner Contest 075
# D - Axis-Parallel Rectangle

from sys import stdin

def nPointsInRect(y0, y1, points):
  return len([p for p in points if y0 <= p[1] <= y1])

def solve(K, points):
  points.sort()  # sort the points by x-coordinates
  xs = [p[0] for p in points]          # sorted x-coordinates
  ys = sorted([p[1] for p in points])  # sorted y-coordinates
  minArea = (xs[-1] - xs[0]) * (ys[-1] - ys[0])  # the biggest rect
  for i0 in range(len(points)):
    for i1 in range(i0 + K - 1, len(points)):
      for j in range(len(ys)):
        y0 = ys[j]
        for y1 in ys[j + K - 1:]:
          if nPointsInRect(y0, y1, points[i0 : i1 + 1]) >= K:
            area = (xs[i1] - xs[i0]) * (y1 - y0)
            minArea = min(minArea, area)
            break  # no other rects for the same i0, i1, y0 are unnecessary
  return minArea

def splitToInt(line):
  words = line.strip().split()
  return [int(w) for w in words]

N, K = splitToInt(stdin.readline())
points = []
for i in range(N):
  x, y = splitToInt(stdin.readline())
  points.append((x, y))
print(solve(K, points))
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
B = [i+1 for i in range(N)]
flag = False
while flag!=True:
  flag = True
  for i in range(N-1):
    if A[i]>A[i+1]:
      A[i],A[i+1] = A[i+1],A[i]
      B[i],B[i+1] = B[i+1],B[i]
      flag = False

print(*B)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = [0]*N

for i in range(N):
  B[A[i]-1] = i+1
  
print(*B)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**9)


def unite(par, i, j):
    j = get_par(par, j)
    par[j] = get_par(par, i)

def get_par(par, p):
    while par[p] != p:
        p = par[p]
    return par[p]


n,m = map(int, input().split())
p = list(map(int, input().split()))
par = [i for i in range(n+1)]

for i in range(m):
    a,b = map(int, input().split())
    aa = get_par(par, a)
    bb = get_par(par, b)
    if aa == bb:
        continue
    # unite
    unite(par, a, b)

ans = 0
for i in range(n):
    a = p[i]
    if get_par(par, a) == get_par(par, i+1):
        ans += 1
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)


def unite(par, i, j):
    j = get_par(par, j)
    par[j] = get_par(par, i)

def get_par(par, p):
    while par[p] != p:
        p = par[p]
    return par[p]


n,m = map(int, input().split())
p = list(map(int, input().split()))
par = [i for i in range(n+1)]
cnt = [1 for _ in range(n+1)]

for i in range(m):
    a,b = map(int, input().split())
    aa = get_par(par, a)
    bb = get_par(par, b)
    if aa == bb:
        continue
    # unite
    if cnt[aa] > cnt[bb]:
        par[bb] = aa
        cnt[aa] += cnt[bb]
    else:
        par[aa] = bb
        cnt[bb] += cnt[aa]

ans = 0
for i in range(n):
    a = p[i]
    if get_par(par, a) == get_par(par, i+1):
        ans += 1
print(ans)
### BUGGY CODE ###

n = int(input())

a = list(map(int, input().split()))
m = 1
for i in range(n):
  if a.count(0):
    m = 0
    break
  elif m > 10**18:
    break
  else:
    m *= a[i]
if m == 0:
  print(0)
elif m > 10**18:
  print('-1')
else:
  print(m)

### FIXED CODE ###

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