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

# 2019/05/22
# AtCoder Beginner Contest 093 - B

# Input
a, b, k = map(int, input().split())

vals = list()
for i in range(a, b+1):
    vals.append(i)

if b - a + 1 < k:
    wk = b - a + 1
else:
    wk = k

# small
for i in range(wk):
    print(vals[i])
if k * 2 > b - a + 1:
    wk = b - a + 1 - wk

# large
for i in range(len(vals)-wk, len(vals)):
    print(vals[i])


### FIXED CODE ###

# 2019/05/22
# AtCoder Beginner Contest 093 - B

# Input
a, b, k = map(int, input().split())
cnt = b - a + 1

vals = list()
if cnt < k:
    wk = cnt
else:
    wk = k

# small
for i in range(a, a + wk):
    print(i)

if k * 2 > cnt:
    wk = cnt - wk

# large
for i in range(b - wk + 1, b+1):
    print(i)
### BUGGY CODE ###

import sys

input = sys.stdin.readline
P = 10 ** 9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = 61

    one_cnt = [0] * B
    for i in range(N):
        for b in range(B):
            one_cnt[b] += (A[i] >> b) & 1

    ans = 0
    for b in range(B):
        ans += 2 ** b * one_cnt[b] * (N - one_cnt[b])
        ans %= P
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

import numpy as np

input = sys.stdin.readline
P = 10 ** 9 + 7


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A = np.array(A)

    ans = 0
    for b in range(60 + 1):
        cnt_1 = int(np.sum((A >> b) & 1))
        ans += 2 ** b * cnt_1 * (N - cnt_1)
        ans %= P
    print(ans)


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

n = int(input())
arr = list(map(int,input().split()))
ans = []
for i in range(1,n+1):
    ans.append(arr.index(i)+1)
print(' '.join(map(str,ans)))

### FIXED CODE ###

n = int(input())
arr = list(map(int,input().split()))
ans = []
#二次元リストを作る→ソート
for i in range(1,n+1):
    ans.append([arr[i-1],i])
ans.sort()
ans = [i[1] for i in ans]


print(' '.join(map(str,ans)))
### BUGGY CODE ###

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

def lamp(A):
  B = [0] * N
  for i in range(N):
    l = max(0, i - A[i])
    r = min(N - 1, i + A[i])
    #print(l, r)
    B[l] += 1
    if r + 1 < N:
      B[r + 1] -= 1
  
  A[0] = B[0]
  for i in range(1, N):
    A[i] = A[i - 1] + B[i]
  return A

x = int(math.log(N, 2)) + 10
r = min(x, K)
for i in range(r):
  A = lamp(A)
  
for i in range(N):
  print(A[i], end = " ")
print("")


### FIXED CODE ###

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

def lamp(A):
  B = [0] * N
  for i in range(N):
    l = max(0, i - A[i])
    r = min(N - 1, i + A[i])
    #print(l, r)
    B[l] += 1
    if r + 1 < N:
      B[r + 1] -= 1
  
  A[0] = B[0]
  for i in range(1, N):
    A[i] = A[i - 1] + B[i]
  return A

r = min(41, K)
for i in range(r):
  A = lamp(A)
  
for i in range(N):
  print(A[i], end = " ")
print("")
### BUGGY CODE ###

from functools import lru_cache
import sys
sys.setrecursionlimit(10**7)
n, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]


# i番目の荷物を見たときの価値の最大値
@lru_cache(maxsize=None)
def f(i, r):
    w, v = wv[i]
    if i == 0:
        if w <= r:
            return v
        else:
            return 0
    if w <= r:
        return max(f(i-1, r), f(i-1, r-w) + v)
    else:
        return f(i-1, r)


print(f(n-1, W))





### FIXED CODE ###

N, W = map(int, input().split())
item = [list(map(int, input().split())) for i in range(N)]

dp = [[0]*(W+1) for i in range(N+1)]
for i in range(N):
    for w in range(1, W+1):
        if w - item[i][0] >= 0:
            dp[i+1][w] = max(
                dp[i][w],
                dp[i][w-item[i][0]] + item[i][1]
            )
        else:
            dp[i+1][w] = dp[i][w]
print((dp[N][W]))
### BUGGY CODE ###

