Harryxun/stf_run huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N, Y;
    cin >> N >> Y;

    for(int x = 0; x <= N; x++){
        for(int y = 0; y <= N - x; y++){
            int z = N - x - y;
            if((10000*x + 5000*y + 1000*z) == sum)
                cout << x << ' ' << y << ' ' << z << endl;
            else
                cout << -1 << ' ' << -1 << ' ' << -1 << endl;
        }
    }
}


### FIXED CODE ###

N, sum = [int(i) for i in input().split()]

for x in range(N+1):
	for y in range(N+1 - x):
		z = N - x - y
		if 10000*x + 5000*y + 1000*z == sum:
			print(x, y, N - x - y)
			exit()
print(-1, -1, -1)
def binary_search(key):
    '''
    条件を満たす最小/最大のindexを求める
    '''
    ok = 10 ** 9 + 1  # 条件を満たすindexの上限値/下限値
    ng = -1           # 条件を満たさないindexの下限値/上限値
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2

        if isOK(mid, key):  # midが条件を満たすか否か
            ok = mid
        else:
            ng = mid
    
    return ok


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

print(binary_search(k))

### FIXED CODE ###

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

hi = 10 ** 9
lo = 0
while hi - lo > 1:
    mid = (hi + lo) // 2

    cnt = 0
    for v in a:
        cnt += (v + mid - 1) // mid - 1

    if cnt <= k:
        hi = mid
    else:
        lo = mid

print(hi)
A,B = list(map(int,input().split()))
import math
if A == 0 and B != 0:
  D = math.factorial(B-2)
  F = math.factorial(B) // 2// D
  print(F)
  exit()
if A != 0 and B == 0:
  C = math.factorial(A-2)
  E = math.factorial(A) // 2// C
  print(E)
  exit()
if A == 0 and B == 0:
  print(0)
  exit()
C = math.factorial(A-2)
D = math.factorial(B-2)
E = math.factorial(A) // 2// C
F = math.factorial(B) // 2// D
print(E+F)

### FIXED CODE ###

A,B = list(map(int,input().split()))
import math
if A == 0 and B != 0:
  D = math.factorial(B-2)
  F = math.factorial(B) // 2// D
  print(F)
  exit()
if A != 0 and B == 0:
  C = math.factorial(A-2)
  E = math.factorial(A) // 2// C
  print(E)
  exit()
if A == 0 and B == 0:
  print(0)
  exit()
elif A == 1 and B != 1:
  D = math.factorial(B-2)
  F = math.factorial(B) // 2// D
  print(F)
  exit()
elif A != 1 and B == 1:
  C = math.factorial(A-2)
  E = math.factorial(A) // 2// C
  print(E)
  exit()
elif A == 1 and B == 1:
  print(0)
  exit()
C = math.factorial(A-2)
D = math.factorial(B-2)
E = math.factorial(A) // 2// C
F = math.factorial(B) // 2// D
print(E+F)
r, c = [int(i) for i in input().split()]

data = []

for ri in range(r):
    data[ri].append([int(i) for i in input().split()])
    data[ri].append(sum(data[ri]))

from pprint import pprint
pprint(data)

### FIXED CODE ###

r, c = [int(i) for i in input().split()]

data = []
sum_row = [0] * (c + 1)

for ri in range(r):
    data.append([int(i) for i in input().split()])
    data[ri].append(sum(data[ri]))
    print(" ".join([str(d) for d in data[ri]]))
    for ci in range(c + 1):
        sum_row[ci] += data[ri][ci]
        
print(" ".join([str(s) for s in sum_row]))
a,b=int(input().split(' '))

ans = 0
if a>=2:
    ans += a*(a-1)//2
if b>=2:
    ans += b*(b-1)//2
print(ans)    


### FIXED CODE ###

a,b=map(int, input().split(' '))
 
ans = 0
if a>=2:
    ans += a*(a-1)//2
if b>=2:
    ans += b*(b-1)//2
print(ans)
#!/usr/bin/env python

