Harryxun/stf_run huggingface dataset:
#input = raw_input

res = None
G = None

def dfs(jibun_v, p, jibun_c):
    global res
    global G

    res[jibun_v] = jibun_c
    #print(jibun_v, p, jibun_c)

    tonari_nodes = G[jibun_v]
    for tonari_v, w in tonari_nodes:
        #if tonari_v == p or res[tonari_v] != -1:
        if res[tonari_v] != -1:
            continue

        if w % 2 == 0:
            tonari_c = jibun_c
        else:
            tonari_c = 1 - jibun_c

        dfs(tonari_v, jibun_v, tonari_c)
    

def main():
    N= int(input())

    global G
    G = [[] for _ in range(N)]

    for i in range(N-1):
        u, v, w = map(int, input().split(" "))
        u -= 1
        v -= 1
        w = w % 2
        G[u].append([v, w])
        G[v].append([u, w])

    global res
    res = [-1 for _ in range(N)]
    
    jibun_v = 0
    p = -1
    jibun_c = 0
    dfs(jibun_v, p, jibun_c)

    for i in range(N):
        print(res[i])

main()
        

### FIXED CODE ###

import sys
if sys.version_info[0] == 2:
    input = raw_input
sys.setrecursionlimit(2 ** 31 -1)

res = None
G = None

def dfs(jibun_v, p, jibun_c):
    global res
    global G

    res[jibun_v] = jibun_c
    #print(jibun_v, p, jibun_c)

    tonari_nodes = G[jibun_v]
    for tonari_v, w in tonari_nodes:
        #if tonari_v == p: # only no loop
        #if tonari_v == p or res[tonari_v] != -1:
        if res[tonari_v] != -1:
            continue

        else:
            if w % 2 == 0:
                tonari_c = jibun_c
            else:
                tonari_c = 1 - jibun_c

            dfs(tonari_v, jibun_v, tonari_c)
    

def main():
    N= int(input())

    global G
    G = [[] for _ in range(N)]

    for i in range(N-1):
        u, v, w = map(int, input().split(" "))
        u -= 1
        v -= 1
        w = w % 2
        G[u].append([v, w])
        G[v].append([u, w])

    global res
    res = [-1 for _ in range(N)]
    
    jibun_v = 0
    p = -1
    jibun_c = 0
    dfs(jibun_v, p, jibun_c)

    for i in range(N):
        print(res[i])

main()
import numpy as np

N, K = (int(i) for i in input().split())
x = np.sort(np.array([int(i) for i in input().split()]))

result = []
if(N==1):
    print(x[0])
else:
    for i in range(N - K + 1):
        left = x[i]
        right = x[i + K - 1]

        if (left * right < 0):
            if (np.abs(left) < np.abs(right)):
                diff = np.abs(left) * 2 + np.abs(right)
            else:
                diff = np.abs(left) + np.abs(right) * 2

        else:
            diff = np.max([left, right])

        result.append(diff)

#print(result)
print(np.min(result))


### FIXED CODE ###

import numpy as np

N, K = (int(i) for i in input().split())
x = np.sort(np.array([int(i) for i in input().split()]))

result = []
if(N==1):
    print(np.abs(x[0]))

else:
    for i in range(N - K + 1):
        left = x[i]
        right = x[i + K - 1]

        if (left * right < 0):
            if (np.abs(left) < np.abs(right)):
                diff = np.abs(left) * 2 + np.abs(right)
            else:
                diff = np.abs(left) + np.abs(right) * 2

        else:
            diff = np.max([np.abs(left), np.abs(right)])

        result.append(diff)

    print(np.min(result))