n,m = map(int,input().split())
a = [int(input()) for i in range(m)]
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
j=0
for i in range(1,n+1):
  if i in a:
    #dp[a[j]] = 0 
    continue
  if i==1:
    dp[1] = dp[0]
    continue
  dp[i] = dp[i-1]+dp[i-2]
  dp[i]%=mod
print(dp[n])

### FIXED CODE ###

n,m = map(int,input().split())
#a = [int(input()) for i in range(m)]
a=set()
for i in range(m):
    tmp=int(input())
    a.add(tmp)
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
j=0
for i in range(1,n+1):
  if i in a:
    #dp[a[j]] = 0 
    continue
  if i==1:
    dp[1] = dp[0]
    continue
  dp[i] = dp[i-1]+dp[i-2]
  dp[i]%=mod
print(dp[n])
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10**9+7
ans = 1
s, t = [], []
for i in range(n):
    if a[i] < 0:
        t.append(a[i])
    else:
        s.append(a[i])


S, T = len(s), len(t)
ok = False

if S > 0:
    if n == k:
        ok = (T % 2 == 0)
    else:
        ok = True
else:
    ok = (k % 2 == 0)

if not ok:
    a.sort(key=abs)
    for i in range(k):
        ans *= a[i]
else:
    s.sort()
    t.sort(reverse=True)
    if k % 2 == 1:
        ans *= s.pop()
    p = []
    while len(s) >= 2:
        x = s.pop()
        x *= s.pop()
        p.append(x)
    while len(t) >= 2:
        x = t.pop()
        x *= t.pop()
        p.append(x)
    p.sort(reverse=True)
    for i in range(k//2):
        ans *= p[i]
print(ans % mod)


### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    mod = 10**9+7
    ans = 1
    s, t = [], []
    for i in range(n):
        if a[i] < 0:
            t.append(a[i])
        else:
            s.append(a[i])
    # s, t = [i for i in a if i > 0], [j for j in a if j < 0]

    S, T = len(s), len(t)
    ok = False

    if S > 0:
        if n == k:
            ok = (T % 2 == 0)
        else:
            ok = True
    else:
        ok = (k % 2 == 0)

    if not ok:
        a.sort(key=abs)
        for i in range(k):
            ans *= a[i]
            ans %= mod
    else:
        s.sort()
        t.sort(reverse=True)
        if k % 2 == 1:
            ans *= s.pop()
            ans %= mod
        p = []
        while len(s) >= 2:
            x = s.pop()
            x *= s.pop()
            p.append(x)
        while len(t) >= 2:
            x = t.pop()
            x *= t.pop()
            p.append(x)
        p.sort(reverse=True)
        for i in range(k//2):
            ans *= p[i]
            ans %= mod
    print(ans % mod)


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

# input here
_INPUT = """\
10 2
4
5
"""
"""
K = int(input())
H, W, K = map(int, input().split())
a = list(map(int, input().split()))
xy = [list(map(int, input().split())) for i in range(N)]
p = tuple(map(int,input().split()))
"""
def main():
    N, M = map(int, input().split())
    a = [int(input()) for i in range(M)]

    #動的計画法問題
    dp = [0] * (N+1)
    dp[0] = 1
    if 1 not in a:
        dp[1] = 1
    else:
        dp[1] = 0

    for i in range(2,N+1):
        if i in a:
            continue
        else:
            dp[i] = dp[i-1] + dp[i-2]
        
        dp[i] %= (10**9+7)

    print(dp[N]%(10**9+7)) 




            
if __name__ == '__main__':
    import io
    import sys
    import math
    import itertools
    from collections import deque

    # sys.stdin = io.StringIO(_INPUT)
    main()

### FIXED CODE ###

N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])
### 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:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
if 0 in a:
    print(0)
    exit(0)
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
        print(-1)
        exit(0)
else:
    print(ans)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)
k=[[int(i) for i in input().split()] for i in range(m)]
k=sorted(k,key=lambda x:-x[1])

now=0
flag=True
for x,y in k:
    if flag:
        for i in range(x):
            if flag and i+now<n:
                if y>a[i+now]:
                    a[i+now]=y
                else:
                    flag=False
    now+=x
print(sum(a))

### FIXED CODE ###