import math


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

    A, B = B, A

    if A == B == 1:
        print(1, 2)
        print('.#')

    N = 50 if max(A, B) >= 50 else max(A, B)

    ans = []
    if A != 1:
        if B != 1:
            a = A - 1
        else:
            a = A
        while a > 0:
            tmp = []
            for i in range(N):
                if a <= 0:
                    tmp.append('..')
                else:
                    # print('#.', end='')
                    tmp.append('#.')
                    a -= 1
            ans.append(''.join(tmp))
            ans.append('.' * N * 2)
    if B != 1:
        if A != 1:
            b = B - 1
        else:
            b = B
        ans.append('#' * N * 2)
        while b > 0:
            tmp = []
            for i in range(N):
                if b <= 0:
                    tmp.append('##')
                else:
                    tmp.append('.#')
                    b -= 1
            ans.append(''.join(tmp))
            ans.append('#' * N * 2)
    print(len(ans), len(ans[0]))
    for l in ans:
        print(l)


if __name__ == '__main__':
    # print(main())
    main()

### FIXED CODE ###

#!/usr/bin/env python

import math


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

    A, B = B, A

    if A == B == 1:
        print(1, 2)
        print('.#')
        return

    N = 50 if max(A, B) >= 50 else max(A, B)

    ans = []
    if A != 1:
        if B != 1:
            a = A - 1
        else:
            a = A
        while a > 0:
            tmp = []
            for i in range(N):
                if a <= 0:
                    tmp.append('..')
                else:
                    # print('#.', end='')
                    tmp.append('#.')
                    a -= 1
            ans.append(''.join(tmp))
            ans.append('.' * N * 2)
    if B != 1:
        if A != 1:
            b = B - 1
        else:
            b = B
        ans.append('#' * N * 2)
        while b > 0:
            tmp = []
            for i in range(N):
                if b <= 0:
                    tmp.append('##')
                else:
                    tmp.append('.#')
                    b -= 1
            ans.append(''.join(tmp))
            ans.append('#' * N * 2)
    print(len(ans), len(ans[0]))
    for l in ans:
        print(l)


if __name__ == '__main__':
    # print(main())
    main()
a,b=map(int,input().split())
if a==3,b==1 :
  print(2)
elif a==1,b==2 :
  print(3)
elif a==2,b==3 :
  print(1)


### FIXED CODE ###

a=int(input())
b=int(input())
if a==3 and b==1 :
  print(2)
elif a==1 and b==2 :
  print(3)
elif a==2 and b==3 :
  print(1)
elif a==3 and b==2 :
  print(1)
elif a==1 and b==3 :
  print(2)
elif a==2 and b==1 :
  print(3)
#coding: utf-8

import sys
import math

l = []
for line in sys.stdin:
    l.append(int(line))

check = 0
point_list = []
for i in range(len(l)):
    if check == 0:
        last_row = i + l[n]
        check = 1
        continue
    else:
        point_list.append(i)
        if i == last_row:
            point_list.sort()
            point_list = point_list[1:-1]
            ave = sum(point_list)/len(point_list)
            print math.floor(ave)
            check = 0

### FIXED CODE ###

while True:
    n = int(raw_input())
    if n == 0:
        break
    else:
        l = []
        for i in range(n):
            num = int(raw_input())
            l.append(num)
            l.sort()
        l = l[1:-1]
        ave = float(sum(l))/len(l)
        print int(ave)
# input
N = int(input())
Ps = list(map(float, input().split()))

# probs[i][k] : コインiまでを投げて表がk枚出る確率
probs = [[None for _ in range(N+1)] for _ in range(N)]

probs[0][1] = Ps[0]
probs[0][0] = 1 - Ps[0]
for i in range(2, N+1):
  probs[0][i] = 0

sum_all = 0
sum_ok  = 0
start = int(N/2) + 1

for i in range(1, N):
  for k in range(0, N+1):
    if k == 0:
      probs[i][k] = probs[i-1][k]*(1-Ps[i])
    else:
      probs[i][k] = probs[i-1][k-1]*Ps[i] + probs[i-1][k]*(1-Ps[i])
    if i == N - 1:
      sum_all += probs[i][k]
      if k >= start:
        sum_ok += probs[i][k]


# print(probs)

# sum_all = sum(probs[N-1])
# sum_ok = 0

# start = int(N/2) + 1
# for i in range(start, N+1):
#   sum_ok += probs[N-1][i]

print(sum_ok / sum_all)


### FIXED CODE ###

# input
N = int(input())
Ps = list(map(float, input().split()))

# probs[i][k] : コインiまでを投げて表がk枚出る確率
probs = [[0 for _ in range(N+1)] for _ in range(N)]

probs[0][1] = Ps[0]
probs[0][0] = 1 - Ps[0]
# for i in range(2, N+1):
#   probs[0][i] = 0

