Harryxun/stf_run huggingface dataset:
import math
from collections import Counter
N=int(input())
D=input().split()
T=[]
D_dict=Counter(D)
D_keys=list(D_dict.keys())
D_keyi=[int(n) for n in D_keys]
maxD=max(D_keyi)
D_keyi.sort()
ans=1
if D[0] != '0' or D_dict['0']!=1 or D_keyi != list(range(maxD+1)):
    print(0)
else:
    for i in range(maxD+1):
        T.append(D_dict[str(i)])
    for i in range(len(T)-1):
        ans=ans*(T[i]**T[i+1])
    print(mod(ans,998244353))


### FIXED CODE ###

import math
from collections import Counter
N=int(input())
D=input().split()
T=[]
D_dict=Counter(D)
D_keys=list(D_dict.keys())
D_keyi=[int(n) for n in D_keys]
maxD=max(D_keyi)
D_keyi.sort()
ans=1
if D[0] != '0' or D_dict['0']!=1 or D_keyi != list(range(maxD+1)):
    print(0)
else:
    for i in range(maxD+1):
        T.append(D_dict[str(i)])
    for i in range(len(T)-1):
        ans=ans*(T[i]**T[i+1])
    print((ans%998244353))
import sys
import numpy as np

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline

N, M = map(int, input().split())
a = np.array([int(input()) for _ in range(M)])

dp = np.array([0 for _ in range(N+1)])
dp[0] = 1

for i in range(N+1):
	if np.any(a == i):
		continue
	for j in [1, 2]:
		if i - j >= 0 and not np.any(a == i-j):
			dp[i] += dp[i-j]
print(dp[-1]%1000000007)

### FIXED CODE ###

import sys
if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline

N, M = map(int, input().split())
n = [True for _ in range(N+1)]
for _ in range(M):
	n[int(input())] = False

dp = [0 for _ in range(N+1)]
dp[0] = 1

for i in range(N+1):
	if not n[i]:
		continue
	for j in [1, 2]:
		if i - j >= 0:
			dp[i] += dp[i-j]
print(dp[-1]%1000000007)
while True:
    a,b = map(int, input().split())
    if (a,b) == (0,0) :
        break
    elif a > b:
        c = a
        a = b
        b = c
    else:
    print("{} {}".format(a,b))


### FIXED CODE ###

while True:
    a,b = map(int, input().split())
    if (a,b) == (0,0) :
        break
    elif a > b:
        c = a
        a = b
        b = c
    print("{} {}".format(a,b))
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
S = list(input())
ls =[]
count = 0
for a in S:
    
    if a == 'A' or a =='T' or a == 'C' or a =='G':
        count += 1
    else:
        ls.append(count)
        count = 0

print(max(ls))



### FIXED CODE ###

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
S = list(input())
clst=[]
count = 0
for s in S:
    if s == 'A' or s == 'T' or s =='C' or s == 'G':
        count += 1
        clst.append(count)
    else:
        
        count = 0
        clst.append(count)
print(max(clst))
a, b ,c = map(int, input().split())
if a < b:
    if b < c:
        print("YES")
else:
print('NO')


### FIXED CODE ###

a, b ,c = map(int, input().split())
if a < b:
    if b < c:
        print("Yes")
    else:
        print("No")
else:
    print("No")
n=int(input())
d=sorted(list(map(int,input().split())))

print(d[n/2+1]-d[n/2-1])

### FIXED CODE ###

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