def main():
    import sys
    input=sys.stdin.readline
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    a=sorted(a)
    k=[[int(i) for i in input().split()] for i in range(m)]
    k=sorted(k,key=lambda x:-x[1])
    
    now=0
    flag=True
    for x,y in k:
        if flag:
            for i in range(x):
                if i+now>=n:
                    print(sum(a))
                    exit()
                if flag:
                    if y>a[i+now]:
                        a[i+now]=y
                    else:
                        flag=False
        now+=x
    print(sum(a))
if __name__=="__main__":
    main()
### BUGGY CODE ###

import math
from functools import reduce 
from fractions import gcd
n = int(input())
*v, = map(int,input().split())
#print(v)

mn = 0
for i in range(n):
  c = v.copy()
  #print('c',c)
  c.pop(i)
  #print('c2',c)
  ans = reduce(gcd,c)
  #print('v',v)
  #print('ans',ans)
  if ans > mn:
    mn = ans
    
print(mn)

### FIXED CODE ###

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

def gcd(x, y):
  return gcd(y, x%y) if y else x

l, r = [], []

for i in range(n):
  l.append(gcd(l[i-1], a[i-1]) if i else 0)
  r.append(gcd(r[i-1], a[n-i]) if i else 0)
print(max([gcd(l[i], r[n-i-1]) for i in range(n)]))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    if i+1 < a[i]:
        print(-1)
        exit()

def dfs(x,ans,so):
        if x == n:
                if ans == a:
                        for i in so:
                                print(i)
                        exit()
                return 0
        for i in range(1,x+2):
                ans.insert(i-1,i)
                so.append(i)
                dfs(x+1,ans,so)
                ans.pop(i-1)
                so.pop()
        return -1
print(dfs(0,[],[]))      

### FIXED CODE ###

import sys
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    if i+1 < a[i]:
        print(-1)
        exit()
 
def dfs(x,ans,so):
        if x == n:
                if ans == a:
                        so = so[::-1]
                        for i in so:
                                print(i)
                        exit()
                return 0
        for i in range(len(ans)-1,-1,-1):
            if ans[i] == i+1:
                ans.pop(i)
                so.append(i+1)
                dfs(x+1,ans,so)
                ans.insert(i,i+1)
                so.pop()
        return -1
print(dfs(0,a,[]))
### BUGGY CODE ###



N = int(input())
E = []
A = [[-1 for j in range(N+1)] for i in range(N+1)]
edges = [[] for i in range(N+1)]

for i in range(N-1):
  a, b = map(int, input().split())
  if i == 0:
    root = a
  E.append((a,b))
  edges[a].append(b)
  edges[b].append(a)

def dfs(u):
  visited = ["white"] * (N + 1)
  stack = [(u, -1, -1)]
  mcolor = -1

  while stack:
    u, p, c = stack.pop()
    visited[u] = "black"

    next = 1
    for v in edges[u]:
      if v != p and visited[v] != "black":
        if next == c:
          next += 1
        
        mcolor = max(mcolor, next)
        A[u][v] = next
        A[v][u] = next
        stack.append((v, u, next))
        next += 1
  
  return mcolor

print(dfs(root))

for edge in E:
  a, b = edge
  print(A[a][b])

### FIXED CODE ###


N = int(input())
edges = [[] for _ in range(N+1)]


for i in range(N-1):
  a, b = map(int, input().split())
  if i == 0:
    root = a
  edges[a].append((b, i))
  edges[b].append((a, i))

ans = [-1 for i in range(N-1)]
def dfs(u):
  flag = ["white"] * (N + 1)
  stack = [(u, -1, -1)]

  while stack:
    u, parent, color = stack.pop()
    flag[u] = "black"

    nextColor = 1
    for (next, index) in edges[u]:
      if next != parent and flag[next] != "black":
        if nextColor == color:
          nextColor += 1
        stack.append((next, u, nextColor))
        ans[index] = nextColor
        nextColor += 1

dfs(root)

print(max(ans))

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

# -*- coding: utf-8 -*-
"""
Created on Sun Jul 28 20:37:55 2019

@author: avina
"""

l,r = map(int, input().split())
k = 2020

for i in range(l,r+1):
   for j in range(i+1,r+1):
       k = min(k, (i*j)%2019)
       if k == 0:
           break
print(k)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Jul 28 20:37:55 2019