for i in range(1, N):
  for k in range(0, N+1):
    if k == 0:
      probs[i][k] = probs[i-1][k]*(1-Ps[i])
    else:
      probs[i][k] = probs[i-1][k-1]*Ps[i] + probs[i-1][k]*(1-Ps[i])

# print(probs)

sum_all = sum(probs[N-1])
sum_ok = 0

start = int(N/2) + 1
for i in range(start, N+1):
  sum_ok += probs[N-1][i]

print(sum_ok / sum_all)
S = input()
if(A[:4] == "YAKI"):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

S = input()
if(len(S) >= 4 and S[:4] == "YAKI"):
    print("Yes")
else:
    print("No")
#D
from heapq import heappush,heappop
from collections import deque
n,k=map(int,input().split())
v=deque(list(map(int,input().split())))
w=[[] for i in range(n)]
answer=-100000000
for i in range(k+1):
    for j in range(k-i+1):
        h=[]
        for a in range(i):
            heappush(h,v[a])
        for a in range(j):
            heappush(h,v[n-1-a])
        for a in range(k-i-j):
            if h and h[0]<0:
                heappop(h)
            else:
                break
        answer=max(answer,sum(h))
print(answer)

### FIXED CODE ###

#D
from heapq import heappush,heappop
from collections import deque
import sys
n,k=map(int,input().split())
v=deque(list(map(int,input().split())))
w=[[] for i in range(n)]
answer=-100000000
for i in range(min(n+1,k+1)):
    for j in range(min(n-i+1,k-i+1)):
        h=[]
        
        for a in range(i):
            heappush(h,v[a])
        for a in range(j):
            heappush(h,v[n-1-a])
        for a in range(k-i-j):
            if h and h[0]<0:
                heappop(h)
            else:
                break
        answer=max(answer,sum(h))
print(answer)
if a/3 == 0 or b/3 == 0 or (a+b)/3 == 0:
  print("Possible")
else :
  print("Inpossible")


### 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")
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

memo = {}
s = set()

ans = 0
def dfs(idx, money, stocks):
    global ans
    if idx==N:
        ans = max(ans, money)
        return
    a = As[idx]
    if (idx, stocks) in s:
        if money<=memo[(idx, stocks)]:
            return
    s.add((idx, stocks))
    for num in range(1, stocks+1):
        dfs(idx+1, money+a*num, stocks-num)
    cnt = 0
    while money>=0:
        dfs(idx+1, money, stocks+cnt)
        cnt += 1
        money -= a

dfs(0, 1000, 0)
print(ans)

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

memo = {}
s = set()

ans = 0
def dfs(idx, money, stocks):
    global ans
    if idx==N:
        ans = max(ans, money)
        return
    a = As[idx]
    if (idx, stocks) in s:
        if money<=memo[(idx, stocks)]:
            return
    s.add((idx, stocks))
    memo[(idx, stocks)] = money
    dfs(idx+1, money+stocks*a, 0)
    dfs(idx+1, money, stocks)
    cnt = money//a
    dfs(idx+1, money-cnt*a, stocks+cnt)

dfs(0, 1000, 0)
print(ans)
import sys

N = input().split()

N[0] = int(N[0])
N[1] = int(N[1])
N[2] = int(N[2])



if(N[1] > N[2]):
    print("0")
    exit(1)

print((N[2] * (N[0] -1) + N[1]) - (N[1] * (N[0] - 1) + N[2]) + 1)

### FIXED CODE ###

N = input().split()

N[0] = int(N[0])
N[1] = int(N[1])
N[2] = int(N[2])

if(N[0] == 1):
    if(N[1] == N[2]):
        print("1")
        exit()
    print("0")
    exit()

if(N[1] > N[2]):
    print("0")
    exit()

print((N[2] * (N[0] -1) + N[1]) - (N[1] * (N[0] - 1) + N[2]) + 1)
N, K = map(int, input().split())
towns = [int(i) for i in input().split()]
arrivedList = [1]
loopCount = 0
previous = 0
for i in range(len(towns)):
    idx = arrivedList[len(arrivedList) - 1] - 1
    current = towns[idx]
    if arrivedList.count(current) == 0:
        arrivedList.append(current)
    else:
        previous = len(arrivedList) - (len(arrivedList)-arrivedList.index(current))
        loopCount = len(arrivedList)-arrivedList.index(current)
        print(previous,current, loopCount, arrivedList)
        break
    if i == K - 1:
        print(arrivedList[len(arrivedList) - 1])
        exit()
