Harryxun/stf_run huggingface dataset:
X,Y,A,B,C = map(int, input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p = sorted(p)[::-1]
q = sorted(q)[::-1]
r = sorted(r)[::-1]

Ca = 0
Cb = 0
Cc = 0

ans = 0

while Ca + Cb + Cc != X + Y:
    if Ca == X:
        if q[Cb] > r[Cc]:
            ans = ans + q[Cb]
            Cb = Cb + 1
        else:
            ans = ans + r[Cc]
            Cc = Cc + 1
    else:
        if Cb == Y:
            if p[Ca] > r[Cc]:
                ans = ans + p[Ca]
                Ca = Ca + 1
            else:
                ans = ans + r[Cc]
                Cc = Cc + 1
        else:
            if p[Ca] >= q[Cb] and p[Ca] > r[Cc]:
                ans = ans + p[Ca]
                Ca = Ca + 1
            elif q[Cb] > p[Ca] and q[Cb] > r[Cc]:
                ans = ans + q[Cb]
                Cb = Cb + 1
            else:
                ans = ans + r[Cc]
                Cc = Cc + 1
print(ans)

### FIXED CODE ###

X,Y,A,B,C = map(int, input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p = sorted(p)[::-1]
q = sorted(q)[::-1]
r = sorted(r)[::-1]

Ca = 0
Cb = 0
Cc = 0

ans = 0

while Ca + Cb + Cc != X + Y:
    if Cc == C:
        if q[Cb] > p[Ca]:
            ans = ans + q[Cb]
            Cb = Cb + 1
        else:
            ans = ans + p[Ca]
            Ca = Ca + 1
    else:
        if Ca == X:
            if q[Cb] > r[Cc]:
                ans = ans + q[Cb]
                Cb = Cb + 1
            else:
                ans = ans + r[Cc]
                Cc = Cc + 1
        else:
            if Cb == Y:
                if p[Ca] > r[Cc]:
                    ans = ans + p[Ca]
                    Ca = Ca + 1
                else:
                    ans = ans + r[Cc]
                    Cc = Cc + 1
            else:
                if p[Ca] >= q[Cb] and p[Ca] > r[Cc]:
                    ans = ans + p[Ca]
                    Ca = Ca + 1
                elif q[Cb] > p[Ca] and q[Cb] > r[Cc]:
                    ans = ans + q[Cb]
                    Cb = Cb + 1
                else:
                    ans = ans + r[Cc]
                    Cc = Cc + 1
print(ans)
n=int(input())
s=list(input())
sharp=[]
dot=[]
c=s[0]
if s[0]!=".":
    dot.append(0)
cnt=1
i=0
while i<n-1:
    while True:
        if s[i+1]==s[i]:
            cnt+=1
            i+=1
            if i>=n-1:
                if s[i-1]==".":
                    dot.append(cnt)
                else:
                    sharp.append(cnt)
                break
        else:
            if s[i]==".":
                dot.append(cnt)
            else:
                sharp.append(cnt)
            i+=1
            cnt=1
            break
if s[-2]!=s[-1]:
    if s[-1]==".":
        dot.append(1)
    else:
        sharp.append(1)
if len(dot)>len(sharp):
    sharp.append(0)
ans=sum(dot[1:])
tmp=0
for i in range(len(dot)-1):
    tmp=ans-dot[i+1]+sharp[i]
    ans=min(tmp,ans)
print(ans)

### FIXED CODE ###

n=int(input())
s=list(input())
sharp=[0]*n
dot=[0]*n
if s[0]=="#":
    sharp[0]+=1
else:
    dot[0]+=1
for i in range(1,n):
    if s[i]=="#":
        sharp[i]=sharp[i-1]+1
        dot[i]=dot[i-1]
    else:
        sharp[i]=sharp[i-1]
        dot[i]=dot[i-1]+1
MIN=3*10**6
for i in range(n):
    if s[i]=="#":
        MIN=min(MIN,(sharp[i]-1)+(dot[-1]-dot[i]))
    else:
        MIN=min(MIN,sharp[i]+(dot[-1]-dot[i]))
print(MIN)
#繰り返し２乗法
def modPow(a, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        halfP = p // 2
        half = modPow(a, halfP)
        return half * half % mod
    else:
        return a * modPow(a, p-1) % mod

def perm(n, k):
    return fact[n] * ifact[n-k] % mod

def dfs(v, p):
    global ans
    for nv in link[v]:
        if nv == p:
            continue
        dfs(nv, v)
    # p = -1の時は根である。根も含めて塗り分け方を考えるので、
    # n = K、c = 子の数+根の数で塗り分け方を求める
    # 見るのが子の時はその上の頂点とその親が塗られているので、
    # n = K-2、c = 子の数となる
    if p == -1:
        n = K
    else:
        n = K - 2
    if p == -1:
        k = len(link[v]) + 1
    else:
        k = len(link[v]) - 1
        
    ans *= perm(n, k)
    ans %= mod

N, K = map(int, input().split())
link = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    link[a-1].append(b-1)
    link[b-1].append(a-1)

mod = 10 ** 9 + 7
ans = 1

fact = [0] * (10**5+1)
fact[0] = 1
fact[1] = 1
for i in range(2, 10**5+1):
    fact[i] = fact[i-1] * i
    fact[i] %= mod
ifact = [0] * (10**5+1)
for i in range(10**5+1):
    ifact[i] = modPow(fact[i], mod-2)
    ifact[i] %= mod

dfs(0, -1)

print(ans % mod)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def perm(n, k):
    if n < 0:
        return 0
    if k > n:
        return 0
    return fact[n] * ifact[n-k] % mod

def dfs(v, p):
    global ans
    for nv in link[v]:
        if nv == p:
            continue
        dfs(nv, v)
    # p = -1の時は根である。根も含めて塗り分け方を考えるので、
    # n = K、c = 子の数+根の数で塗り分け方を求める
    # 見るのが子の時はその上の頂点とその親が塗られているので、
    # n = K-2、c = 子の数となる
    if p == -1:
        n = K
    else:
        n = K - 2
    if p == -1:
        k = len(link[v]) + 1
    else:
        k = len(link[v]) - 1

    ans *= perm(n, k)
    ans %= mod

N, K = map(int, input().split())
link = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    link[a-1].append(b-1)
    link[b-1].append(a-1)

mod = 10 ** 9 + 7
ans = 1

fact = [0] * (10**5+1)
fact[0] = 1
fact[1] = 1
for i in range(2, 10**5+1):
    fact[i] = fact[i-1] * i
    fact[i] %= mod
ifact = [0] * (10**5+1)
for i in range(10**5+1):
    ifact[i] = pow(fact[i], mod-2, mod)
    ifact[i] %= mod

dfs(0, -1)

print(ans % mod)
n = int(input())
a,b,c = input(),input(),input()

ans = 0
for i in range(n):
	cnt = len(set(a[i],b[i],c[i]))-1
	ans += cnt

print(ans)


### FIXED CODE ###


n = int(input())
a = input()
b = input()
c = input()

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

print(ans)
import sys

n, y = list(map(int, sys.stdin.readline().strip().split(" ")))

t_list = []

for a in range(n + 1):
    for b in range(n-i+1):
        #t_list.append((n-i-j, j, i))
        c = n-a-b
        if 10000 * a + 5000 * b + 1000 * c == y:
            print(" ".join([str(a), str(b), str(c)]))
            sys.exit()

print("-1 -1 -1")


### FIXED CODE ###

import sys

n, y = list(map(int, sys.stdin.readline().strip().split(" ")))

t_list = []

for a in range(n + 1):
    for b in range(n-a+1):
        #t_list.append((n-i-j, j, i))
        c = n-a-b
        if 10000 * a + 5000 * b + 1000 * c == y:
            print(" ".join([str(a), str(b), str(c)]))
            sys.exit()

print("-1 -1 -1")
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
k = []
for _ in range(m):
    k.append(list(map(int, input().split())))
p = list(map(int, input().split()))

denkyu = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
memo = []
memos = []


def erabu(i, n, c, d):
    if (i > len(k[d][1:])):
        if(c % 2 == p[d]):
            memo.append(n)
        return
    if(i+1 in k[d][1:]):
        erabu(i+1, n.append(i+1), c+1, d)
    erabu(i + 1, n, c, d)


print(memo)

for i in range(m):
    erabu(0, 0, 0, i)
    memos.append(memo)

# for i in range(len(memos[0])):

# def isOK(i, n):
 #   if (n ^ memos[i][j] not 0)


### FIXED CODE ###

n, m = map(int, input().split())
switches = []
for _ in range(m):
    switches.append(list(map(int, input().split()))[1:])
p = list(map(int, input().split()))

ans = 0
switchState = [0]*n


def dfs(i, tukeru):
    #print(i, tukeru)
    if(i == n):
        sumOfTento = 0
        for denkyu in range(m):
            sumOfswitch = 0
            for switch in switches[denkyu]:
                sumOfswitch += switchState[switch-1]
            if(sumOfswitch % 2 == p[denkyu]):
                sumOfTento += 1
        # print(switchState)
        if(sumOfTento == m):
            return 1
        else:
            return 0
    switchState[i] = tukeru
    return dfs(i+1, 0) + (dfs(i+1, 1) if i != n-1 else 0)


print(dfs(0, 0)+dfs(0, 1))
N = int(input())

l1 = 2 ** 30
p6 = [1] * 6
p9 = [1] * 5
for i in range(1,7):
    p6[i] = p6[i-1] * 6
    if i < 6 : p9[i] = p9[i-1] * 9

dp = [l1] * (N+1)
dp[0] = 0

for i in range(1,N+1):
    for j in p6:
        if j>i: break
        dp[i] = min(dp[i],dp[i-j]+1)
        
    for j in p9:
        if j>i: break
        dp[i] = min(dp[i],dp[i-j]+1)
        
print(dp[N])

### FIXED CODE ###

N = int(input())

l1 = 2 ** 30
p6 = [1] * 7
p9 = [1] * 6
for i in range(1,7):
    p6[i] = p6[i-1] * 6
    if i < 6 : p9[i] = p9[i-1] * 9

dp = [l1] * (N+1)
dp[0] = 0

for i in range(1,N+1):
    for j in p6:
        if j>i: break
        dp[i] = min(dp[i],dp[i-j]+1)
        
    for j in p9:
        if j>i: break
        dp[i] = min(dp[i],dp[i-j]+1)
        
print(dp[N])
from collections import Counter
N = int(input())
A = list(map(int, input().split(" ")))
def nck(n, k):
    if k > n:
        return 0
    else:
        return factorial(n)//(factorial(n-k)*factorial(k))

def factorial(n):

    if n<= 1:
        return 1
    else:
        return n*factorial(n-1)


for i in range(len(A)):
    total =0
    m = Counter(A[:i] + A[i+1:])
    for key, value in m.items():
        total += nck(value, 2)

    # print(uniquethings*(uniquethings)//2)
    print(total)



### FIXED CODE ###

from collections import Counter

N = int(input())
A = list(map(int, input().split(" ")))
m = Counter(A)
def nck(n, k): 
    C = [[0 for x in range(k+1)] for x in range(n+1)] 
  
    # Calculate value of Binomial Coefficient in bottom up manner 
    for i in range(n+1): 
        for j in range(min(i, k)+1): 
            # Base Cases 
            if j == 0 or j == i: 
                C[i][j] = 1
  
            # Calculate value using previously stored values 
            else: 
                C[i][j] = C[i-1][j-1] + C[i-1][j] 
  
    return C

most_common,num_most_common = m.most_common(1)[0]
CHOOSE_MATRIX = nck(num_most_common, 2)
total = 0
for key, value in m.items():
        # if key == A[i]:
        #     continue
        # else:
    total += CHOOSE_MATRIX[value][2]


for i in range(len(A)):
    newtotal = total
    # m[A[i]] -= 1
    # for key, value in m.items():
    #     # if key == A[i]:
    #     #     continue
    #     # else:
    #     total += CHOOSE_MATRIX[value][2]
    # m[A[i]] += 1
    tosubtract = CHOOSE_MATRIX[m[A[i]]][2]
    newtotal -= tosubtract
    newtotal += CHOOSE_MATRIX[m[A[i]]- 1][2]
    print(newtotal)
    # print(uniquethings*(uniquethings)//2)
    # print(total)
N, M =map(int, input().split())
A = [[] for i in range(10**5+1)]

for i in range(M):
    a, b = map(int,input().split())
    A[a].append(-b)

work_cand = []
sum = 0

for i in range(M+1):
    add_jobs = A[i]
    if len(add_jobs) != 0:
        for j in add_jobs:
            heapq.heappush(work_cand, j)
    sum += heapq.heappop(work_cand)
ans = -(sum)
print(ans)

### FIXED CODE ###

import heapq
N, M =map(int, input().split())
A = [[] for i in range(10**5+1)]
 
for i in range(N):
    a, b = map(int,input().split())
    if a > M:
        continue
    A[a].append(-b)
 
work_cand = []
sum = 0
 
for i in range(M+1):
    add_jobs = A[i]
    if len(add_jobs) != 0:
        for j in add_jobs:
            heapq.heappush(work_cand, j)
    if len(work_cand) == 0:
        continue
    sum += heapq.heappop(work_cand)
ans = -(sum)
print(ans)
a,b=int(input().split())
print(a*b, 2*(a+b))


### FIXED CODE ###

a,b=map(int,input().split())
print(a*b, 2*(a+b))
def gcd(x,y):
	if x < y:
		x,y = y,x
	while y > 0:
		r = x % y
		x = y
		y = r
	return x

N=int(input())
T=[0]*N
for i in range(N):
	T[i] = int(input())

curr=1
ans=1
for i in range(N):
	g=gcd(curr,T[i])
	ans=curr*T[i]/g
	curr=ans

print(int(ans))

### FIXED CODE ###

def gcd(x,y):
	if x < y:
		x,y = y,x
	while y > 0:
		r = x % y
		x = y
		y = r
	return x

def lcm(x,y):
	return x * y // gcd(x,y)

N=int(input())
T=[0]*N
for i in range(N):
	T[i] = int(input())

ans=1
for i in range(N):
	ans=lcm(ans,T[i])

print(int(ans))
def main():
    from itertools import accumulate as ac
    from bisect import bisect_left as bl
    from bisect import bisect_right as br
    from sys import stdin
    input=stdin.readline

    def check(k):
        dist=a[-k-1]-ini
        if dist<0:
            dist=abs(dist)
            return k>=br(a,ini+dist)-bl(a,ini-dist)-1
        else:
            return k>=br(a,ini+dist)-bl(a,ini-dist)
    
    n,q=map(int,input().split())
    nn=n//2+1
    a=list(map(int,input().split()))
    x=[int(input()) for _ in [0]*q]
    ix=sorted([[i,j] for i,j in enumerate(x)],key=lambda x:x[1])
    ans=[0]*n
    aac=[0]+list(ac(a))
    aac2=[0]+list(ac(a[(n+1)%2::2]))
    k=nn-1

    for i,ini in ix:
        l=1
        u=k+1
        while l+1<u:
            med=(l+u)//2
            if check(med):u=med
            else:l=med+1
        if check(l):k=l
        else:k=u
        ans[i]=aac[-1]-aac[-k-1]+aac2[-k-1]
    for i in ans:
        print(i)
main()

### FIXED CODE ###

def main():
    from itertools import accumulate as ac
    from bisect import bisect_left as bl
    from bisect import bisect_right as br
    from sys import stdin
    input=stdin.readline

    def check(k):
        dist=a[-k-1]-ini
        if dist<0:
            dist=abs(dist)
            return k>=br(a,ini+dist)-bl(a,ini-dist)-1
        else:
            return k>=br(a,ini+dist)-bl(a,ini-dist)
    
    n,q=map(int,input().split())
    nn=n//2+1
    a=list(map(int,input().split()))
    x=[int(input()) for _ in [0]*q]
    ix=sorted([[i,j] for i,j in enumerate(x)],key=lambda x:x[1])
    ans=[0]*q
    aac=[0]+list(ac(a))
    aac2=[0]+list(ac(a[(n+1)%2::2]))
    k=nn

    for i,ini in ix:
        l=1
        u=k
        while l+1<u:
            med=(l+u)//2
            if check(med):u=med
            else:l=med+1
        if check(l):k=l
        else:k=u
        ans[i]=aac[-1]-aac[-k-1]+aac2[-k-1]
    for i in ans:
        print(i)
main()
N, K = map(int, input().split())
Alist = list(map(int, input().split()))

gone = []

isLooped = False


def dfs(index):
    global isLooped
    if index in gone:
        isLooped = True
        return

    gone.append(index)
    dfs(Alist[index-1])


dfs(1)

last = gone[-1]

if isLooped:
    loopStartIndex = gone.index(Alist[last-1])
    divK = K % len(gone[loopStartIndex:])
    print(divK)
    if divK < loopStartIndex:
        print(gone[divK])
    else:
        (gone[divK+1])


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
s = []
ord = [-1 for i in range(n+1)]
v = 1
c = 1
l = 0
while ord[v] == -1:
    ord[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - ord[v]
l = ord[v]
if k < l:
    print(s[k])
else:
    k -= l
    k %= c
    print(s[l+k])
a=int(str(n)[-1])

if a == 2, 4, 5, 7, 9:
  return "hon"
elif a == 0, 1, 6 or 8:
  return "pon"
else:
  return "bon"

### FIXED CODE ###

n = int(input())
a=int((str(n))[-1])
hon=[2,4,5,7,9]
pon=[0,1,6,8]
if a in hon:
  print("hon")
elif a in pon :
  print("pon")
else:
  print("bon")
import sys
n= int(input())
an = list(map(int, sys.stdin.readline().split()))
ans = [0]*n
for i in range(n):
    ans[an[i]-1] = i+1

print(' '.join(ans))

### FIXED CODE ###

import sys
n= int(input())
an = list(map(int, sys.stdin.readline().split()))
ans = [0]*n
for i in range(n):
    ans[an[i]-1] = i+1

print(*ans)
n=int(input())
a=list(map(int,input().split()))
x=max(a)
y=a.index(x)
del a[y]
z=max(a)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    print(z)
  


### FIXED CODE ###

n=int(input())
a=[]

for j in range(0,n):
  a.append(int(input()))
  
x=max(a)
y=a.index(x)
del a[y]
z=max(a)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    print(z)
n = int(input())
l = [input() for i in range(n)]
a = 0
b = 0
ba = 0
ab = 0
for i in range(n):
    if 'AB' in l[i]:
        for j in range(len(l[i])-1):
            if l[i][j] == 'A' and l[i][j+1] == 'B':
                ab += 1
    if l[i][0] =='B' and l[i][-1] == 'A':
        ba += 1
    elif l[i][-1] == 'A':
        a += 1
    elif l[i][0] == 'B':
        b += 1
if max(a,b) == 0　and ba <= 1:
    print(ab)
elif max(a,b) == 0:
    print(ab+ba-1)
else:
    print(min(a,b)+ab+ba)

### FIXED CODE ###

n,k = map(int, input().split())
print(n-k+1)
import sys
lines = [map(int, line.strip().split(' ')) for line in sys.sydin]
print(sum([1 for h,w in lines[1:] if lines[1] <= h and lines[2] <= w]))


### FIXED CODE ###

import sys
lines = [list(map(int, line.strip().split(' '))) for line in sys.stdin]
print(sum([1 for h,w in lines[1:] if lines[0][1] <= h and lines[0][2] <= w]))
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=1000000007
    print(dp(0))
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    print(mod)
    if(index>N):return 0
    if(index==N):memo[index]=1
    if(A.count(index)>0):memo[index]=0
    if memo[index]==-1:
        memo[index]=(dp(index+1)+dp(index+2))%mod
    return memo[index]

main()


### FIXED CODE ###

# coding: utf-8
import os
import time
import re
import math


def main():
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[0]*(N+1)
    memo[0]=1
    ban=[False]*(N+1)
    for a in A:
        ban[a]=True
    mod=1000000007
    for a in range(1,N+1):
        if ban[a]:
            memo[a]=0
        else:
            if a>1:
                memo[a]=(memo[a-1]+memo[a-2])%mod
            else:
                memo[a]=1



    print(memo[-1]%mod)
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#


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

num = [0]*100
for i in range(n):
    num[d[i]] += 1

ans = 0
for i in range(100):
    if num[i] > 0:  # num[i] == 1　の方が直観的に理解しやすいかも
        ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
mochi = set()
for i in range(N):
	r = int(input())
	mochi.add(r)

print(len(mochi))
import sys
s=input()
t=input()
if s==t:
  print("No")
  sys.exit()
S=list(s)
T=list(t)
for i in s:
  if i in t:
    S.remove(i)
    T.remove(i)
S.sort()
T.sort()
a="".join(S)
b="".join(T)
if b=="":
  print("No")
  sys.exit()
if a=="":
  print("Yes")
  sys.exit()
for j in b:
  if ord(a[0])<ord(j):
    print("Yes")
    break
else:
  print("No")

### FIXED CODE ###

s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
s="".join(s)
t="".join(t)
for i in range(min(len(s),len(t))):
  if ord(s[i])==ord(t[i]):
    continue
  elif ord(s[i])<ord(t[i]):
    print("Yes")
    break
  else:
    print("No")
    break
else:
  if len(s)<len(t):
    print("Yes")
  else:
    print("No")
n = int(input())
A = list(map(int, input().split()))
 
int ans = 1
 
for i in A:
  ans = ans*i
  if ans > 10**18:
    ans = -1
    break
    
print(ans)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
 
ans = 1
 
if 0 in A:
  ans = 0
else:
  for i in A:
    ans = ans*i
    if ans > 10**18:
      ans = -1
      break
print(ans)
def solve(string):
    ins = string.split("\n")
    h, w = map(int, ins[0].split(" "))
    a = [list(map(int, _i.split(" "))) for _i in ins[1:]]
    move = []
    for j, _a in enumerate(a):
        for i, _ in enumerate(_a):
            if _a[i] % 2 == 0:
                continue
            if sum(_a) % 2 == 0:
                _a[i] -= 1
                _a[i + 1] += 1
                move.append("{} {} {} {}".format(j+1, i+1, j+1, i+2))
            else:
                _a[i] -= 1
                a[j+1][i] += 1
                move.append("{} {} {} {}".format(j+1, i+1, j+2, i+1))
    return "{}\n{}".format(len(move), "\n".join(move))


if __name__ == '__main__':
    line = input()
    tmp = [line]
    for _ in range(int(line[0])):
        tmp.append(input())
    print(solve('\n'.join(tmp)))


### FIXED CODE ###

h,w = map(int,input().split())
a = []
for i in range(h):
    tmp = list(map(lambda x:int(x)%2,input().split()))
    a.append(tmp)
result = []
 
for i in range(h):
    for j in range(w-1):
        if a[i][j] == 1:
            #a[i][j] == 0
            a[i][j+1] = 1 ^ a[i][j+1]
            result.append((i+1,j+1,i+1,j+2)) 
for i in range(h-1):
    if a[i][w-1] == 1:
        a[i+1][w-1] = 1 ^ a[i+1][w-1]
        result.append((i+1,w,i+2,w))
print(len(result))
for row in result:
    print("{} {} {} {}".format(row[0],row[1],row[2],row[3]))
x = input()
print(x*x*x)

### FIXED CODE ###

x = input()
i = int(x)
print(i**3)
d=int(input())
t=int(input())
s=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")
from itertools import product

n = input()

if int(n) < 100:
    print(0)

else:
    ans = 0

    for i in range(3,len(n)+1):
        s = list(product("753",repeat=i))
        for combi in s:
            n_s = "".join(combi)
            if int(n_s) > int(n):
                continue
            if ("7" in combi) and ("5" in combi) and ("3" in combi):
                ans += 1
    
print(ans)


### FIXED CODE ###

from itertools import product

n = input()

if int(n) < 100:
    print(0)

else:
    ans = 0

    for i in range(3,len(n)+1):
        s = list(product("753",repeat=i))
        for combi in s:
            n_s = "".join(combi)
            if int(n_s) > int(n):
                continue
            if ("7" in combi) and ("5" in combi) and ("3" in combi):
                ans += 1
    
    print(ans)
n=int(input())
X=[]
Y=[]
#A=[]
#for i in range(n):
  a=int(input())
  #x=[]
  #y=[]
  #for j in range(A[i]):
    #x,y=[int(s) for s in input().split()]
  #X.append(x)
  #Y.append(y)
  
c=0
#for i in range(n):
 # l=[1]*n
  #for j in range(i, n-i):
   # if l[j]==0:continue
    #for k in range(A[j]):
   # 　　l[X[j][k]] *= Y[j][k]
#if c<l.count(1):
 # c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
n = input()
a = map(int, input().split())
ans = 0
for i in range(1:n-1):
  if a[i-1]<a[i]<a[i+1] :
    ans+=1 
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1,n-1):
  if a[i-1]<a[i]<a[i+1] or a[i-1]>a[i]>a[i+1] :
    ans+=1 
print(ans)
a,b,c,d,e,f = map(int,(input().split()))

possible_water = []
for i in range(31):
    for j in range(31):
        water = 100*a*i + 100*b*j
        if 0 < water <= f:
            possible_water.append(water)
pw = list(set(possible_water))

possible_sugar = []
for i in range(3001):
    for j in range(3001):
        sugar = c*i + 100*d*j
        if 0 < sugar <= f:
            possible_sugar.append(sugar)
ps = list(set(possible_sugar))

ans = []
for i in pw:
    for j in ps:
        if i + j <= f and j <= (i//100)*e:
            c = 100*j/(i+j)
            ans.append([c,i+j,j])

ans.sort(reverse=True)
print(ans[0][1],ans[0][2])

### FIXED CODE ###

a,b,c,d,e,f = map(int,(input().split()))

possible_water = []
for i in range(31):
    for j in range(31):
        water = 100*a*i + 100*b*j
        if 0 < water <= f:
            possible_water.append(water)
pw = list(set(possible_water))

possible_sugar = []
for i in range(3001):
    for j in range(3001):
        sugar = c*i + d*j
        if sugar <= f:
            possible_sugar.append(sugar)
ps = list(set(possible_sugar))

ans = []
for i in pw:
    for j in ps:
        if i + j <= f and j <= (i//100)*e:
            c = 100*j/(i+j)
            ans.append([c,i+j,j])

ans.sort(reverse=True)
print(ans[0][1],ans[0][2])