def make_prime(n):
    prime = []
    temp = n
    for i in range(2, int(n**0.5) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            prime.append([i, cnt])
    if temp!=1:
        prime.append([temp, 1])
    if prime==[]:
        prime.append([n, 1])

    return prime
def factional_for(n):
    result = 1
    for i in range(n, 0, -1):
        result *= i
    return result
num = int(input())
w=10**9+7
s=1
prime_num_list = make_prime(factional_for(num))
for i in range(len(prime_num_list)):
    s *= (prime_num_list[i][1]+1)%w
print(s)

### FIXED CODE ###

def make_prime(n):
    prime = []
    temp = n
    for i in range(2, n):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            prime.append([i, cnt])
    if temp!=1:
        prime.append([temp, 1])
    if prime==[]:
        prime.append([n, 1])

    return prime


from collections import defaultdict
d=defaultdict(lambda :1)
num = int(input())
w=10**9+7
for i in range(2,num+1):
    prime_num_list = make_prime(i)
    for j in range(len(prime_num_list)):
        key = prime_num_list[j][0]
        d[key] += prime_num_list[j][1]
cnt=1
for val in d.values():
    cnt*=val%w
print(cnt%w)
n = int(input())
s = input()
slimes = list(s.split(''))
i = 0
while i < n - 1:
  s = slimes[i]
  while s == slimes[i + 1]:
    del slimes[i + 1]
    n -= 1
  i += 1
print n

### FIXED CODE ###

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

ans = 1
current = s[0]
for i in range(n):
  if current != s[i]:
    ans += 1 
    current = s[i]
print(str(ans))
#! -*- coding:utf-8 -*-

def search(values,hp,vp,stamp,fruit):
    if not (0<=hp<len(values)): return
    if not (0<=vp<len(values[0])): return
    if fruit!=values[hp][vp]: return
    fruit,values[hp][vp]=values[hp][vp],stamp
    search(values,hp-1,vp,stamp,fruit)
    search(values,hp+1,vp,stamp,fruit)
    search(values,hp,vp-1,stamp,fruit)
    search(values,hp,vp+1,stamp,fruit)

def solve(values):
    stamp=0
    for i in range(len(values)):
        for j in range(len(values[i])):
            if values[i][j] in ['@','#','*']:
                search(values,i,j,stamp,values[i][j])
                stamp+=1
    return stamp

if __name__=='__main__':
    H,W = list(map(int,input().split(' ')))
    values = list()
    for _ in range(H):
        values.append([x for x in input().strip()])
    print(solve(values))

### FIXED CODE ###

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

import sys
sys.setrecursionlimit(10**6)

def search(field,hp,vp,item):
	if not (0<=hp<len(field)): return
	if not (0<=vp<len(field[hp])): return
	if item!=field[hp][vp]: return
	field[hp][vp]=True
	for dh,dv in [[0,1],[0,-1],[1,0],[-1,0]]:
		search(field,hp+dh,vp+dv,item)
#	search(field,hp-1,vp,item)
#	search(field,hp+1,vp,item)
#	search(field,hp,vp-1,item)
#	search(field,hp,vp+1,item)

def solve(field):
	count,valid_items=0,set(['@','#','*'])
	for i in range(len(field)):
		for j in range(len(field[i])):
			if field[i][j] in valid_items:
				search(field,i,j,field[i][j])
				count+=1
	return count

def main():
	line = input().strip()
	while line!='0 0':
		H,W = list(map(int,line.split(' ')))
		field = list()
		for _ in range(H):
			field.append(list(input().strip()))
		print(solve(field))
		line = input().strip()

if __name__=='__main__':
	main()
a,b,c = map(lambda x: int(x), input().split())
k = int(input())

for _ in range(k):
    if b <= a:
        b = 2 * b
        continue
    if c <= b:
        c = 2 * c
        continue
    print('Yes')
    sys.exit()
    
if (a < b) & (b < c):
    print('Yes')
    sys.exit()
print('No')

### FIXED CODE ###

print(10 - int(input())//200)
a,b,c,d,e,f=(int(i) for i in input().split())
w,s,num=set(),set(),0
ans=[0,0]
max_salt=int(e*f/((100+e)*1.0))
for i in range(((f-f%(a*100))//(a*100))+1):
    for j in range(((f-f%(b*100))//(b*100))+1):
        if i*a*100+j*b*100<=f:
            w.add(i*a*100+j*b*100)
        else:
            break
for i in range((max_salt-max_salt%c)//c+1):
    for j in range((max_salt-max_salt%d)//d+1):
        if i*c+j*d<=max_salt:
            s.add(i*c+j*d)
        else:break

w2,s2=sorted(list(w))[::-1],sorted(list(s))[::-1]
for i in w2:
    for j in s2:
        if 0<i+j<=f and e*i-100*j>=0 and (i+j)*num<j:
            num=j/((i+j)*1.0)
            ans[0]=i
            ans[1]=j
print(sum(ans),ans[1])

### FIXED CODE ###

N=int(input())
A=int(input())
print(N*N-A)
x, y = [int(x) for x in input().split()]

list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]

if x in list1:
	if y in list1:
		print("Yes")
	else:
		pirnt("No")
elif x in list2:
	if y in list2:
		print("Yes")
	else:
		print("No")
else:
	if y in list3:
		print("Yes")
	else:
		print("No")


### FIXED CODE ###

x, y = [int(x) for x in input().split()]

list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]

if x in list1:
	if y in list1:
		print("Yes")
	else:
		print("No")
elif x in list2:
	if y in list2:
		print("Yes")
	else:
		print("No")
else:
	if y in list3:
		print("Yes")
	else:
		print("No")
import math
a,b,x = map(int,input().split())
if x >= 1/2 * (a*a*b):
    theta = math.atan(2(a*a*b-x)/(a*a*a))
else:
    theta = 90 - math.atan(2x/(a*b*b))
print(theta)

### FIXED CODE ###

import math
a,b,x = map(int,input().split())
y = math.pi
if x >= 1/2 * (a*a*b):
    theta = math.atan(2*(a*a*b-x)/(a*a*a))
else:
    theta = y/2 - math.atan(2*x/(a*b*b))
print(theta*180/y)
x, y = map(int, input(), input())

if x*y % 2 == 0:
    print("Even")
else:
    print("Odd")


### FIXED CODE ###

x, y = map(int, input().split())

if x*y % 2 == 0:
    print("Even")
else:
    print("Odd")
x,y=input().split()
print(x+y/2)

### FIXED CODE ###

x,y=map(int,input().split())
print(x+y//2)
# %%time
import numpy as np
# N = 200000
# A_npa = np.arange(N, dtype=np.int32)
N = int(input())
A_npa = np.array(list(map(int, input().split())))
total = 0
A_unique, inverse, counts = np.unique(
    A_npa, return_inverse=True, return_counts=True)
counts = np.sum(counts*(counts-1)//2)-(counts-1)
for i in inverse:
    print(counts[i])

### FIXED CODE ###

import collections
N = int(input())
A_list = list(map(int, input().split()))
A_collection=collections.Counter(A_list)
total=0
for i in A_collection.values():
    total+=i*(i-1)//2
for k in A_list:
    print(total-(A_collection[k]-1))
alphabet = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,\
            t,u,v,w,x,y,z]
C=input()
idx=alphabet.index(C)
print(alphabet[idx+1])

### FIXED CODE ###

C=input()
al=[]
for idx in range(97,123):
  al.append(chr(idx))
idx = al.index(C)
print(al[idx+1])
n = int(input())
A = list(map(int,input().split()))
l = [[0,0],[0,0],[0,0]]
flag = 0
for i in range(n):
  x = A[i]
  for j in range(3):
    if l[j] == [0,0]:
      l[j] = [x,1]
      break
    if x == l[j][0]:
      l[j][1] += 1
      break
  else:
    break
a = l[0][1]
b = l[1][1]
c = l[2][1]
aa = l[0][0]
bb = l[1][0]
cc = l[2][0]
if n % 3 == 0:
  m = n // 3
  if a == m:
    if b == m and c == m:
      if aa ^ bb ^ cc == 0:
        flag = 1
  if a == 2 * m and b == m:
    if bb == 0:
      flag = 1
  if a == m and b == 2 * m:
    if aa == 0:
      flag = 1
else:
  if a == n and aa == 0:
    flag = 1
if a == m:
  print('Yes')

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
s = 0
for i in range(n):
  s ^= a[i]
if s == 0:
  print('Yes')
else:
  print('No')
N = int(input())
S = str(input())
count = 0
for i in range(N-2):
    if S[i] == A and S[i+1] == B and S[i+2] == C:
        count += 1
print(count)

### FIXED CODE ###

N = int(input())
S = str(input())
count = 0
for i in range(N-2):
    if S[i] == "A" and S[i+1] == "B" and S[i+2] == "C":
        count += 1
print(count)
import bisect
from collections import deque

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

a.sort()

a = deque(a)

for i in range(m):
    saidai = a.pop()
    sounyu = saidai // 2
    bisect.insort(a, sounyu)

print(sum(a))

### FIXED CODE ###

import heapq
import numpy as np

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

a.sort()
a = np.array(a)
a = -1 * a
a = list(a)
heapq.heapify(a)

for i in range(m):
    temp = heapq.heappop(a)
    temp = int(temp/2)
    heapq.heappush(a, temp)

print(-1 * sum(a))
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
n,m=map(int,input().split())
max_num=max(n,m)
s=list(input())
t=list(input())
L=lcm(n,m)
text=["0"]*(L*max_num)
judge=True
for i in range(n):
    text[i*(L//n)]=s[i]
for j in range(m):
    if text[j*(L//m)]!="0" and text[j*(L//m)]!=t[j]:
        judge=False
print(L) if judge else print(-1)
#print(len(text))


### FIXED CODE ###

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
n,m=map(int,input().split())
s=list(input())
t=list(input())
g=gcd(n,m)
a=n//g
b=m//g
judge=True
for i in range(g):
    if s[a*i]!=t[b*i]:
        judge=False
        break
print(g*a*b) if judge else print(-1)
#print(len(text))
a,b,k = map(int, input().split())
nums = list(range(a,b+1))
ans = nums[:k] + nums[len(nums)-k:]
for a in sorted(set(ans)):
    print(a)


### FIXED CODE ###

a,b,k = map(int, input().split())
tmp = []
for i in range(k):
    if a + i <= b:
        tmp.append(a+i)
    if b - i >= a:
        tmp.append(b-i)

for i in sorted(set(tmp)):
    print(i)
a=int,input()
b=int,input()
if(a%500 < b):
  print("Yes")
else:
  print("No")
    

### FIXED CODE ###

N=int(input())
A=int(input())
N!=0
B=int(N%500)
if(B <= A):
    print("Yes")
else:
    print("No")
numA, numB, numCoupon = map(int, input().split(' '))
priceA = map(int, input().split(' '))
priceB = map(int, input().split(' '))

# initial best price
bestPrice = min(priceA) + min(priceB)

for n in range(numCoupon):
  # get coupon details
  typeA, typeB, discount = map(int, input().split(' '))
  # calculate price when this coupon is used
  currentPrice = priceA[typeA-1] + priceB[typeB-1] - discount
  # update best price
  if currentPrice < bestPrice:
    bestPrice = currentPrice

print(bestPrice)


### FIXED CODE ###

numA, numB, numCoupon = map(int, input().split(' '))
priceA = list(map(int, input().split(' ')))
priceB = list(map(int, input().split(' ')))

# initial best price
bestPrice = min(priceA) + min(priceB)

for n in range(numCoupon):
  # get coupon details
  typeA, typeB, discount = map(int, input().split(' '))
  # calculate price when this coupon is used
  currentPrice = priceA[typeA-1] + priceB[typeB-1] - discount
  # update best price
  if currentPrice < bestPrice:
    bestPrice = currentPrice

print(bestPrice)
from heapq import heappush, heappop
while 1:
    N, M, L, K, A, H = map(int, raw_input().split())
    if N == 0:
        break
    F = [0]*N
    if L>0:
        for e in map(int, raw_input().split()):
            F[e] = 1
    G = [[] for i in xrange(N)]
    for i in xrange(K):
        x, y, t = map(int, raw_input().split())
        G[x].append((y, t))
        G[y].append((x, t))
    dist = [[10**18]*(M+1) for i in xrange(N)]
    dist[A][M] = 0
    que = [(0, A, M)]
    while que:
        cost, v, rest = heappop(que)
        if dist[v][rest] < cost:
            continue
        if F[v] and rest < M and cost + 1 < dist[v][rest+1]:
            dist[v][rest+1] = cost+1
            heappush(que, (cost+1, v, rest+1))
        for t, co in G[v]:
            if rest>=co and cost + co < dist[t][rest-co]:
                dist[t][rest-co] = cost + co
                heappush(que, (cost+co, t, rest-co))
    ans = min(dist[H])
    print "Help!" if ans > 10**17 else ans

### FIXED CODE ###

from heapq import heappush, heappop
while 1:
    N, M, L, K, A, H = map(int, raw_input().split())
    if N == 0:
        break
    F = [0]*N
    for e in map(int, raw_input().split()):
        F[e] = 1
    G = [[] for i in xrange(N)]
    for i in xrange(K):
        x, y, t = map(int, raw_input().split())
        G[x].append((y, t))
        G[y].append((x, t))
    dist = [[10**18]*(M+1) for i in xrange(N)]
    dist[A][M] = 0
    que = [(0, A, M)]
    while que:
        cost, v, rest = heappop(que)
        if dist[v][rest] < cost:
            continue
        if F[v] and rest < M and cost + 1 < dist[v][rest+1]:
            dist[v][rest+1] = cost+1
            heappush(que, (cost+1, v, rest+1))
        for t, co in G[v]:
            if rest>=co and cost + co < dist[t][rest-co]:
                dist[t][rest-co] = cost + co
                heappush(que, (cost+co, t, rest-co))
    ans = min(dist[H])
    print "Help!" if ans > 10**17 else ans
S = list(map(int, input().split()))
T = list(map(int, input().split()))
a=0
for i in range(3):
    if S[i]==T[i]:
        a+=1
print(a)

### FIXED CODE ###

S = input()
T = input()
a=0
for i in range(3):
    if S[i]==T[i]:
        a+=1
print(a)
N,M,K=map(int,input().split())

A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]

a=0
b=0
ans=0
books=N+M
time=0


while(1):
    if a+b==books or time>=K:
        break
    
    elif (a!=N and b!=M):
        if A[a]>B[b]:
            if time+B[b]<=K:
                time+=B[b]
                b+=1
                ans+=1
            else:
                break
        
        elif B[b]>A[a]:
            if time+A[a]<=K:
                time+=A[a]
                a+=1
                ans+=1
            else:
                break
        
        else:
            if time+A[a]>K:
                break
            else:
                tmpa=a
                tmpb=b
                while(1):
                    tmpa+=1
                    tmpb+=1
                    if A[tmpa]>B[tmpb]:
                        if time+B[b]<=K:
                            time+=B[b]
                            b+=1
                            ans+=1
                        else:
                            break
                    
                    elif A[tmpa]<B[tmpb]:
                        if time+A[a]<=K:
                            time+=A[a]
                            a+=1
                            ans+=1
                        else:
                            break
            
    elif a==N and b!=M:
        if time+B[b]<=K:
            time+=B[b]
            b+=1
            ans+=1
        else:
            break
        
    elif b==M and a!=N:
        if time+A[a]<=K:
            time+=A[a]
            a+=1
            ans+=1
        else:
            break
print(ans)

### FIXED CODE ###

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

a=[0]
b=[0]

tmp_a=0
tmp_b=0
for i in A:
    tmp_a+=i
    a.append(tmp_a)

for i in B:
    tmp_b+=i
    b.append(tmp_b)
    

ans,j=0,M
for i in range(N+1):#i…A台の本数
    if a[i]>K:
        break
    while(1):
        if b[j]<=(K-a[i]):
            break
        j-=1
    ans=max(ans,i+j)
    
print(ans)
n=list(range(1,int(input())+1))
print(sum([i for i in n if i%3!=0andi%5!=0]))


### FIXED CODE ###

n=int(input())
n=list(range(1,n+1))
n=([i for i in n if i % 3 != 0])
n=([i for i in n if i % 5 != 0])
print(sum(n))
N = int(input())
A = str(input())

if (N % 2 == 0):
  if (A[:N/2-1] == A[N/2:N-1]):
    print("Yes")
  else:
    print("No")
else:
  print("No")

### FIXED CODE ###

N = int(input())
A = str(input())

if (N % 2 == 0):
  if (A[:N//2] == A[N//2:]):
    print("Yes")
  else:
    print("No")
else:
  print("No")
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
Cm = []
Cp = []
for i in range(N):
	if(A[i]-B[i]<0):
		Cm.append(A[i]-B[i])
	elif(A[i]-B[i]>0):
		Cp.append(A[i]-B[i])
Cm.sort()
Cp.sort()


if(len(Cm) == 0):
	print(0)
	exit(1)
if(sum(Cp)<abs(sum(Cm))):
	print(-1)
	exit(1)

j=0
i = 0
nowCp = int(Cp[len(Cp)-i-1])


while(j<len(Cm)):
	if(nowCp>=abs(Cm[j])):
		nowCp -= abs(Cm[j])
		j += 1
	elif(nowCp<abs(Cm[j])):
		i += 1
		nowCp += int(Cp[len(Cp)-i-1])

	else:
		break
	

if(j == len(Cm)):
	print(j+i+1)
else:
	print(-1)


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
Cm = []
Cp = []
for i in range(N):
	if(A[i]-B[i]<0):
		Cm.append(A[i]-B[i])
	elif(A[i]-B[i]>0):
		Cp.append(A[i]-B[i])
Cm.sort()
Cp.sort()


if(len(Cm) == 0):
	print(0)
	exit(0)
if(sum(Cp)<abs(sum(Cm))):
	print(-1)
	exit(0)

j=0
i = 0
nowCp = int(Cp[len(Cp)-i-1])


while(j<len(Cm)):
	if(nowCp>=abs(Cm[j])):
		nowCp -= abs(Cm[j])
		j += 1
	elif(nowCp<abs(Cm[j]) and i<len(Cp)):
		i += 1
		nowCp += int(Cp[len(Cp)-i-1])

	else:
		break
	

if(j == len(Cm)):
	print(j+i+1)
else:
	print(-1)
A, B = map(int, input().split())
def calc(A, B):
  Amin = A/0.08
  
  if (Amin - int(Amin)) != 0.:
    Amin = int(Amin)+1
  
  Amax = int((A+1)/0.08)
  Arange = set(range(Amin, Amax))
  Bmin = B/0.1
  if (Bmin - int(Bmin)) != 0.:
    Bmin = int(Bmin)+1
  Bmax = int((B+1)/0.1)
  Brange = set(range(Bmin, Bmax))
  intersection = Arange & Brange
  if len(intersection) == 0:
    print(-1) 
  else:
    print(min(intersection))
calc(A, B)

### FIXED CODE ###

A, B = map(int, input().split())
def calc(A, B):
  Amin = A/0.08
  if (Amin - int(Amin)) != 0.:
    Amin = int(Amin)+1
  else:
    Amin = int(Amin)
  Amax = int((A+1)/0.08)
  Arange = set(range(Amin, Amax))
  Bmin = B/0.1
  if (Bmin - int(Bmin)) != 0.:
    Bmin = int(Bmin)+1
  else:
    Bmin = int(Bmin)
  Bmax = int((B+1)/0.1)
  Brange = set(range(Bmin, Bmax))
  intersection = Arange & Brange
  print(-1) if len(intersection) == 0 else print(min(intersection))
calc(A, B)
import itertools
n,m,x=map(int,input().split())
lists=[]
array=[0,0,0,0]
ans=[]
for i in range(n):
    lists.append(list(map(int,input().split())))
for i in range(n):
    for pair in itertools.combinations(lists,i+1):
        for j in range(len(pair)):
            array=list(map(lambda x,y: x+y,array,list(pair[j])))
        for k in range(m):
            if array[k+1]<x:
                break
            else:
                ans.append(array[0])
        array=[0,0,0,0]
print(min(ans) if ans else "-1")

### FIXED CODE ###

import numpy as np
n,m,x=map(int,input().split())
text=[]
cost=[]
for i in range(n):
    text.append(list(map(int,input().split())))
text=np.array(text)

#ビット全探索。bin(i)の各桁を要素に対応させる。
for i in range(2**n):
    flag=0
    bought_text=np.array([0 for j in range(m+1)])
    for j in range(n):
        #0bxxx1と0b0001の比較(＆は論理積)
        if((i>>j)&1):
            bought_text+=text[j]
    for k in range(m):
        if bought_text[k+1]<x:
            flag=1
            break
    if flag==0:
        cost.append(bought_text[0])
print(min(cost) if cost else "-1")
a=[input() for i in range(2)]

a_num=a[1]
a_num=a_num.split()
a_list=[int(n) n in a_num]

a_mul=1

for i in a_list:
	a_mul*=i

if a_mul>10**18:
	a_mul=-1

print(a_mul)



### FIXED CODE ###

a=input()
a=a.split()

print(int(a[0])*int(a[1]))