remain = K % loopCount - previous
loopList = arrivedList[previous: previous + loopCount]
print(loopList[remain])

### FIXED CODE ###

# 必ずN回以下でループする
N, K = map(int, input().split())
towns = [int(i) for i in input().split()]
arrivedList = [1]
for i in range(N * 2):
    arrivedList.append(towns[arrivedList[-1] - 1])
if K <= N:
    print(arrivedList[K])
    exit()

loop_end = N
loop_start = N - 1
while (arrivedList[loop_end] != arrivedList[loop_start]):
    loop_start -= 1

loop_len = loop_end - loop_start

# Kの値をloop_lenを使って調整する
K = K % loop_len
while K < N:
    K += loop_len

print(arrivedList[K])
N=int(input())
H=list(map(int, input().split()))

can_move = 0
move = 0

for i in range(N):
    if i == N-1:
        break
    elif H[i] >= H[i+1]:
        move += 1
        if can_move <= move:
            can_move = move
    else:
        move = 0

print(can_move)

### FIXED CODE ###

i = input()
j = input()
cnt = 0
for k in range(3):
    if i[k]==j[k]:
       cnt+=1

print(cnt)
import sys


def InS(): return input()


def InL(): return list(map(int, input().split()))


def InI(): return int(input())


N, K = InL()
H = InL().sort()

if K >= N:
    print(0)
    sys.exit()

print(sum(H[0:N-K]))


### FIXED CODE ###

import sys


def InS(): return input()


def InL(): return list(map(int, input().split()))


def InI(): return int(input())


N, K = InL()
H = InL()
H.sort()

if K >= N:
    print(0)
    sys.exit()
else:
    print(sum(H[0:N-K]))
s = input()
t = input()
n = len(s)
ans = 0
for i in range(n):
    if s[i] != t[i]:
        ans += 1
print(ans)

### FIXED CODE ###

a = int(input())
print(a+a**2+a**3)
a, b, c = map(int, raw_input().split())

if a < b < c:
  print'"Yes")
else:
  print("No")

### FIXED CODE ###

a, b, c = map(int, raw_input().split())

if a < b < c:
  print("Yes")
else:
  print("No")
a, b = map(int, input().split())
al = []
b_lis = []

for _ in range(a):
    g = list(map(int, input().split()))
    g.append(sum(g))
    al.append(g)
for i in range(b+1):
    p = 0
    for j in range(a):
        p += al[a][i]
    b_lis.append(p)
for i in al:
    print(' '.join([str(v) for v in i]))


### FIXED CODE ###

a, b = map(int, input().split())
al = []
b_lis = []

for _ in range(a):
    g = list(map(int, input().split()))
    g.append(sum(g))
    al.append(g)
for i in range(b+1):
    p = 0
    for j in range(a):
        p += al[j][i]
    b_lis.append(p)
al.append((b_lis))
for i in al:
    print(' '.join([str(v) for v in i]))
x1, y1, x2, y2 = map(int, input().split())

X = (x2 - x1)**2
Y = (y2 - y1)**2

distance = (X + Y)**(1/2)
print("%.8f" % (float(distance)))

### FIXED CODE ###

x1, y1, x2, y2 = map(float, input().split())

X = (x2 - x1)**2
Y = (y2 - y1)**2

distance = (X + Y)**(1/2)
print("%.8f" % (float(distance)))
def dfs(i, total):
    if (i > A - 1):
        return False
    if (total - SPECIALS[i] <= 0):
        return True
    else:
        return dfs(i + 1, total - SPECIALS[i])

H, A = map(int, input().split())
SPECIALS = map(int, input().split())
SPECIALS = list(reversed(sorted(SPECIALS)))

print("Yes" if dfs(0, H) else "No")


### FIXED CODE ###

import sys

sys.setrecursionlimit(200000)

def dfs(i, total):
    if (i > A - 1):
        return False
    if (total - SPECIALS[i] <= 0):
        return True
    else:
        return dfs(i + 1, total - SPECIALS[i])

H, A = map(int, input().split())
SPECIALS = map(int, input().split())
SPECIALS = list(reversed(sorted(SPECIALS)))

print("Yes" if dfs(0, H) else "No")
n = int(input())
s = input()

a,b = 0,0
for i in s:
    if i == '.':
        a += 1 #白の個数
    else:
        b += 1 #黒の個数