@author: avina
"""

l,r = map(int, input().split())
k = 2020

for i in range(l,r+1):
   for j in range(i+1,r+1):
       k = min(k, (i*j)%2019)
       if k == 0:
           print(k)
           exit()
print(k)
### BUGGY CODE ###

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

### TESTCASE
test = ""
#test = \
"""
9 3
8 3
4 2
2 1
ans 4
"""

"""
5 2
4 4
2 3
ans 7
"""

"""
100 6
1 1
2 3
3 9
4 27
5 81
6 243
ans 100
"""

"""
9999 10
540 7550
691 9680
700 9790
510 7150
415 5818
551 7712
587 8227
619 8671
588 8228
176 2461
ans 139815
"""
############
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
####### MAIN
        
h, n = map(int, input2().split())    
ab = [tuple(map(int, input2().split())) for _ in range(n)]

dp = [0] * (h + 1)

for i in range(1, h+1):
    dp[i] = min(dp[max(i-c[0], 0)] + c[1] for c in ab)
    #print(i, kouho)  
print(dp[-1])
    
    

### FIXED CODE ###

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

"""

9 3
8 3
4 2
2 1
ans 4

7 2
4 4
2 3
ans 8

100 6
1 1
2 3
3 9
4 27
5 81
6 243
ans 100