print(d[n//2]-d[n//2-1])
a = input()
b = input()
print(sum(a[i] == b[i] for i in range[3]))

### FIXED CODE ###

a = input()
b = input()
print(sum(a[i] == b[i] for i in range(3)))
s = input()
for i in range(len(s)):
    if s[i] == s[i+1]:
        print("Bad")
        exit()
print("Good")

### FIXED CODE ###

s = input()
for i in range(len(s) - 1):
    if s[i] == s[i+1]:
        print("Bad")
        exit()
print("Good")
k=int(input())
a,b=map(int,input().split())


f= False
for d  in range (a,b+1):
    if d % k == 0:
        f=True
        break


if f :
    print('OK')
else :
    print('NG')


### FIXED CODE ###

n,k = map(int,input().split())
a=[0 for i in range(n)]
for i in range(k):
    di = int(input())
    ai = list(map(int,input().split()))
    for j in range(len(ai)):
        a[ai[j]-1] = 1

print(a.count(0))
a,b,c=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
  print('Possible')
else:print('Impossible')

### FIXED CODE ###

a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
  print('Possible')
else:print('Impossible')
W,H,N = int(input())
p = 0
q = W
l = 0
m = H

for i in range(N):
  x,y,a = map(int.split())
  if a == 1:
    p = max(p,x)
  if a == 2:
    q = min(q,x)
  if a == 3:
    l = max(l,y)
  if a == 4:
    m = min(m,x)
S = (q-p)*(l-m)
print(S)
    
  

### FIXED CODE ###

W,H,N = map(int,input().split())
p = 0
q = W
l = 0
m = H

for i in range(N):
  x,y,a = map(int, input().split())
  if a == 1:
    p = max(p,x)
  if a == 2:
    q = min(q,x)
  if a == 3:
    l = max(l,y)
  if a == 4:
    m = min(m,y)
if (q-p)<0 or (m-l)<0:
  print(0)
  exit()
else:
  S = (q-p)*(m-l)
  print(S)
S = input()
S.replace("hi",":")
if len(set(S)) == 1:
  print("Yes")
else:
  print("No)

### FIXED CODE ###

S = input()
if S.count("hi") == len(S)/2:
    print("Yes")
else:
    print("No")
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())


def add_count(G, C, v):
    for child in G[v]:
        C[child] += C[v]
        add_count(G, C, child)


def main():
    G = [[] for _ in range(N)]
    C = [0 for _ in range(N)]
    for _ in range(N-1):
        p, c = map(int, input().split())
        G[p-1].append(c-1)

    for _ in range(Q):
        p, x = map(int, input().split())
        C[p-1] += x

    add_count(G,C, 0)

    print(*C)

main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

# 遅延評価で加えてあげるだけ

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x
    
q = [(1,0)]
while q:
    x,parent = q.pop()
    value[x] += value[parent]
    for y in graph[x]:
        if y == parent:
            continue
        q.append((y,x))

answer = ' '.join(map(str,value[1:]))
print(answer)
n = map(int, input().split())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)

### FIXED CODE ###

n = int(input())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)
S = input()
S.replace("hi",":")
if len(set(list(s))) == 1:
  print("Yes")