min_c = 10**10
if s[0] == '.':
    counta, countb = 0, 0
    for k, i in enumerate(s):
        if s[k] == '.':
            counta += 1
        if s[k] == '#':
            countb += 1
            c = (a - counta) + (countb - 1)
        if min_c > c:
            min_c = c
        
print(min(a,b, min_c))

### FIXED CODE ###

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

a,b = 0,0
for i in s:
    if i == '.':
        a += 1 #白の個数
    else:
        b += 1 #黒の個数

min_c = c = 10**10
counta, countb = 0, 0
for k, i in enumerate(s):
    if s[k] == '.':
        counta += 1
    if s[k] == '#':
        countb += 1
        c = (a - counta) + (countb - 1)
    if min_c > c:
        min_c = c
        
print(min(a,b, min_c))
S,T=map(lambda x: x, input().split())
A,B=int(input().split())
U=input()
L=[(S,A),(T,B)]
for l in L:
  x,y=l
  if x==U:
    print(y-1, end=" ")
  else:
    print(y, end=" ")

### FIXED CODE ###

S, T=input().split()

A, B=map(int, input().split())
U=input()

if U==S:
  A-=1
else:
  B-=1
print(A, B)
n = int(input())
v = list(map(int, input().split()))

even = {}
odd = {}

for i in range(n):
    if i % 2 == 0:
        if v[i] not in even:
            even[v[i]] = 0
        even[v[i]] += 1
    else:
        if v[i] not in odd:
            odd[v[i]] = 0
        odd[v[i]] += 1

even_sorted = sorted(even.items(), key=lambda x:x[i])[::-1]
odd_sorted = sorted(odd.items(), key=lambda x:x[i])[::-1]

ans = 0
if even_sorted[0][0] != odd_sorted[0][0]:
    ans += n - even_sorted[0][1] - odd_sorted[0][1]
else:
    x = n - even_sorted[0][1] - odd_sorted[1][1]
    y = n - even_sorted[1][1] - odd_sorted[0][1]
    ans += min(x, y)

print(ans)

### FIXED CODE ###

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

even = {}
odd = {}

for i in range(n):
    if i % 2 == 0:
        if v[i] not in even:
            even[v[i]] = 0
        even[v[i]] += 1
    else:
        if v[i] not in odd:
            odd[v[i]] = 0
        odd[v[i]] += 1

even_sorted = sorted(even.items(), key=lambda x:x[1])[::-1]
odd_sorted = sorted(odd.items(), key=lambda x:x[1])[::-1]

ans = 0
if even_sorted[0][0] != odd_sorted[0][0]:
    ans += n - even_sorted[0][1] - odd_sorted[0][1]
else:
    if len(even_sorted) == 1 or len(odd_sorted) == 1:
        even_sorted.append((-1, 0))
        odd_sorted.append((-1, 0))
    x = n - even_sorted[0][1] - odd_sorted[1][1]
    y = n - even_sorted[1][1] - odd_sorted[0][1]
    ans += min(x, y)

print(ans)
from sys import stdout


def upper(n):
    if n < 5:
        return list("* ")
    else:
        return list(" *")


def lower(n):
    m = n % 5
    a = ['*'] * m + [' ']
    a = a + ['*'] * (5 - len(a))
    return a


def abacus(n):
    return upper(n) + ['='] + lower(n)


while True:
    try:
        ns = map(int, ("0" + raw_input().strip())[-6:])
    except EOFError:
        break

    ab = []
    for n in ns:
        ab.append(abacus(n))

    for i in range(8):
        for j in range(5):
            stdout.write(ab[j][i])
        stdout.write("\n")

    print

### FIXED CODE ###

from sys import stdout


def upper(n):
    if n < 5:
        return ['*', ' ']
    else:
        return [' ', '*']


def lower(n):
    m = n % 5
    return ['*'] * m + [' '] + ['*'] * (4 - m)


def abacus(n):
    return upper(n) + ['='] + lower(n)


res = []
while True:
    try:
        ns = map(int, ('00000' + raw_input().strip())[-5:])
    except EOFError:
        break

    ab = []
    for n in ns:
        ab.append(abacus(n))

    for i in range(8):
        for j in range(5):
            res.append(ab[j][i])
        res.append('\n')
    res.append('\n')

stdout.write(''.join(res[:-1]))
a=input()
inputarray=[1,2,3]
inputarray.remove(a)
b=input()
inputarray1.remove(b)

