Harryxun/stf_run huggingface dataset:
X, Y = map(int, input().split())
mod = 10**9 + 7

dp = [[0]*(Y+1) for i in range(X+1)]
dp[0][0] = 1

for i in range(X+1) :
    for j in range(Y+1) :
        if i >= 1 and j >= 2 :
            dp[i][j] = (dp[i][j] + dp[i-1][j-2])%mod
        if i >= 2 and j >= 1 :
            dp[i][j] = (dp[i][j] + dp[i-2][j-1])%mod

print(dp[X][Y])


### FIXED CODE ###

X, Y = map(int, input().split())
mod = 10**9 + 7

def comb(n, r, mod):
    X = 1
    Y = 1
    for i in range(1,r+1):
        X = (X*(n-i+1))%mod
        Y = (Y*i)%mod
    return (X*pow(Y, mod-2, mod))%mod

if (X+Y)%3 != 0 :
    print(0)
elif X < (X+Y)//3 or Y < (X+Y)//3 :
    print(0)
else :
    i = X - (X+Y)//3
    print(comb((X+Y)//3, i, mod))
N = int(input())

prime = [3, 5, 7, 11, 13]

# 約数が8個ということは、素因数分解した時の素因数の個数が0/7, 1/3, 1/1/1以外ありえない
zero_seven = 0
one_three = [a * (b ** 3) for a in prime for b in prime if a != b]
one_three = [i for i in one_three if i <= 200]
one_one_oen = [a * b * c for a in prime for b in prime for c in prime
               if a != b and b != c and c != a]
one_one_oen = [i for i in one_one_oen if i <= 200]

ans = sorted(set(one_three + one_one_oen))
i = 0
while ans[i] <= N:
    i += 1
    if ans[i] > N:
        print(i)

### FIXED CODE ###

N = int(input())

prime = [3, 5, 7, 11, 13]

# 約数が8個ということは、素因数分解した時の素因数の個数が0/7, 1/3, 1/1/1以外ありえない
zero_seven = 0
one_three = [a * (b ** 3) for a in prime for b in prime if a != b]
one_three = [i for i in one_three if i <= 200]
one_one_one = [a * b * c for a in prime for b in prime for c in prime
               if a != b and b != c and c != a]
one_one_one = [i for i in one_one_one if i <= 200]

ans = sorted(set(one_three + one_one_one))
if N <= 104:
    print(0)
elif 105 <= N <= 134:
    print(1)
elif 135 <= N <= 164:
    print(2)
elif 165 <= N <= 188:
    print(3)
elif 189 <= N <= 194:
    print(4)
elif 195 <= N:
    print(5)
import fractions

A, B, C, D = map(int, input().split())

count = B - A + 1
lcd_of_CD = C * D // fractions.gcd(C, D)

count -= B // C
count += (A - 1) // C
count -= B // D
count += (A - 1) // D
count += B // lcd_of_CD
count -= (A - 1) // lcd_of_CD

print(count)

### FIXED CODE ###

S = input()

for i in range(len(S) - 1):
    if S[i] == S[i+1]:
        print('Bad')
        exit()
print('Good')
from math import sqrt, ceil

ab = input().split(' ')
a = int(ab[0])
b = int(ab[1])

tmp = b
if a<b:
	tmp = a
	a = b
	b = tmp

while b != 0:
	tmp = b
	b = a%b
	a = tmp

count = 1

if a == 1:
	return count

if a%2 == 0:
    count += 1
    while a%2 == 0:
        a //= 2

if a == 1:
	return count

while i*i <= a:
    if a%i == 0:
        count += 1
        while a%i == 0:
            a //= i
        if a == 1:
            break
    
return count

if __name__ == "__main__":
    print(main())

### FIXED CODE ###

from math import sqrt, ceil

def main():

    ab = input().split(' ')
    a = int(ab[0])
    b = int(ab[1])

    tmp = b
    if a<b:
        tmp = a
        a = b
        b = tmp

    while b != 0:
        tmp = b
        b = a%b
        a = tmp

    count = 1

    if a == 1:
        return count

    if a%2 == 0:
        count += 1
        while a%2 == 0:
            a //= 2
        if a == 1:
            return count
    
    i = 3
    while i*i <= a:
        if a%i == 0:
            count += 1
            while a%i == 0:
                a //= i
            if a == 1:
                return count
        i += 2
        
    return count+1

if __name__ == "__main__":
    print(main())
if __name__ == '__main__'
    N = input()
    N = int(N)
    array = list(map(int,  input().split()))
    cnt = 0
    for i in range(N):
    # print(' '.join(map(str, array)))
        for j in range(N-1, i, -1):
            if array[j] < array[j-1]:
                array[j], array[j-1] = array[j-1], array[j]
                cnt += 1
    print(' '.join(map(str, array)))
    print("%d" % (cnt))


### FIXED CODE ###

def bubble_sort(A):
    global N
    flag = True
    i = 0 
    cnt = 0
    while flag:
        flag = False
        for j in range(N-1, i, -1):
            if A[j] < A[j-1]:
                A[j],A[j-1] = A[j-1],A[j]
                cnt += 1
                flag = True
        i += 1
    return cnt

N = int(input())
A = list(map(int, input().split()))
cnt = bubble_sort(A)
print(' '.join(list(map(str, A))))
print(cnt)
n = int(input())
s,t = map(str,input().split())
a = ''
for i in range(n):
    a = a[i]+s[i]+t[i]
print(a)

### FIXED CODE ###

n = int(input())
s,t = map(str,input().split())
a = ''
for i in range(n):
    a = a+s[i]+t[i]
print(a)
def xy(a)
    if a % 4 == 1:
        return 1
    elif a % 4 == 2:
        return a + 1
    elif a % 4 == 3 or a == 0:
        return 0
    else:
        return a

a, b = map(int, input().split())
ans = xy(b) ^ xy(a - 1)
print(ans)


### FIXED CODE ###

def xy(a):
    if a % 4 == 1:
        return 1
    elif a % 4 == 2:
        return a + 1
    elif a % 4 == 3 or a == 0:
        return 0
    else:
        return a

a, b = map(int, input().split())
ans = xy(b) ^ xy(a - 1)
print(ans)
x,m = map(int, input().split())
x = sorted(list(map(int, input().split())))

if n >= m:print(0)
else:
    dist = [abs(x[i+1] - x[i]) for i in range(M-1)]
    dist = sorted(dist)
    print(sum(dif[:-(n-1)]))

### FIXED CODE ###

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

if n >= m:print(0)
else:
    dist = [abs(x[i+1] - x[i]) for i in range(m-1)]
    dist = sorted(dist)
    print(sum(dist[:m-n]))
import copy as copy
s = input()
dic={}

def func(val, n):
    if val in dic:
        return dic[val]

    if not ('1' in val):
        return n
    elif not ('0' in val):
        return n
    a=0
    b=0    
    if '01' in val:
        a = func(val.replace('01', '', 1), n+2)
    if '10' in val:
        b = func(val.replace('10', '', 1), n+2)
    
    ans=max(a, b, n)
    dic[val]=ans

    return ans

print(func(s, 0))


### FIXED CODE ###

s = input()

print(min(s.count('0'), s.count('1'))*2)
S = input()
K = int(input())
l = [int(s) for s in S if s != "1"]
print(l[0])

### FIXED CODE ###

S = input()
K = int(input())
l = [int(i) for i in S]
for i in range(min(S.__len__(), K)):
    if l[i] != 1:
        print(l[i])
        break
else:
    print(1)
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
N,K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
x = gcd_list(A)
if(K%x==0 and max(A)-min(A)>K):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


### FIXED CODE ###

import fractions as math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
N,K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
x = gcd_list(A)
if(K%x==0 and max(A)>=K):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=0
cnt=1
for j in range(0,N+1):
    D=D+L[j]
    if D>X:
        break
    else:
        cnt+=1
print(cnt)

### FIXED CODE ###

N,X=map(int,input().split())
L=list(map(int,input().split()))
D=0
cnt=1
for i in L:
    D=D+i
    if D>X:
        break
    cnt+=1
print(cnt)
import sys
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    m = a[-1]+1
    ava = [0]*m
    for rep in a:
        ava[rep] += 1
        if ava[rep]==1:
            for item in range(rep,n+1,rep):
                ava[item] == 2

    print(ava.count(1))
    return

if __name__=='__main__':
    n = I()
    a = list(IL())
    a.sort()
    solve()

### FIXED CODE ###

import sys

def solve(a,n):
    m = a[-1]+1
    ava = [0]*m
    for rep in a:
        ava[rep] += 1
        if ava[rep]:
            for i in range(2*rep,m,rep):
                ava[i] += 2
    return ava.count(1)
 
if __name__=='__main__':
    n = int(sys.stdin.readline().rstrip())
    a = list(map(int,sys.stdin.readline().rstrip().split()))
    a.sort()
    print(solve(a,n))
pair = [[1, 2], [2, 5], [3, 5], [4, 4], [5, 5], [6, 6], [7, 3], [8, 7], [9, 6]]
n, m = [int(x) for x in input().split()]
given = sorted([int(i) for i in input().split()])
given_pair = sorted([pair[x - 1] for x in given], reverse=True)

dp = (1 + n) * [0]
max_dp = 0
for i in range(n + 1):
    if i == 0:
        dp[i] = 0
    for j in range(m):
        if i - given_pair[j][1] >= 0:
            if dp[i - given_pair[j][1]] + 1 >= max_dp:
                max_dp = dp[i - given_pair[j][1]] + 1
    dp[i] = max_dp



def choice_list(x, index):
#    print("now_index", index)
#    print(given_pair[x][1])
#    print("now_dp_atai", dp[index - given_pair[x][1]])
    if dp[index - given_pair[x][1]] == dp[index] - 1:
        if dp[index - given_pair[x][1]] == 0:
            for j in given_pair:
                print(j)
                if index == j[1]:
                    return str(j[0])
            return ""
        elif index - given_pair[x][1] < 0:
            return "-1"
        else:
            return str(given_pair[x][0]) + choice_list(x, index - given_pair[x][1])

    else:
        return choice_list(x + 1, index)


print(choice_list(0, n))

### FIXED CODE ###

n, m = [int(i) for i in input().split()]
am = sorted([int(i) for i in input().split()],reverse=True)
c = [2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [-1 for i in range(n+1)]
dp[0]=0
for i in range(n+1):
    #max_tmp = -float("inf")
    for j in am:
        if i+c[j-1]<=n:
            dp[i+c[j-1]] = max(dp[i+c[j-1]], dp[i]+1)
#print(dp)
tmp_n = n
ans =""
for i in range(dp[n]):
    for j in range(m):
        if i==dp[n]-1 and tmp_n- c[am[j]-1] != 0:
            continue
        if tmp_n - c[am[j]-1] >= 0 and dp[tmp_n - c[am[j]-1]] == dp[tmp_n] -1:
            ans+=(str(am[j]))
            tmp_n -= c[am[j]-1]
            break


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

X_Y = 0
for i in range(N):
  if cost[i] > 0:
	X_Y += V[i] - C[i]
print(X_Y)

### FIXED CODE ###

N = int(input())
V = list(map(int, input().split( )))
C = list(map(int, input().split( )))
X = 0
for i in range(N):
    if(V[i]-C[i]>0):
        X += V[i] - C[i]
print(X)
x,a = map(int,input().split())
if x<a:
  print("0")
else:
  print("10!)

### FIXED CODE ###

x,a = map(int,input().split())
if x<a:
  print("0")
else:
  print("10")
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
import itertools

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n,m,q=map(int, readline().rstrip().split())

    aa=[0]*q
    bb=[0]*q
    cc=[0]*q
    dd=[0]*q

    for i in range(q):
        aa[i],bb[i],cc[i],dd[i]=map(int, readline().rstrip().split())

    max_score=0
    for a in itertools.combinations_with_replacement(list(range(1,m+1)),m):
        score=0
        for i in range(q):
            if (a[bb[i]-1]-a[aa[i]-1])==cc[i]:
                score+=dd[i]
        max_score=max(max_score,score)

    print(max_score)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()


### ----------------
### ここまで 
### ----------------

### FIXED CODE ###

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
import itertools

sys.setrecursionlimit(500*500)

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n,m,q=map(int, readline().rstrip().split())

    aa=[0]*q
    bb=[0]*q
    cc=[0]*q
    dd=[0]*q

    for i in range(q):
        aa[i],bb[i],cc[i],dd[i]=map(int, readline().rstrip().split())

    max_score=0

    for a in itertools.combinations_with_replacement(list(range(1,m+1)),n):
        score=0
        for i in range(q):
            if (a[bb[i]-1]-a[aa[i]-1])==cc[i]:
                score+=dd[i]
        max_score=max(max_score,score)

    print(max_score)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()


### ----------------
### ここまで 
### ----------------
n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
dp = [[[0 for _ in range(n*max(x)+1)] for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1

for j in range(1, n+1):
  for k in range(n+1):
    for s in range(n*max(x)+1):
      if s<x[j-1]:
        dp[j][k][s] = dp[j-1][k][s]
      elif k>=1:
        dp[j][k][s] = dp[j-1][k][s]+dp[j-1][k-1][s-x[j-1]]
ans = 0
for i in range(1, n+1):
  ans += dp[n][i][i*a]
print(ans)

### FIXED CODE ###

n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
y = [ele-a for ele in x]
m = n*max(a, max(x))
dp = [[0 for _ in range(2*m+1)]for _ in range(n+1)]
dp[0][m] = 1
for j in range(1, n+1):
  for t in range(2*m+1):
    if t-y[j-1]<0 or 2*m<t-y[j-1]:
      dp[j][t] = dp[j-1][t]
    elif 0<=t-y[j-1]<=2*m:
      dp[j][t] = dp[j-1][t] + dp[j-1][t-y[j-1]]
print(dp[n][m]-1)
"""
---アルゴリズム概要---
Mを構成する素因数を、a1~aNの各スロットにいくつ置くのか、を考える問題。
まずは試し割りによってMを素因数分解。
重複組合せの公式で各素因数の配置パターンを算出し累乗していく。

試し割りは、O(√M)の計算量で処理できる。
√Mを超える素因数は、多くても一つしか存在しないため、√Mを超える値で試し割りをする必要はない。
もし√Mまでの値で試し割りを終えた段階で、Mを素因数分解しきれていなければ、残った商こそが√Mを超える唯一の素因数である。

簡単に証明
もし√Mを超える素因数が２つ存在しているとしよう。
それらは、(√M + α)と(√M + β)というふうに表すことができる。
この２つの積は明らかにMの値を超えてしまう。つまり前提に矛盾する。
したがって、√Mを超える素因数は多くても一つ
"""
from collections import Counter
import math

N,M = map(int,input().split())
factors = []

while M%2 == 0:
    M//=2
    factors.append(2)
    
f = 3
while f**2 <= M:
    while M%f==0:
        M//=f
        factors.append(f)
    f+=2
if M!=0:
    factors.append(M)

factors = Counter(factors)

ans = 1
for k in factors.values():
    ans *= math.factorial(k+N-1)//(math.factorial(N-k)*math.factorial(k))

print(ans%(10**9+7))

### FIXED CODE ###

def main():
    import math
    from collections import Counter

    N,M = map(int,input().split())
    a = []
    def prime_factorize(n):
        while n % 2 == 0:
            a.append(2)
            n //= 2
        f = 3
        while f * f <= n:
            if n % f == 0:
                a.append(f)
                n //= f
            else:
                f += 2
        if n != 1:
            a.append(n)
        return a
    prime_factorize(M)
    def combinations_count(n, r):
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    divisors = Counter(a)
    count = 1
    for k,v in divisors.items():
        count *= combinations_count(v+N-1,v)

    print(count%(10**9+7))
main()
N = int(input())
M = int(input())
for i in range(M):
    a,b = map(int,input().split())

if N % 2 == 0 and M % 2 == 0:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

N,M = map(int,input().split())
lis = [0] * N
for i in range(M):
    a,b = map(int,input().split())
    lis[a-1] += 1
    lis[b-1] += 1
ans = 'YES'
for i in lis:
    if i % 2 == 1:
        ans = 'NO'
print(ans)
maxi = 0
for i in range(N):
    for o in range(i):
        fs = 0
        bs = 0
        hand = []
        for p in range(o):
            fs += V[p]
            hand.append(V[p])
        for p in range(i-o, N):
            bs += V[p]
            hand.append(V[p])
        ts = fs + bs
        if ts > maxi:
            maxi = ts
        if len(hand) > 0:
            hand.sort()
        for j in range(K-i):
            if hand[0] <= 0:
                del hand[0]
        ts = 0
        for k in hand:
            ts += k
        if ts > maxi:
            maxi = ts
print(maxi)

### FIXED CODE ###

N, K = map(int, input().strip().split())
V = list(map(int, input().strip().split()))
H = []
maxi = 0
for i in range(min(N, K)):
    for o in range(i+2):  # error1
        ts = 0
        hand = []
        for p in range(o):
            hand.append(V[p])
        for p in range(N-(i-o)-1, N):  # error2
            hand.append(V[p])
        for values in hand:
            ts += values
        if ts > maxi:
            maxi = ts
        if len(hand) > 0:
            hand.sort()
            for j in range(K-i-1):  # error3
                if len(hand) > 0:
                    if hand[0] < 0:
                        del hand[0]
                    else:
                        break
        ts = 0
        for k in hand:
            ts += k
        if ts > maxi:
            maxi = ts
print(maxi)
s = input()
k = int(input())
if len(s) == 1 or k == 1:
    print(s[0])
i = 0
while i < k and i < len(s):
    if s[i] != '1':
        break
    i += 1
print(s[i])


### FIXED CODE ###

s = input()
k = int(input())
if len(s) == 1 or k == 1:
    print(s[0])
else:
    i = 0
    while i < k - 1 and i < len(s):
        if s[i] != '1':
            break
        i += 1
    print(s[i])
import math


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    points = list(map(lambda x: sp(x), inputs))
    N = len(points)
    distances = []
    for i, _ in enumerate(points):
        for j in range(i + 1, N):
            distances.append(
                math.sqrt(
                    (points[i][0] - points[j][0]) ** 2
                    + (points[i][1] - points[j][1]) ** 2
                )
            )
    max = 0
    for d in distances:
        max = d if max < d else max
    return "%.6f" % max


def sp(s):
    new_s = s.split()
    return list(map(lambda x: int(x), new_s))


if __name__ == "__main__":
    N = int(input())
    ret = solve(inputs(N))
    print(ret)


### FIXED CODE ###

def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [K, S] = list(map(lambda x: int(x), inputs[0].split()))
    pattern = 0
    for x in range(0, K + 1):
        for y in range(0, K + 1):
            tmp_z = S - x - y
            if tmp_z <= K and tmp_z >= 0:
                pattern += 1

    return pattern


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)
t, k, c, d = [int(x) for x in input().split()]
while (t >= 0 or c >= 0):
  c = c - k
  if c <= 0:
    print("Yes")
    break
  t = t - d
  if a <= 0:
    print("No")
    break

### FIXED CODE ###

t, k, c, d = (int(x) for x in input().split())
while (t >= 0 or c >= 0):
  c = c - k
  if c <= 0:
    print("Yes")
    break
  t = t - d
  if t <= 0:
    print("No")
    break
k = int(input())
import math
k1 = 0
k2 = 0
k3 = 0
count = 0
for i in range(0,k):
  k1 = k1 + 1
  for j in range(0,i):
    k2 = k2 + 1
    for k in range(0, j):
      k3 = k3 + 1
      if k1==k2==k3:
        count = count + k1
      elif k1==k2 or k2==k3 or k3==k1:
        count = count + 3*math.gcd(k1,k2,k3)
      else:
        count = count + 6*math.gcd(k1,k2,k3)

### FIXED CODE ###

k = int(input())
import math
k1 = 0
k2 = 0
k3 = 0
count = 0
for i in range(0,k):
  k1 = k1 + 1
  k2 = 0
  for j in range(0,k1):
    k3=0
    k2 = k2 + 1
    for k in range(0, k2):
      k3 = k3 + 1
      if k1==k2==k3:
        count = count + k1
      elif k1==k2:
        count = count + 3*math.gcd(k1,k3)
      elif k2==k3:
        count = count + 3*math.gcd(k1,k2)
      elif k3==k1:
        count = count + 3*math.gcd(k1,k2)
      else:
        k4 = math.gcd(k1,k2)
        count = count + 6*math.gcd(k3,k4)
print(count)
import sys
input = sys.stdin.readline
from collections import defaultdict

N,K = list(map(int,input().split()))
data = [list(map(int, input().split())) for _ in range(N)]

data.sort(lambda x:-x[1])
KISO = 0
EAT = defaultdict(int)
for i in range(K):
  t,v = data[i]
  EAT[t] += 1
  KISO += v
SHURUI = len(EAT)
l = K-1
r = K
MAX = KISO+SHURUI**2
while True:
  if l<0 or r>=N: break
  a,b = data[l]
  c,d = data[r]
  if EAT[a] == 1:
    l -= 1
    continue
  if EAT[c] != 0:
    r += 1
    continue
  EAT[a] -= 1
  EAT[c] += 1
  KISO -= b
  KISO += d
  SHURUI += 1
  MAX = max(MAX,KISO+SHURUI**2)
print(MAX)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import defaultdict

N,K = list(map(int,input().split()))
data = [list(map(int, input().split())) for _ in range(N)]

data.sort(key=lambda x:-x[1])
KISO = 0
EAT = defaultdict(int)
for i in range(K):
  t,v = data[i]
  EAT[t] += 1
  KISO += v
SHURUI = len(EAT)
l = K-1
r = K
MAX = KISO+SHURUI**2
while True:
  if l<0 or r>=N: break
  a,b = data[l]
  c,d = data[r]
  if EAT[a] == 1:
    l -= 1
    continue
  if EAT[c] != 0:
    r += 1
    continue
  EAT[a] -= 1
  EAT[c] += 1
  KISO -= b
  KISO += d
  SHURUI += 1
  l -= 1
  r += 1
  MAX = max(MAX,KISO+SHURUI**2)
print(MAX)
import numpy as np
t = input()
a = [x for i in range(len(t)) if t[i]=='?' x=D else x=t[i]]
print(a)

### FIXED CODE ###

t = input()
s = t.replace('?', 'D')
print(s)
# -*- coding: utf-8 -*-
import copy

N = int(input())
H = list(map(int, input().split()))
H_bak = copy.copy(H)

while H != sorted(H):
    for i in range(N-1):
        while H[i] > H[i+1]:
            H[i] -= 1

if all([abs(H[i]-H_bak[i]) < 2 for i in range(N)]):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

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

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

print(max(C-(A-B), 0))
def ii2ss(n):
    ss = []
    for i in range(n):
        ss.append(input())
    return ss

def sp2nn(sp, sep=' '):
    return [int(s) for s in sp.split(sep)]

def ss2nn(ss):
    return [int(s) for s in list(ss)]

def tk(i, j, k):
    return '%d %d %d' % (i, j, k)

def tkr(key):
    return sp2nn(key)

def main(ss):
    X, Y, Z, K = sp2nn(ss[0])
    aa = sp2nn(ss[1])
    bb = sp2nn(ss[2])
    cc = sp2nn(ss[3])
    aa.sort()
    aa.reverse()
    bb.sort()
    bb.reverse()
    cc.sort()
    cc.reverse()
    
    d = {}
    st = set()
    key = tk(0, 0, 0)
    st.put(key)
    d[key] = aa[0] + bb[0] + cc[0]
    for _ in range(K):
        vmax = -1
        vk = ''
        for k, v in d.items():
            if vmax < v:
                vmax = v
                vk = k
        print(vmax)
        d.pop(vk)
        st.put(vk)
        i, j, k = tkr(vk)
        if i + 1 < len(aa):
            key = tk(i+1, j, k)
            if key not in st:
                d[key] = aa[i+1] + bb[j] + cc[k]
        if j + 1 < len(bb):
            key = tk(i, j+1, k)
            if key not in st:
                d[key] = aa[i] + bb[j+1] + cc[k]
        if k + 1 < len(cc):
            key = tk(i, j, k+1)
            if key not in st:
                d[key] = aa[i] + bb[j] + cc[k+1]
        
main(ii2ss(4))

### FIXED CODE ###

def ii2ss(n):
    ss = []
    for i in range(n):
        ss.append(input())
    return ss

def sp2nn(sp, sep=' '):
    return [int(s) for s in sp.split(sep)]

def ss2nn(ss):
    return [int(s) for s in list(ss)]

def tk(i, j, k):
    return '%d %d %d' % (i, j, k)

def tkr(key):
    return sp2nn(key)

def main(ss):
    X, Y, Z, K = sp2nn(ss[0])
    aa = sp2nn(ss[1])
    bb = sp2nn(ss[2])
    cc = sp2nn(ss[3])
    aa.sort()
    aa.reverse()
    bb.sort()
    bb.reverse()
    cc.sort()
    cc.reverse()
    
    d = {}
    st = set()
    key = tk(0, 0, 0)
    st.add(key)
    d[key] = aa[0] + bb[0] + cc[0]
    for _ in range(K):
        vmax = -1
        vk = ''
        for k, v in d.items():
            if vmax < v:
                vmax = v
                vk = k
        print(vmax)
        d.pop(vk)
        st.add(vk)
        i, j, k = tkr(vk)
        if i + 1 < len(aa):
            key = tk(i+1, j, k)
            if key not in st:
                d[key] = aa[i+1] + bb[j] + cc[k]
        if j + 1 < len(bb):
            key = tk(i, j+1, k)
            if key not in st:
                d[key] = aa[i] + bb[j+1] + cc[k]
        if k + 1 < len(cc):
            key = tk(i, j, k+1)
            if key not in st:
                d[key] = aa[i] + bb[j] + cc[k+1]
        
main(ii2ss(4))