else:
  print("No)

### FIXED CODE ###

S = input()
if S.count("hi") == len(S)/2:
    print("Yes")
else:
    print("No")
import math
A = int(input())
B = int(input())
H = int(input())
M = int(input())
c = 0

h = H * 30 + 0.5 * M
m = 6 * M
hh = abs(h - m)
mm = 360 - hh

if hh <= mm:
    c = hh
else:
    c = mm

c = math.radians(c)

print(c)

#print(math.cos(math.radians(90)))
      
C = (A * A) + (B * B) - (2 * A * B * math.cos(c))
print(C)
print(math.sqrt(C))

### FIXED CODE ###

import math
A,B,H,M = map(int,input().split())


h = H * 30 + 0.5 * M
m = 6 * M
hh = abs(h - m)
mm = 360 - hh

if hh <= mm:
    c = hh
else:
    c = mm

c = math.radians(c)

C = (A * A) + (B * B) - (2 * A * B * math.cos(c))
print(math.sqrt(C))

"""
A = int(input())
B = int(input())
H = int(input())
M = int(input())
"""
n,p=map(int,input().split())
a=list(map(int,input().split()))
gu=0
ki=0
for i in a:
    if a%2==0:
        gu+=1
    else:
        ki+=1
if ki:
    print(2**(n-1))
else:
    if p:
        print(0)
    else:
        print(2**n)


### FIXED CODE ###

n,p=map(int,input().split())
a=list(map(int,input().split()))
gu=0
ki=0
for i in a:
    if i%2==0:
        gu+=1
    else:
        ki+=1
if ki:
    print(2**(n-1))
else:
    if p:
        print(0)
    else:
        print(2**n)
h,w=map(int,input().split())
s=[input() for _ in range(h)]
infi=10**18
dp=[[infi]*h for _ in range(w)]
if s[0][0]=='#':
  dp[0][0]=1
else:
  dp[0][0]=0
for i in range(h):
  for j in range(w):
    if s[i][j]=='.':
      if i<h-1:
        if s[i+1][j]=='.':
          dp[i+1][j]=min(dp[i+1][j],dp[i][j])
        else:
          dp[i+1][j]=min(dp[i+1][j],dp[i][j]+1)
      if j<w-1:
        if s[i][j+1]=='.':
          dp[i][j+1]=min(dp[i][j+1],dp[i][j])
        else:
          dp[i][j+1]=min(dp[i][j+1],dp[i][j]+1)
    else:
      if i<h-1:
        if s[i+1][j]=='.':
          dp[i+1][j]=min(dp[i+1][j],dp[i][j])
        else:
          dp[i+1][j]=min(dp[i+1][j],dp[i][j])
      if j<w-1:
        if s[i][j+1]=='.':
          dp[i][j+1]=min(dp[i][j+1],dp[i][j])
        else:
          dp[i][j+1]=min(dp[i][j+1],dp[i][j])
print(dp[h-1][w-1])

### FIXED CODE ###

h,w=map(int,input().split())
s=[input() for _ in range(h)]
infi=10**18
dp=[[infi]*w for _ in range(h)]
if s[0][0]=='#':
  dp[0][0]=1
else:
  dp[0][0]=0
for i in range(h):
  for j in range(w):
    if s[i][j]=='.':
      if i<h-1:
        if s[i+1][j]=='.':
          dp[i+1][j]=min(dp[i+1][j],dp[i][j])
        else:
          dp[i+1][j]=min(dp[i+1][j],dp[i][j]+1)
      if j<w-1:
        if s[i][j+1]=='.':
          dp[i][j+1]=min(dp[i][j+1],dp[i][j])
        else:
          dp[i][j+1]=min(dp[i][j+1],dp[i][j]+1)
    else:
      if i<h-1:
        if s[i+1][j]=='.':
          dp[i+1][j]=min(dp[i+1][j],dp[i][j])
        else:
          dp[i+1][j]=min(dp[i+1][j],dp[i][j])
      if j<w-1:
        if s[i][j+1]=='.':
          dp[i][j+1]=min(dp[i][j+1],dp[i][j])
        else:
          dp[i][j+1]=min(dp[i][j+1],dp[i][j])
print(dp[h-1][w-1])
if n % 2 == 1:
    print(0)
else:
    cnt = 0
    a = n // 2 // 5
    b = 0
    while a >= 5 ** b:
        cnt += a // 5**b
        b += 1
    print(cnt)

### FIXED CODE ###

n = int(input())
if n % 2 == 1:
    print(0)
else:
    cnt = 0
    a = n // 2 // 5
    b = 0
    while a >= 5 ** b:
        cnt += a // 5**b
        b += 1
    print(cnt)
N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
lst.sort(key=lambda x: x[0])
pn = 0
temp_pn = [] 
for _ in range(M):
  temp_pn.append(0)
cr = 0
plbnum = 0
for i in lst:
  a = int(i[0])
  if N >=  a > plbnum:
    if i[1] == "WA":
      temp_pn[a] += 1
    elif i[1] == "AC":
      cr += 1
      pn += temp_pn[a-1]
      plbnum = a
print(cr, pn)

### FIXED CODE ###

N, M = list(map(int, input().split()))
lst = [input().split() for lst in range(M)]
pn = 0
lst_pn = []
lst_cr = []
for _ in range(N):
  lst_pn.append(0)
  lst_cr.append(0)
cr = 0
for i in lst:
  a = int(i[0])
  if lst_cr[a-1] == 1:
    continue
  elif i[1] == "WA":
    lst_pn[a-1] += 1
  elif i[1] == "AC":
    cr += 1
    lst_cr[a-1] += 1
    pn += lst_pn[a-1]
print(cr, pn)
d,t,s = map(int,input())
if t*s <= d:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

d,t,s = map(int,input().split())
if t*s >= d:
    print("Yes")
else:
    print("No")
N,K = map(int,input().split())
A = list(map(int,input().split()))

def s(n,a):
  b = [0]*n
  for i in range(n):
    l = max(0,i-a[i])
    r = min(n-1,i+a[i])
    b[l] += 1
    if r < N - 1:
      b[r+1] -= 1
  for i in range(n):
    b[i+1] = b[i]
  return b

for i in range(min(41,K)):
  A = s(N,A)
  
print(A)
      

### FIXED CODE ###

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

def s(n,a):
  b = [0]*n
  for i in range(n):
    l = max(0,i-a[i])
    r = min(n-1,i+a[i])
    b[l] += 1
    if r < n - 1:
      b[r+1] -= 1
  for i in range(n-1):
    b[i+1] += b[i]
  return b

for i in range(min(41,K)):
  A = s(N,A)
  
print(*A)
import math
A, B = [int(v) for v in input().split()]

def lcm(a, b):
    return a * b / math.gcd(a, b)
print(int(lcm(A, B)))

### FIXED CODE ###

import fractions
A, B = [int(v) for v in input().split()]

def lcm(a, b):
    return a * b / fractions.gcd(a, b)

print(int(lcm(A, B)))
n,k = map(int,input().split())
a = [0]+list(map(int,input().split()))
for i in range(n):
    a[i+1] += a[i]
cnt = {}
ans = 0
for i in range(n+1):
    left = i-k
    if left >= 0:
        ldiff = (a[left] - left)%k
        cnt[ldiff]-=1
    diff = (a[i]-i)%k
    if diff not in cnt:cnt[diff] = 0
    ans += cnt[diff]
    cnt[diff] +=1
print(ans)
             

### FIXED CODE ###

n,k = map(int,input().split())
a = [0]+list(map(int,input().split()))
for i in range(n):
    a[i+1] += a[i]
cnt = {}
ans = 0
for i in range(n+1):
    left = i-k
    if left >= 0:
        ldiff = (a[left] - left)%k
        cnt[ldiff]-=1
    diff = (a[i]-i)%k
    if diff not in cnt:cnt[diff] = 0
    ans += cnt[diff]
    cnt[diff] +=1
print(ans)
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

import itertools
X = list(itertools.permutations(range(1,N+1),N))
for i in range(len(X)):
  x = X[i]
  if P == x:
    a = i 
  elif Q == x:
    b = i

print(abs(a-b))

### FIXED CODE ###

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

import itertools
X = list(itertools.permutations(range(1,N+1),N))
for i in range(len(X)):
  x = X[i]
  if P == x:
    a = i 
  if Q == x:
    b = i

print(abs(a-b))
ll = [i for i in list(__import__('string').ascii_lowercase)]
ul = [i for i in list(__import__('string').ascii_uppercase)]
al = ll + ul
nl = list(range(52))
ad = dict(zip(nl, al))
ad_inv = {i:j for j,i in ad.items()}

n = int(input())
s = list(input())
ans = [ad_inv[i]+n for i in s]
ans = [ad[i] for i in ans]
ans = "".join(ans)
print(ans)

### FIXED CODE ###

n = int(input())
s = list(input())
num_list = [ord(i)+n for i in s] #ord(A)は65
ans_num = [(i-65)%26 + 65 for i in num_list]
ans_str = [chr(i) for i in ans_num]
ans = "".join(ans_str)
print(ans)
l=list(map(int, input().split())
print(min(l), max(l), sum(l))


### FIXED CODE ###


input()
l=list([int(i) for i in input().split()])
print(min(l), max(l), sum(l))
import math
n = int(input())
ans = 0
t_1, a_1 = map(int, input().split())
pret = t_1
prea = a_1
for x in range(n - 1):
    t, a = map(int, input().split())
    else:
        m = max(math.ceil(pret / t), math.ceil(prea / a))
        pret = m * t
        prea = m * a
print(pret + prea)

### FIXED CODE ###

import math
n = int(input())
ans = 0
t_1, a_1 = map(int, input().split())
pret = t_1
prea = a_1
for x in range(n - 1):
    t, a = map(int, input().split())
    m = -min(-pret//t,-prea//a)
    pret = m * t
    prea = m * a
print(pret + prea)
S = input()

if S == ABC:
    print('ARC')
else:
    print('ABC')

### FIXED CODE ###

S = input()

if S == 'ABC':
    print('ARC')
else:
    print('ABC')
# メモ
# 連結無効グラフ　＝　全部が繋がっている

# N = int(input())
# D = list(map(int, input()))

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

JOSU = 998244353

anser = 0

deep = [-1] * (N + 1)
memo = [0] * N

# 各深さの数を求める
for i in range(N):
    if deep[D[i]] == -1:
        deep[D[i]] = 0
    deep[D[i]] += 1

def dfs(n, end, sum):
    if n == end:
        return sum
    elif deep[n + 1] == -1:
        return dfs(n + 1, end, sum)
    else:
        return dfs(n + 1, end, sum * deep[n] ** deep[n + 1])

if deep[0] != 1:
    print(0)
else:
    print(dfs(0, N, 1) % JOSU)

### FIXED CODE ###

# 再帰関数の最大再帰回数を変更
import sys
sys.setrecursionlimit(1000000)

# 再帰関数で作る木の個数を返す
def dfs(now, end, summary):
    # 終了条件
    if now == end:
        return summary
    # 1つ前の頂点時点で作ることのできる木の個数 *（１つ前の深さの頂点の数 ^ 現在の深さの頂点の数）で再帰関数
    else:
        return dfs(now + 1, end, summary * (deep[now - 1] ** deep[now]))

# 最後に割る数の定数
JOSU = 998244353

# 入力
N = int(input())
D = list(map(int, input().split()))

# 深さをメモするため、Dの最大値 + 1の数の配列を用意
# 例：深さの最大が2なら、0, 1, 2の3つが必要
deep = [0] * (max(D) + 1)

# 各深さの頂点の数を記録
for i in range(N):

    # 頂点1が深さ0以外なら制約違反
    if i == 0 and D[i] != 0:
        print(0)
        exit()
    # 頂点1以外が深さ0なら制約違反
    elif i > 0 and D[i] == 0:
        print(0)
        exit()

    deep[D[i]] += 1

# 再帰関数で計算
print(dfs(1, len(deep), 1) % JOSU)
nums=list(map(int, input().split()))
ans=[]
for i in range(2):
  ans.append(nums[i]*nums[2])
  ans.append(nums[i]*nums[3])
print max(ans)



### FIXED CODE ###

nums=list(map(int, input().split()))
ans=[]
for i in range(2):
  ans.append(nums[i]*nums[2])
  ans.append(nums[i]*nums[3])
print (max(ans))
i=int(input())
j=int(input())
ls=range(1,3)
ls.remove(i)
ls.remove(j)
print(ls.pop())

### FIXED CODE ###

i=int(input())
j=int(input())
a=6-(i+j)
print(str(a))
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = [0 for i in range(M)]
C = [0 for i in range(M)]
for i in range(M):
B[i],C[i] = map(int, input().split())
import bisect
from collections import deque

for i in range(M):
  A = sorted(A)
  lm = bisect.bisect_right(A, C[i]-1)-1
  print(lm)
  for j in range(min(B[i],lm+1)):
    A[j] = C[i]
    
print(sum(A))


### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [[] for _ in range(M)]
for i in range(M):
  BC[i] = list(map(int, input().split()))

BC.sort(key=lambda x: x[1], reverse=True)

for i in BC:
  A.extend([i[1]]*i[0])
  if len(A) > 2*N:
    break
    
A = sorted(A,reverse=True)
print(sum(A[:N]))
class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
    def find(self, x):
        if self.parent[x] == x:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        self.parent[x] = y

def main():
    N, M = map(int, input().split())
    uf = UnionFind(N)
    for i in range(M):
        X, Y, Z = map(int, input().split())
        uf.union(X-1, Y-1)
    s = set()
    for i in range(N):
        s.add(uf.find(i))
    print(len(s))

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
    def find(self, x):
        if self.parent[x] == x:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        self.parent[x] = y

def main():
    N, M = map(int, input().split())
    uf = UnionFind(N)
    for i in range(M):
        X, Y, Z = map(int, input().split())
        uf.union(X-1, Y-1)
    s = set()
    for i in range(N):
        s.add(uf.find(i))
    print(len(s))

if __name__ == "__main__":
    sys.setrecursionlimit(10**6)
    main()
A= list(int(input().split(' ')))
if A.count(5) == 2 and A.coutn(7) == 1:
  print('YES')
else:
  print('NO')


### FIXED CODE ###

A= list(map(int, input().split()))
if A.count(5) == 2 and A.count(7) == 1:
    print('YES')
else:
    print('NO')
n,q=map(int,input().split())
s=input()
list=[0]
for i in range(n-1):
  if s[i]=='A' and s[i+1]=='C':
    list.append(s[i]+1)
  else:
    list.append(s[i])
for j in range(q):
  l,r=map(int,input().split())
  print(list[r]-list[l-1])

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
list=[0]
for i in range(n-1):
  if s[i]=='A' and s[i+1]=='C':
    list.append(list[i]+1)
  else:
    list.append(list[i])
for j in range(q):
  l,r=map(int,input().split())
  print(list[r-1]-list[l-1])
N = int(input())
ans = 1
for i in range(N)
    ans = ans * (i + 1) % (10**9 + 7)
print(ans)

### FIXED CODE ###

N = int(input())
ans = 1
for i in range(N):
    ans = ans * (i + 1) % (10**9 + 7)
print(ans)
x = input()
if x >= 30:print("Yes")  
else:print("No")

### FIXED CODE ###

x = int(input())
if x >= 30:
  print("Yes")
else:
  print("No")
N = int(input())

def dfs(s):
    if int(s) > N:
        return 0
    #sが7,5,3をそれぞれ一つ以上含んでいる場合、+1、 else 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    #sに7,5,3のいずれかを付け足す
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs(''))

### FIXED CODE ###

N = int(input())

def dfs(s):
    if int(s) > N:
        return 0
    #sが7,5,3をそれぞれ一つ以上含んでいる場合、+1、 else 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    #sに7,5,3のいずれかを付け足す
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs('0'))
N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(N):
    ans = ans*A[i]

if ans<= 10**18:
    print(ans)
    exit(0)
else:
    print(-1)

### FIXED CODE ###

A, B = map(int,input().split())
print(A*B)
# AGC 025 A - Digits Sum
N = int(input())

def sum_of(num): #各位の合計値を返す
    list_b = []
    k = 0
    if num > 0:
        while num > 0:
            list_b.append(num % 10)
            num = num // 10
        for i in range(len(list_b)):
            k += list_b[i]
        return k 
    if num == 0:
        return 0 

list_a =[]
for i in range(N-2):
    A = i + 2
    B = N - i - 2   
    list_a.append(sum_of(A) + sum_of(B))
    
print(min(list_a))

### FIXED CODE ###

N = int(input())

def sum_of(num): 
    list_b = []
    k = 0
    while num > 0:
        list_b.append(num%10)
        num //= 10
    for i in range(len(list_b)):
        k += list_b[i]
    return k 

list_a =[]
if N == 2:
    print(str(2))
if N == 3:
    print(str(3))
if N >= 4:
    for i in range(2,N-1):
        A = i
        B = N - i
        list_a.append(sum_of(A) + sum_of(B))
    print(min(list_a))
5
1 2 3 3 4 5 7 7 7
R R R R R R G G G
1 2 2 3 4 4 4 4 5
R R R R R R R R R
1 2 3 4 4 4 5 5 5
R R B R R R R R R
1 1 1 3 4 5 6 6 6
R R B G G G R R R
2 2 2 3 3 3 1 1 1
R G B R G B R G B


### FIXED CODE ###

T = int(input())
for i in range(T):
    num = list(map(int, input().split()))
    coler = input().split()
    groups = [[], [], []]
    for i, c in enumerate(coler):
        if c == "R":
            groups[0].append(num[i])
        elif c == "G":
            groups[1].append(num[i])
        else:
            groups[2].append(num[i])
    for group in groups:
        while len(group) != 0 and len(group) % 3 == 0:
            tmp = group[:]
            group.sort()
            i = group[0]
            if group.count(i) >= 3:
                for _ in range(3):
                    group.remove(i)
            if i + 1 in group and i + 2 in group:
                for j in range(3):
                    group.remove(i + j)
            if tmp == group:
                break
    if len(groups[0]) == len(groups[1]) == len(groups[2]) == 0:
        print(1)
    else:
        print(0)
a, b, c, d, e, f= (int(i) for i in input().split()) 

den=0
ans2=0
for i in range(30+1):
  for j in range(15+1):
    water = 100*a*i+100*b*j
    maxsugar=int(water/100)*e
    if water + maxsugar <= f:
      for k in range(0,maxsugar+1):
        for l in range(0,maxsugar+1):
          sugar=c*k+d*l
          if 0 < water+sugar <= f and sugar <=maxsugar:
            if den < sugar/(water+sugar):
              den=sugar/(water+sugar)
              ans1=water+sugar
              ans2=sugar

print(ans1,ans2)
              


### FIXED CODE ###

a, b, c, d, e, f= (int(i) for i in input().split()) 

waterlist=[]
for i in range(0,f+100*a,100*a):
  for j in range(0,f+100*b,100*b):
    if i+j <=f:
      waterlist+=[i+j]
waterlist=list(set(waterlist))
#print(x)

sugarlist=[]
for i in range(int(f/c)+1):
  for j in range(int(f/d)+1):
    if c*i+d*j <=f:
      sugarlist+=[c*i+d*j]
sugarlist=list(set(sugarlist))
#print(y)

density=0

for i in range(len(waterlist)):
  for j in range(len(sugarlist)):
    if 0 < waterlist[i]+sugarlist[j] <= f and sugarlist[j]<=waterlist[i]/100*e:
      tmp=sugarlist[j]/(waterlist[i]+sugarlist[j])
      if density <= tmp:
        density = tmp
        ans1=waterlist[i]+sugarlist[j]
        ans2=sugarlist[j]
        
print(ans1,ans2)