### FIXED CODE ###

a=input()
inputarray=[1,2,3]
inputarray.remove(int(a))
b=input()
inputarray.remove(int(b))
print(inputarray[0])
int a=input()
res = 0
for i in range(1,1000):
  for j in range(2,10):
    if res<i**j and i**j<=a:
      res=i**j
print(res)

### FIXED CODE ###

a=int(input())

res=0

for i in range(1,1000):
    for j in range(2,10):
        if res<i**j and i**j<=a:
            res=i**j

print(res)
A = list(map(int, input().split() ) ).sort()
print( A[0] + A[1] + 10*A[2] )


### FIXED CODE ###

A = sorted( list(map(int, input().split() ) ) )
print( A[0] + A[1] + 10*A[2] )
N = int(input())
C = list(map(int, input().split()))
MOD = 10 ** 9 + 7

C.sort()
C = [0] + C

answer = 0
for i in range(1, N + 1):
  answer = (answer + C[i] * (pow(2, N - 1, MOD) + pow(2, N - 2, MOD) * (N - i))) % MOD
answer = (answer * pow(2, N, MOD)) % MOD

print(answer)

### FIXED CODE ###

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

MOD = 10 ** 9 + 7

C.sort()
C = C[::-1]

a0 = pow(2, N - 1, MOD)
d = pow(2, N - 2, MOD) if N - 2 >= 0 else 0
answer = 0
for i in range(N):
  answer = (answer + (a0 + d * i) * C[i]) % MOD
answer = (answer * pow(2, N, MOD)) % MOD
print(int(answer))
S=input()
S=int(S)

W=input()
W=int(W)

if W>S:
  print("unsafe")
  else:
    print("safe")

### FIXED CODE ###

s, w = input().split(" ")

s = int(s)
w = int(w)

if w >= s:
    print("unsafe")
else:
    print("safe")
x,y,A,B,C,*a=map(int,open(0).read().split())
a,b,c=a[:A],a[A:A+B],a[A+B:]
a.sort()
b.sort()
c.sort()
a,b=a[A-x:],b[B-y:]
d,e,f=a[0],b[0],c[-1]
D=E=0
F=-1
for _ in range(min(C,x+y)):
    if f>e>=d:
        a[D]=f
        D+=1
        d=a[D]
    elif f>d>=e:
        b[E]=f
        E+=1
        e=b[F]
    elif e>f>=d:
        a[D]=f
        D+=1
        d=a[D]
    elif d>f>=e:
        b[E]=f
        E+=1
        e=b[F]
    else:break   
    F-=1
    if F!=-C-1:
        f=c[F]    
print(sum(a+b))

### FIXED CODE ###

x,y,a,b,c=map(int,input().split())
p=[int(i) for i in input().split()]
q=[int(i) for i in input().split()]
r=[int(i) for i in input().split()]
p.sort()
q.sort()
p=p[-x:]
q=q[-y:]
s=p+q+r
s.sort()
print(sum(s[-x-y:]))
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * x + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * x + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().rstrip().split()))
    X = tuple(map(int, input().rstrip().split()))
    x = max(X)
    # dp[i][j][k] := patterns to make k by j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * 50 + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()
p,q,r=map(int,input().split())

print(min([p+q,q+r,r+p])

### FIXED CODE ###

p,q,r=map(int,input().split())

print(min([p+q,q+r,r+p]))
S=input()
for i in range(len(S)):
  S[i]="x"
print(S)

### FIXED CODE ###

S=input()
ans=""
for i in range(len(S)):
  ans+="x"
print(ans)
N, K = map(int, input().split())
S = input()
if S[K - 1] == 'A':
  S[K - 1] = 'a'
elif S[K - 1] == 'B':
  S[K - 1] = 'b'
else:
  S[K - 1] = 'c'
print(S)


### FIXED CODE ###

N, K = map(int, input().split())
S = input()
print(S[:K-1] + S[K-1].lower() + S[K:])
while True:
    m=input().split()
    h=int(m[0])
    w=int(m[1])
    if a==0 & b==0:
      break
    for i in range(h):
       for j in range(w):
         print("#"*w)
      print(" ")
    print(" ")
    
    


### FIXED CODE ###

while True:
    v=input().split()
    a=int(v[0])
    b=int(v[1])
    if a==0 and b==0:
       break
    for i in range (a):
        print('#'*b)
    print()