9999 10
540 7550
691 9680
700 9790
510 7150
415 5818
551 7712
587 8227
619 8671
588 8228
176 2461
ans 139815
"""; test = """
"""
import builtins
test = list(reversed(test.strip().splitlines()))
input = test.pop if test else builtins.input


import numpy as np
h, n = map(int, input().split())    
ab = np.array([tuple(map(int, input().split())) for _ in range(n)])


dp = np.zeros(h + 1, dtype="int")
for i in range(1, h+1):
    dp[i] = np.min(dp[np.maximum(i - ab[:, 0], 0)] + ab[:, 1])
    ### dp[i] = min(dp[max(i-c[0], 0)] + c[1] for c in ab) ###
print(dp[-1])
### BUGGY CODE ###

import sys

def MI(): return map(int, sys.stdin.readline().split())

md = 10 ** 9 + 7

n_max = 1005
fac = [1]
for i in range(1, n_max + 1): fac.append(fac[-1] * i % md)
ifac = [1] * (n_max + 1)
ifac[n_max] = pow(fac[n_max], md - 2, md)
for i in range(n_max - 1, 1, -1): ifac[i] = ifac[i + 1] * (i + 1) % md

def main():
    n, a, b, c, d = MI()
    pn = b - a + 1  # 班人数の種類数
    dp = [[0] * (n + 1) for _ in range(pn + 1)]
    # dp[i][j]...i番目の人数の班まで決めて全体でj人が決まったときの場合の数
    dp[0][0] = 1
    ps = 0
    for i in range(pn):
        p = i + a  # 班人数
        lim = n - (p + b) * (b - p + 1) * d // 2
        for j in range(max(lim, 0), min(n, ps * d) + 1):
            pre = dp[i][j]
            if pre == 0: continue
            dp[i + 1][j] += pre
            dp[i + 1][j] %= md
            r = n - j  # 残りの人数
            for g in range(c, d + 1):
                if j + p * g > n: break
                dp[i + 1][j + p * g] += pre * fac[r] * ifac[r - p * g] * ifac[g] * pow(ifac[p],g,md)
                dp[i + 1][j + p * g] %= md
        ps += p
    print(dp[pn][n])

main()


### FIXED CODE ###

import sys

def MI(): return map(int, sys.stdin.readline().split())

md = 10 ** 9 + 7

n_max = 1005
fac = [1]
for i in range(1, n_max + 1): fac.append(fac[-1] * i % md)
ifac = [1] * (n_max + 1)
ifac[n_max] = pow(fac[n_max], md - 2, md)
for i in range(n_max - 1, 1, -1): ifac[i] = ifac[i + 1] * (i + 1) % md

def main():
    n, a, b, c, d = MI()
    pn = b - a + 1  # 班人数の種類数
    dp = [[0] * (n + 1) for _ in range(pn + 1)]
    # dp[i][j]...i番目の人数の班まで決めて全体でj人が決まったときの場合の数
    dp[0][0] = 1
    ps = 0
    for i in range(pn):
        p = i + a  # 班人数
        low = n - (p + b) * (b - p + 1) * d // 2
        up = (a + p - 1) * (p - a) * d // 2
        for j in range(max(low, 0), min(n, up) + 1):
            pre = dp[i][j]
            if pre == 0: continue
            dp[i + 1][j] += pre
            dp[i + 1][j] %= md
            r = n - j  # 残りの人数
            for g in range(c, d + 1):
                if j + p * g > n: break
                dp[i + 1][j + p * g] += pre * fac[r] * ifac[r - p * g] * ifac[g] * pow(ifac[p], g, md)
                dp[i + 1][j + p * g] %= md
        ps += p
    print(dp[pn][n])

main()
### BUGGY CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
N, M = map(int,input().split())
H = []
L = [[] for k in range(M+1)]

for k in range(N):
    P = list(map(int,input().split()))[1:]
    H.append(P)
    for e in P:
        L[e].append(k+1)

G = [0 for k in range(N+1)]
G[1] = 1
Q = [H[0]]
while len(Q) > 0:
    ima = Q.pop()
    for tsugi in ima:
        for e in L[tsugi]:
            if G[e] == 0:
                G[e] = 1
                Q.append(H[e-1])

for k in range(1,N+1):
    if G[k] == 0:
        print("NO")
        exit(0)
print("YES")

### FIXED CODE ###

N, M = map(int,input().split())
H = []
L = [[] for k in range(M+1)]

for k in range(N):
    P = list(map(int,input().split()))[1:]
    H.append(P)
    for e in P:
        L[e].append(k+1)

G = [0 for k in range(N+1)]
G[1] = 1
Q = [H[0]]
while len(Q) > 0:
    ima = Q.pop()
    for tsugi in ima:
        for e in L[tsugi]:
            if G[e] == 0:
                G[e] = 1
                if len(H[e-1]) > 1:
                    Q.append(H[e-1])

for k in range(1,N+1):
    if G[k] == 0:
        print("NO")
        exit(0)
print("YES")
### BUGGY CODE ###

from itertools import combinations
n = int(input())
s = []
for i in range(n):
    s.append(''.join(sorted(input())))
ans = 0
s1 = set(s)
for i in s1:
    ans += sum([i for i in range(0, s.count(i))])
print(ans)


### FIXED CODE ###

import collections
 
N = int(input())
s = ["".join(sorted(input())) for _ in range(N)]
c = collections.Counter(s)
ans = 0
for si in set(s):
    n = c[si]
    ans += n * (n - 1) // 2
print(ans)
### BUGGY CODE ###

class Tree:
    value=0
    def __init__(self,position):
        self.position = position
        self.kid = set()
        self.value = 0

    def add_kid(self,it):
        self.kid.add(it)

    def add_val(self,val):
        self.value += val

    def calc(self,val=0):
        self.add_val(val)
        # print("called",self.position)
        for i in self.kid:
            if(i.position in visited):
                continue
            visited.add(i.position)
            i.calc(self.value)

    def print_val(self):
        print(self.value,end=" ")

N,Q = [int(x) for x in input().split()]
ki = [Tree(i) for i in range(N)]

for i in range(N-1):
    a,b = [int(x) for x in input().split()]
    ki[a-1].add_kid(ki[b-1])
    ki[b-1].add_kid(ki[a-1])

for i in range(Q):
    position,val = [int(x) for x in input().split()]
    ki[position-1].add_val(val)

visited = set()
visited.add(0)
ki[0].calc()

for i in ki:
    i.print_val()
print()


### FIXED CODE ###

N,Q = [int(x) for x in input().split()]
ki = [0]*N
tr = [[] for _ in range(N)]

for i in range(N-1):
    a,b = [int(x)-1 for x in input().split()]
    tr[a].append(b)
    tr[b].append(a)

for i in range(Q):
    position,val = [int(x) for x in input().split()]
    ki[position-1] += val

stack =[0]
visited = set()
visited.add(0)

while stack:
    i = stack.pop()
    for j in tr[i]:
        if j in visited:
            continue
        visited.add(j)
        ki[j] += ki[i]
        stack.append(j)

for i in ki:
    print(i,end=" ")
print()
### BUGGY CODE ###

import sys
input=sys.stdin.readline

check=dict()
N,b,d=0,[],0
#ttfは235、chaはabc
def dfs_sub(n,ttf,cha):
    global check,d

    #-1ずつしていく場合
    check[0]=min(check[n]+n*d,check[0])

    #最寄りまで-してく場合
    x1,x2=n//ttf,n%ttf
    if ttf-x2>=x2:
        if x1 in check:
            if check[x1]>check[n]+x2*d+cha:
                check[x1]=check[n]+x2*d+cha
                dfs(x1)
        else:
            check[x1]=check[n]+x2*d+cha
            dfs(x1)

    #最寄りまで+1してく場合
    x1,x2=n//ttf+1,ttf-n%ttf
    if ttf-x2>x2:
        if x1 in check:
            if check[x1]>check[n]+x2*d+cha:
                check[x1]=check[n]+x2*d+cha
                dfs(x1)
        else:
            check[x1]=check[n]+x2*d+cha
            dfs(x1)


def dfs(n):
    global b,check,d
    for i,j in zip([2,3,5],b):
        dfs_sub(n,i,j)

t=int(input())
for i in range(t):
    N,*b,d=map(int,input().split())
    check={N:0,0:N*d}
    dfs(N)
    print(check[0])

### FIXED CODE ###

import sys
check=dict()
N,a,b,c,d=0,0,0,0,0
#ttfは235、chaはabc
def dfs_sub(n,ttf,cha):
    global check,d
    if 0 in check:
        check[0]=min(check[n]+n*d,check[0])
    else:
        check[0]=check[n]+n*d
    if n//ttf==0:
        if n//ttf in check:
            if check[n//ttf]>check[n]+(n%ttf)*d:
                check[n//ttf]=check[n]+(n%ttf)*d
        else:
            check[n//ttf]=check[n]+(n%ttf)*d
    else:
        if n//ttf in check:
            if check[n//ttf]>check[n]+(n%ttf)*d+cha:
                check[n//ttf]=check[n]+(n%ttf)*d+cha
                dfs(n//ttf)
        else:
            check[n//ttf]=check[n]+(n%ttf)*d+cha
            dfs(n//ttf)
    if 1+n//ttf in check:
        if check[1+n//ttf]>check[n]+(ttf-n%ttf)*d+cha:
            check[1+n//ttf]=check[n]+(ttf-n%ttf)*d+cha
            dfs(1+n//ttf)
    else:
        check[1+n//ttf]=check[n]+(ttf-n%ttf)*d+cha
        dfs(1+n//ttf)


def dfs(n):
    global check,a,b,c,d
    dfs_sub(n,2,a)
    dfs_sub(n,3,b)
    dfs_sub(n,5,c)

t=int(input())
ans=[0]*t
for i in range(t):
    N,a,b,c,d=map(int,input().split())
    check={N:0}
    dfs(N)
    ans[i]=check[0]
for i in range(t):
    print(ans[i])
### BUGGY CODE ###

import sys
import heapq

input = sys.stdin.readline
n, m = map(int, input().split())
A = list(map(int, input().split()))
heapq.heapify(A)

BC = [list(map(int, input().split())) for _ in range(m)]
BC.sort(key=lambda x: -x[1])

mx = n*2
[heapq.heappushpop(A, bc[1]) for bc in BC if len(A) < mx for _ in range(bc[0])]
print(sum(A))

### FIXED CODE ###

import sys

input = sys.stdin.readline
n, m = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(m)]
BC.sort(key=lambda x: -x[1])

maxi = n*2
extend = A.extend
[extend([ls[1]] * ls[0]) for ls in BC if len(A) <= maxi]
A.sort(reverse=True)

print(sum(A[:n]))
### BUGGY CODE ###

try:
    n = int(input().strip())
    spot = list(input().strip().split(" "))
    for i in range(n):
        max = 0
        point = 0
        for m in range(n):
            if i == m:
                continue
            max+=abs(point - int(spot[m]))
            point=int(spot[m])
        max+=abs(point - 0)
        print(max)    
except EOFError:
    pass

### FIXED CODE ###

try:
    n = int(input().strip())
    spot = [int(i) for i in input().strip().split(" ")]
    spot.insert(0,0)
    spot.append(0)
    max=0
    for m in range(1,len(spot)):
        max+=abs(spot[m-1] - spot[m])
    for i in range(1,n+1):
        sub1=abs(spot[i-1] - spot[i])
        sub2=abs(spot[i] - spot[i+1])
        add1=abs(spot[i-1] - spot[i+1])
        print(max-sub1-sub2+add1)
except EOFError:
    pass
### BUGGY CODE ###

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

### FIXED CODE ###

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