Harryxun/stf_run huggingface dataset:
from operator import mul
from functools import reduce
MOD = 10 ** 9 + 7
def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom 
N,K = map(int,input().split())
for i in range(1,1+K):
    ans = combinations_count(1+N-K,i)  % MOD
    ans *= combinations_count(K-1,k-i) % MOD
    print(ans%MOD)


### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


N,K = map(int,input().split())
for i in range(1,1+K):
    ans = cmb(1+N-K,i,mod)
    ans *= cmb(K-1,K-i,mod)
    print(ans%mod)
N,X = map(int,input().split())

m = [int(input()) for i in range(N)]

m.sort()


dounut = 0#消費した素の量
count = 0 #追加で作った数
for i in range(N):
    dounut = dounut + m[i]

while dounut < X:
        dounut = dounut + m[0]
        count += 1

if dounut >  X:
    count -= 1

print(N + count)


### FIXED CODE ###


a = input()

b = a.count("o")

print(700 + b*100)
import math
N = int(input())
h = list(map(int, input().split()))

dp = list([math.inf for i in range(N)])  # dpテーブル


def recursive(i):
    if dp[i] < math.inf:
        return dp[i]
    if i == 0:
        return 0
    res = math.inf
    res = min(res, recursive(i - 1) + abs(h[i] - h[i - 1]))
    if i > 1:
        res = min(res, recursive(i - 2) + abs(h[i] - h[i - 2]))
    dp[i] = res
    return res


print(recursive(N - 1))


### FIXED CODE ###

import math

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

dp = list([math.inf for i in range(N)])  # dpテーブル
dp[0] = 0
for i in range(N):
    a = dp[i]
    b = dp[i - 1] + abs(h[i] - h[i - 1])
    if a > b:
        dp[i] = b
    else:
        dp[i] = a
    a = dp[i]
    if i > 1:
        b2 = dp[i - 2] + abs(h[i] - h[i - 2])
        if a > b2:
            dp[i] = b2
        else:
            dp[i] = a

print(dp[N - 1])
date=[[],[],[]]
a,b,c=0,0,0
while True:
   if a < 0 and b < 0 and c < 0:
      break
   else:
      a,b,c =[int(i) for i in input().split()]
      date[0].append(a)
      date[1].append(b)
      date[2].append(c)
for h in range(0,len(date[0])-1):
   if date[0][h] == -1 or date[1][h] == -1:
      print("F")
   elif date[0][h] == date[1][h] == date[2][h]:
      break
   else:
      if date[0][h] + date[1][h] >= 80:
         print("A")
      else:
         if date[0][h] + date[1][h] >= 65:
            print("B")
         else:
            if date[0][h] + date[1][h] >= 50:
               print("C")
            else:
               if date[0][h] + date[1][h] >=30:
                  if date[2] >= 50:
                     print("C")
                  else:
                     print("D")
               else:
                  print("F")

### FIXED CODE ###

date=[[],[],[]]
a,b,c=0,0,0
while True:
   if a < 0 and b < 0 and c < 0:
      break
   else:
      a,b,c =[int(i) for i in input().split()]
      date[0].append(a)
      date[1].append(b)
      date[2].append(c)
for h in range(0,len(date[0])-1):
   if date[0][h] == -1 or date[1][h] == -1:
      print("F")
   elif date[0][h] == date[1][h] == date[2][h]:
      break
   else:
      if date[0][h] + date[1][h] >= 80:
         print("A")
      else:
         if date[0][h] + date[1][h] >= 65:
            print("B")
         else:
            if date[0][h] + date[1][h] >= 50:
               print("C")
            else:
               if date[0][h] + date[1][h] >=30:
                  if date[2][h] >= 50:
                     print("C")
                  else:
                     print("D")
               else:
                  print("F")
n = int(input())
l=list(map(int ,input().split()))
ans=[]
for i in range(min(l)+1,max(l)):
    w=0
    for j in range(n):
        w+=(l[j]-i)**2
    ans.append(w)
    
print(min(ans))

### FIXED CODE ###

n = int(input())
l=list(map(int ,input().split()))
ans=[]
for i in range(min(l)+1,max(l)):
    w=0
    for j in range(n):
        w+=(l[j]-i)**2
    ans.append(w)

if len(ans)==0:
    print(0)
else:
    print(min(ans))
N=int(input())
List=list(map(int,input().split()))
c=0
for i in range(N-1):
  for j in range(i+1:N):
    c==c+(List[i]*List[j])
print(c)

### FIXED CODE ###

N=int(input())
List=list(map(int,input().split()))
c=0
for i in range(N-1):
  for j in range(i+1,N):
    c=c+(List[i]*List[j])
print(c)
while True:
  m,f,r = map(int, input().split())
  if m==-1 and f==-1 and r==-1:
    break
 
  if m==-1 or f==-1:
    print('F')
  elif m+f>=80:
    print('A')
  elif 65<=m+f:
    print('B')
  elif 50<=m+f:
    print('C')  
  elif 30<=m+f:
    if r>=50:
      print('C')
    else:
      print('D')
  else:
    print('F')


### FIXED CODE ###

n, m, l = map(int, input().split())
a = [[] for _ in range(n)]
b = [[] for _ in range(m)]
  
for i in range(n):
  a[i] = list(map(int, input().split()))
  
for i in range(m):
  b[i] = list(map(int, input().split()))
  
for i in range(n):
  line = []
   
  for j in range(l):
    c = 0
     
    for k in range(m):
      c += a[i][k]*b[k][j]
     
    line.append(str(c))
 
  print(' '.join(line))
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
minc=min(c)
print((minc*(minc+1))%2019)

### FIXED CODE ###

l,r=list(map(int, input().split()))
minmod=2018
if r-l>=2018:
	print(0)
else:
	for i in range(l,r+1):
		for j in range(i+1,r+1):
			minmod=min(minmod,(i*j)%2019)
	print(minmod)
import sys


print(sys.stdin[::-1])

### FIXED CODE ###

a = 1
while a:
    print(input()[::-1])
    a = 0
import math

a, b = map(int, input().split())

print(int(a * b / math.gcd(a,b)))


### FIXED CODE ###

import fractions

a, b = map(int, input().split())

print(int((a * b) // fractions.gcd(a,b)))
import numpy as np

def main():
  N = int(input())
  A = np.asarray(list(map(int, input().split())))
  r = 1
  cnt = 1
  T = A[0]
  t = 1
  flg = False
  for l in range(N):
    while True:
      if T ^ A[r] == T + A[r]:
        t += 1
        cnt += t
        T += A[r]
        r += 1
      else:
        T -= A[l]
        t -= 1
        break
      if r == N:
        flg = True
        break
    if flg:
      break
  print(cnt)  

main()


### FIXED CODE ###

N = int(input())
A = tuple(map(int, input().split()))
if len(A) == 1:
  print(1)
  exit()
r = 1
cnt = 1
T = A[0]
t = 1
flg = False
for l in range(N):
  while True:
    if T ^ A[r] == T + A[r]:
      t += 1
      cnt += t
      T += A[r]
      r += 1
    else:
      T -= A[l]
      t -= 1
      break
    if r == N:
      flg = True
      break
  if flg:
    break
print(cnt)
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

from math import gcd
n = int(input())
a = list( map(int, input().split()))


g = 0
for aa in a:
    g = gcd(g,aa)
if g > 1:
    print('not coprime')
    exit()

def eratosthenes(limit):
    import math
    if not isinstance(limit, int):
        raise TypeError('n is int type.')
    if limit < 2:
        raise ValueError('n is more than 2')
    prime = []
    sqrt_limit = math.sqrt(limit)
    prime_numbers_list = [i + 1 for i in range(1, limit)]
    while True:
        p = prime_numbers_list[0]
        if sqrt_limit <= p:
            return prime + prime_numbers_list
        prime.append(p)
        prime_numbers_list = [e for e in prime_numbers_list if e % p != 0]
    return prime_numbers_list


g = 0
for aa in a:
    g = gcd(g,aa)
if g > 1:
    print('not coprime')
    exit()

seta = set(a)
if seta == {1}:
    print('pairwise coprime')
    exit()

prime_numbers_list = eratosthenes(a[-1])

insu_set = set()
for aa in a:
    for prime in prime_numbers_list:
        tmp = set()
        if aa % prime ==0:
            tmp.add(prime)
            aa //= prime
        if tmp & insu_set:
            print('setwise coprime')
            exit()
        else:
            insu_set = insu_set | tmp

print('pairwise coprime')





### FIXED CODE ###

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

from math import gcd
n = int(input())
a = list( map(int, input().split()))


g = 0
for aa in a:
    g = gcd(g,aa)
if g > 1:
    print('not coprime')
    exit()

MAXN = 10**6+10

def eratosthenes3(limit):
    sieve = [i for i in range(limit+1)]
    p = 2
    while p*p <= limit:
        if sieve[p] == p:
            for q in range(2*p,limit+1,p):
                if sieve[q] == q:
                    sieve[q] = p
        p += 1

    return sieve

sieve = eratosthenes3(MAXN)

st = set()
for aa in a:
    tmp = set()
    while aa > 1:
        tmp.add(sieve[aa])
        aa //= sieve[aa]
    for p in tmp:
        if p in st:
            print('setwise coprime')
            exit()
        st.add(p)
print('pairwise coprime')
n = int(input())
a = list(map(int, input().split()))

def gcd(a,b):
    while b:
        a, b = b, a%b
    return a

s1 = [a[0]]
s2 = [a[-1]]
for i in range(1, len(a)-1):
    s1.append(gcd(s1[-1], a[i]))
    s2 = [gcd(s2[-1], a[-(i+1)])] + s2
s1 = [a[-1]] + s1
s2 = s2 + [a[0]]


ans = 0
for i in range(len(s1)):
    ans = max(ans, (gcd(s1[i], s2[i])))

print(max(ans))

### FIXED CODE ###


def gcd(a,b):
    while b:
        a, b = b, a%b
    return a

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

left = [0] * (n + 1)
for i in range(1, n):
    left[i] = gcd(left[i - 1], a[i - 1])

right = [0] * (n + 1)
for i in range(1, n):
    right[n - i] = gcd(right[n - i + 1], a[n - i])

ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i + 1]))
print(ans)
a,b=map(int,input())
if a>12:
    print(b)
elif 13>a>5:
    print(b/2)
else:
    print(0)


### FIXED CODE ###

a,b=map(int,input().split())
if a>12:
    print(b)
elif 12>=a>=6:
    print(b//2)
else:
    print(0)
odd = input()
even =input()
even = str(0)+even
odd_list = []
even_list = []

for (a,b) in zip(odd,even):
    odd_list.append(a)
    even_list.append(b)
even_list.append("")
del even_list[0]

for i in range(len(odd_list)):
    print(odd_list[i],end = "")
    print(even_list[i],end = "")


### FIXED CODE ###

a,b,c = map(int,input().split())
if b - a == c - b:
    print("YES")
else:
    print("NO")
s = list(input())
arufa = ["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"]
for i in s:
    arufa.remove(i)
if arufa == []:
    dum = sorted(s,reverse=1)
    if dum == s:
        print(-1)
    else:
        arufa.append(s.pop(-1))
        for i in range(26):
            arufa.sort()
            if s[-1] < arufa[0]:
                s.append(arufa[0])
                break
            #for j in range(len(arufa)):
            #    if s[-1] < arufa[i]:
            #        s.append(arufa[0])
            #        print("".join(s))
            #        exit()
            arufa.append(s.pop(-1))
        print("".join(s))

else:
    s.append(arufa[0])
    print("".join(s))


### FIXED CODE ###

s = list(input())
kouho = ["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"]
for i in s:
    kouho.remove(i)
if kouho == []:
    kouho.append(s.pop(-1))
    for i in range(25):
        dum = s.pop(-1)
        for j in range(len(kouho)):
            if dum < kouho[j]:
                s.append(kouho[j])
                print("".join(s))
                exit()
        else:
            kouho.append(dum)
            kouho.sort()
    else:
        print(-1)
    print("".join(s))
else:
    s.append(kouho[0])
    print("".join(s))
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n = ni()
a = nl()
lis = [(e, i) for i, e in enumerate(a)]
lis.sort()
dp = [[-1]*n for _ in range(n)]

def solve(l, r):
    if l > r:
        return 0
    if dp[l][r] >= 0:
        return dp[l][r]
    idx = r - l
    e, i = lis[idx]
    dp[l][r] = max(abs(i-l)*e + solve(l+1, r), abs(r-i)*e + solve(l, r-1))
    return dp[l][r]

print(solve(0, n-1))


### FIXED CODE ###

import sys

stdin = sys.stdin
sys.setrecursionlimit(10**6)
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n = ni()
a = nl()
lis = [(e, i) for i, e in enumerate(a)]
lis.sort()
dp = [[-1]*n for _ in range(n)]

def solve(l, r):
    if l > r:
        return 0
    if dp[l][r] >= 0:
        return dp[l][r]
    idx = r - l
    e, i = lis[idx]
    dp[l][r] = max(abs(i-l)*e + solve(l+1, r), abs(r-i)*e + solve(l, r-1))
    return dp[l][r]

print(solve(0, n-1))
whn = list (map(int, input().split()))
x = 0
y = 0

for i in range(len(whn[2])):
    xya = list(map(int,input().split()))
    if xya[2] == 1:
        x = max(x, xya[0])
    elif xya[2] == 2:
        whn[0] = min(whn[0], xya[0])
    elif xya[2] == 3:
        y = max(y, xya[0])
    else:
        whn[1] = min(whn[1], xya[1])

print((whn[0]-x)*(whn[1]-y))


### FIXED CODE ###

whn = list (map(int, input().split()))
x = 0
y = 0
flag = 0

for i in range(whn[2]):
    xya = list(map(int,input().split()))
    if xya[2] == 1:
        x = max(x, xya[0])
    elif xya[2] == 2:
        whn[0] = min(whn[0], xya[0])
    elif xya[2] == 3:
        y = max(y, xya[1])
    else:
        whn[1] = min(whn[1], xya[1])
    if x >= whn[0] or y >= whn[1]:
        print(0)
        flag += 1
        break
        
if flag == 0:
    print((whn[0]-x)*(whn[1]-y))
n,m = map(int,input().split())
l,r = [0] * n, [0] * n
for i in range(m):
    l[i], r[i] = map(int, input().split())

ans = 0
for i in range(n):
    for j in range(m):
        if not((i + 1) >= l[j] and (i + 1) <= r[j]):
            break
        if j == m - 1:
            ans += 1

print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
l,r = [0] * m, [0] * m
for i in range(m):
    l[i], r[i] = map(int, input().split())

lmax = 0
rmin = 10 ** 5
for i in range(m):
    lmax = max(lmax,l[i])
    rmin = min(rmin,r[i])

if lmax <= rmin:
    print(rmin - lmax + 1)
else:
    print("0")
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a,b,c,d = map(int,input().split())
all = b - a + 1
if c == 1 or d == 1:
    print(0)
    exit()

cd = lcm(a, b)

cs = b//c - a//c + 1
ds = b//d - a//d + 1
cds = b//cd - a//cd + 1

print(all - cs - ds + cds)


### FIXED CODE ###

from fractions import gcd
import math

def lcm(x, y):
    return (x * y) // gcd(x, y)
a,b,c,d = map(int,input().split())
all = b - a + 1
if c == 1 or d == 1:
    print(0)
    exit()

cd = lcm(c, d)

cs = b//c - math.ceil(a/c) + 1
ds = b//d - math.ceil(a/d) + 1
cds = b//cd - math.ceil(a/cd) + 1

print(all - cs - ds + cds)
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(input())
a = np.array(read().split(), np.int64)

mod = 10 ** 9 + 7
ans = 0
b = [0] * len(a)

for i in range(61):
    for j in range(n):
        b[j] = (a[j] >> i) & 1
    x = len(b) - sum(b)
    y = n - x
    z = x * y
    z *= 2 ** i
    z %= mod
    ans += z
ans %= mod

print(ans)


### FIXED CODE ###

import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = np.array(read().split(), np.int64)

mod = 10 ** 9 + 7
ans = 0

for i in range(61):
    b = a >> i & 1
    x = np.count_nonzero(b)
    y = n - x
    z = x * y
    z *= 2 ** i
    z %= mod
    ans += z
ans %= mod

print(ans)
red = int(input())
blue = int(input())
ans = input()
if ans=="blue":
  blue--
else:
  red--


### 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())
a = sorted(list(map(int, input().split())), reverse=True)

print(sum(a[1:2*n:2]))

### FIXED CODE ###

n=int(input())
a=list(map(lambda x: int(x), input().split()))
a.sort(reverse=True)
print(sum(a[1:2*n:2]))
a=input()
c=int(a)
b=input()
d=int(b)
  
if a*b%2=0:
    print('Even')
else
    print('Odd')

### FIXED CODE ###

def main():
    a, b = [int(_) for _ in input().split()]
    print("Even") if a * b % 2 == 0 else print("Odd")

main()
N= int(input())
A= int(input())
B= int(input())
C= N*A
if C>B:
  print (B)
else: 
  print (C)

### FIXED CODE ###

N,A,B=map(int,input().split())
if N*A >=B:
  print (B)
else:
  print(N*A)
def input():
  	import sys
	return sys.stdin.readline()[:-1]

def resolve():
	from collections import deque
	
	n, q = map(int, input().split())
	adj = [[] for i in range(n+1)]
	for i in range(n-1):
		a, b = map(int, input().split())
		adj[a].append(b)
		adj[b].append(a)
	p = [list(map(int, input().split())) for i in range(q)]
	
	ans = [0 for i in range(n+1)]
	tmp = [0 for i in range(n+1)]
	for i in range(q):
		tmp[p[i][0]] += p[i][1]

	for start, point in enumerate(tmp):
		q = deque([start])
		while q:
			node = q.popleft()
			ans[node] += tmp[start]
			for i in list(filter(lambda x: x>node, adj[node])):
				q.append(i)

	for i in ans[1:]:
		print(i, end=" ")

#resolve()


### FIXED CODE ###

import sys
import io
#sys.stdin = io.StringIO(input_string)
sys.setrecursionlimit(10 ** 6)
def input():
    return sys.stdin.readline()[:-1]
    
def resolve():
	from collections import deque
	
	n, q = map(int, input().split())
	adj = [[] for i in range(n+1)]
	for i in range(n-1):
		a, b = map(int, input().split())
		adj[a-1].append(b-1)
		adj[b-1].append(a-1)
	ans = [0 for i in range(n)]
	for i in range(q):
		p, x = map(int, input().split())
		p -= 1
		ans[p] += x
#	print(f"{adj=}\n{ans=}")

	def dfs(now, prv):
		for next in adj[now]:
#			print(f"{now=}, {next=}")
			if next == prv:
				continue
			ans[next] += ans[now]
			dfs(next, now)

	dfs(0, 0)
	print(*ans)

resolve()
import numpy as np
from numba import njit

rr,cc,kk=map(int,input().split())
goods=np.array([list(map(int,input().split())) for _ in range(kk)],dtype=np.int)
gg=np.zeros((rr,cc),dtype=np.int)
for cr,ccc,ck in goods:
    gg[cr-1][ccc-1]=ck

@njit
def calc(r,c,g):
    dp=-1*np.ones((r+1,c+1,4),dtype=np.int)
    maxlst=np.zeros((r+1,c+1),dtype=np.int)

    dp[:,0,0]=0
    dp[0,:,0]=0
    
    for i in range(r):
        for j in range(c):
            tmp=0
            for k in range(3):
                if g[i][j]>0 and dp[i+1][j][k]>=0:
                    dp[i+1][j+1][k+1]=max(dp[i+1][j][k+1],dp[i+1][j][k]+g[i][j])
                else:
                    dp[i+1][j+1][k+1]=dp[i+1][j][k+1]
                tmp=max(tmp,dp[i+1][j+1][k+1])
            
            dp[i+1][j+1][0]=max(maxlst[i][j+1],dp[i+1][j][0])
            tmp=max(tmp,dp[i+1][j+1][0])
            
            if g[i][j]>0 and dp[i+1][j+1][0]>=0:
                dp[i+1][j+1][1]=max(dp[i+1][j+1][1],dp[i+1][j+1][0]+g[i][j])
                tmp=max(tmp,dp[i+1][j+1][1])
            
            maxlst[i+1][j+1]=tmp
    
    return maxlst[r][c]
            
print(calc(rr,cc,gg))

### FIXED CODE ###

import numpy as np
from numba import njit

rr,cc,kk=map(int,input().split())
goods=np.array([list(map(int,input().split())) for _ in range(kk)])
gg=np.zeros((rr,cc))
for cr,ccc,ck in goods:
    gg[cr-1][ccc-1]=ck

@njit
def calc(r,c,g):
    dp=-1*np.ones((r+1,c+1,4))
    maxlst=np.zeros((r+1,c+1))

    dp[:,0,0]=0
    dp[0,:,0]=0
    
    for i in range(r):
        for j in range(c):
            tmp=0
            for k in range(3):
                if g[i][j]>0 and dp[i+1][j][k]>=0:
                    dp[i+1][j+1][k+1]=max(dp[i+1][j][k+1],dp[i+1][j][k]+g[i][j])
                else:
                    dp[i+1][j+1][k+1]=dp[i+1][j][k+1]
                tmp=max(tmp,dp[i+1][j+1][k+1])
            
            dp[i+1][j+1][0]=max(maxlst[i][j+1],dp[i+1][j][0])
            tmp=max(tmp,dp[i+1][j+1][0])
            
            if g[i][j]>0 and dp[i+1][j+1][0]>=0:
                dp[i+1][j+1][1]=max(dp[i+1][j+1][1],dp[i+1][j+1][0]+g[i][j])
                tmp=max(tmp,dp[i+1][j+1][1])
            
            maxlst[i+1][j+1]=tmp
    
    return maxlst[r][c]
            
print(int(calc(rr,cc,gg)))
print(min(set(map(chr,range(97,123)))-set(input())) or["None"])

### FIXED CODE ###

s = input()
check = 'abcdefghijklmnopqrstuvwxyz'

s = set(s)
check = set(check)
s = check - s
s = sorted(s)
if(s):
    print(s[0])
else:
    print('None')
tx = [map(int, input().split())]
cx = sorted(tx)

for i in range(2):
    if cx[i] == cx[i+1]:
        print(sum(cx) - 2*cx[i])

### FIXED CODE ###

a, b, c = map(int, input().split())
lst = sorted([a, b, c])

for i in range(2):
    if lst[i] == lst[i+1]:
        print(sum(lst) - 2*lst[i])
'''

2 2 4 4 4
11 12 13 14
21 22 23 24
1 2 3 4

'''
o=input().rstrip().split(' ')
x=int(o[0])
y=int(o[1])
a=int(o[2])
b=int(o[3])
c=int(o[4])
H=0;
R=input().rstrip().split(' ')
G=input().rstrip().split(' ')
ANY=input().rstrip().split(' ')
R.sort(key=int,reverse=True)
G.sort(key=int,reverse=True)
ANY.sort(key=int,reverse=True)
while(x>0):
    if int(R[0]) > int(ANY[0]):
        H+=int(R[0])
        del(R[0])
        x-=1;
    else:
        break;
while(y>0):
    if int(G[0]) > int(ANY[0]):
        H+=int(G[0])
        del(G[0])
        y-=1;
    else:
        break;
if(x>0 and y==0):
    for i in range(0,x):
        if i<len(ANY):
            H+=ANY[i];
        else:
            H+=int(R[0])
            del(R[0])
elif(y>0 and x==0):
    for i in range(0,y):
        if i<len(ANY):
            H+=int(ANY[i]);
        else:
            H+=int(G[0])
            del(G[0])
else:
    FF=x+y;
    if FF<=len(ANY):
        for i in range(0,FF):
            H+=int(ANY[i])
    else:
        for i in range(0,len(ANY)):
            H+=int(ANY[i])
            if x>0 and int(R[0]) <= int(G[0]):
                del(R[0])
                x-=1;
            elif y>0 and int(G[0]) <= int(R[0]):
                del(G[0])
                y-=1;
        XX=x;
        YY=y;
        for i in range(0,XX):
            H+=int(R[0])
            del(R[0])
        for i in range(0,YY):
            H+=int(G[0])
            del(G[0])
print(H)

### 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()))
 
list.sort(p,reverse=True)
list.sort(q,reverse=True)
list.sort(r,reverse=True)
 
mazemaze =p[:x]+q[:y]+r
list.sort(mazemaze, reverse=True)
print(sum(mazemaze[:x+y]))
break

    if sum(tensuulist)<=0:
        continue
    else:
        syuki=len(tensuulist)
        tensuu+=(nokoriidoukaisuu//syuki)*sum(tensuulist)
        nokoriidoukaisuu%=syuki
        for i in range(nokoriidoukaisuu):
            tensuu+=tensuulist[i]
            ans=max(ans,tensuu)

print(ans)

### FIXED CODE ###

n,k = map(int, input().split())
p = [0]+[int(x) for x in input().split()]
c = [0]+[int(x) for x in input().split()]

ans=-10**18

for saisyo in range(1,n+1):
    tensuulist=[]
    genzaiti=saisyo

    while(True):
        genzaiti=p[genzaiti]
        tensuulist.append(c[genzaiti])
        if genzaiti==saisyo:
            break

    goukei=sum(tensuulist)
    nagasa=len(tensuulist)
    kaisuu=k
    syou=kaisuu//nagasa
    amari=kaisuu%nagasa

    tensuu=0
    nokorikaisuu=0

    if goukei<=0:
        for i in range(nagasa):
            tensuu+=tensuulist[i]
            ans=max(ans,tensuu)
    else:
        if 3*nagasa<kaisuu:
            tensuu+=goukei*(syou-1)
            nokorikaisuu=nagasa+amari
            for i in range(nokorikaisuu):
                tensuu+=tensuulist[(i%nagasa)]
                ans=max(ans,tensuu)
        else:
            for i in range(kaisuu):
                tensuu+=tensuulist[(i%nagasa)]
                ans=max(ans,tensuu)

print(ans)