Harryxun/stf_run huggingface dataset:
import numpy as np


def read_input():
    n = int(input())
    return n


def mymod(x):
    return x % (10**9 + 7)


def submit():
    N = read_input()
    N = list(map(int, list(bin(N)[2:])))

    dp = np.zeros((len(N) + 1, 3))
    dp[len(N)][0] = 1

    for i in range(len(N) - 1, -1, -1):
        for s in range(3):
            for k in range(3):
                new_s = 2 * s + N[len(N) - i - 1] - k
                if new_s < 0:
                    continue
                if new_s > 2:
                    new_s = 2
                dp[i][new_s] += mymod(dp[i + 1][s])
            dp[i][0] = mymod(dp[i][0])
            dp[i][1] = mymod(dp[i][1])
            dp[i][2] = mymod(dp[i][2])

    print(int(sum(dp[0])) % (10**9 + 7))

if __name__ == '__main__':
    submit()

### FIXED CODE ###


def read_input():
    n = int(input())
    return n


def mymod(x):
    return x % (10**9 + 7)


def submit():
    N = read_input()
    N = list(map(int, list(bin(N)[2:])))

    dp = [[0]*(3) for _ in range(len(N) + 1)]
    dp[len(N)][0] = 1

    for i in range(len(N) - 1, -1, -1):
        for s in range(3):
            for k in range(3):
                new_s = 2 * s + N[len(N) - i - 1] - k
                if new_s < 0:
                    continue
                if new_s > 2:
                    new_s = 2
                dp[i][new_s] += dp[i + 1][s]
            dp[i][0] = mymod(dp[i][0])
            dp[i][1] = mymod(dp[i][1])
            dp[i][2] = mymod(dp[i][2])

    print(mymod((dp[0][0] + dp[0][1] + dp[0][2])))


if __name__ == '__main__':
    submit()
n = (input())
csf = [list(map(int, input().split())) for _ in range(n-1)]

for i in range(n):
    point = i
    ans = 0
    while point < n-1:
        c, s, f = csf[point][0], csf[point][1], csf[point][2]
        if ans < s:
            ans += s-ans+c
        else:
            if ans%f != 0:
                ans += f-(ans%f)
            ans += c
        point += 1
    print(ans)

### FIXED CODE ###

n = int(input())
csf = [list(map(int, input().split())) for _ in range(n-1)]

for i in range(n):
    point = i
    ans = 0
    while point < n-1:
        c, s, f = csf[point][0], csf[point][1], csf[point][2]
        if ans < s:
            ans += s-ans+c
        else:
            if ans%f != 0:
                ans += f-(ans%f)
            ans += c
        point += 1
    print(ans)
ans = np.full(N+1, -1)
for i in range(M):
  if(ans[s[i]]==-1):
    ans[s[i]] = c[i]
  elif(ans[s[i]]!=c[i]):
    print(-1)
    sys.exit()

if(ans[1]==0)and(N!=1):
  print(-1)
  sys.exit()
if(ans[1]==-1)and(n!=1):
  ans[1] = 1
ans = np.where(ans==-1, 0, ans)
Ans = 0
for i in range(1, N+1):
  Ans += 10**(N-i)*ans[i]
print(int(Ans))

### FIXED CODE ###

import numpy as np
import sys
N, M = [int(x) for x in input().split()]
s = []
c = []
for i in range(M):
  a, b = [int(x) for x in input().split()]
  s.append(a)
  c.append(b)
  
ans = np.full(N+1, -1)
for i in range(M):
  if(ans[s[i]]==-1):
    ans[s[i]] = c[i]
  elif(ans[s[i]]!=c[i]):
    print(-1)
    sys.exit()
if(ans[1]==-1)and(N>1):
  ans[1] = 1
ans = np.where(ans==-1, 0, ans)
 
if(ans[1]==0)and(N!=1):
  print(-1)
  sys.exit()
Ans = 0
for i in range(1, N+1):
  Ans += 10**(N-i)*ans[i]
print(int(Ans))
n = int(input())
a = map(int, input().split())

print(min(a), max(a), sum(a))

### FIXED CODE ###

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

min_a = min(a)
max_a = max(a)
sum_a = sum(a)

print(min_a, max_a, sum_a)
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
d=[]
for i in range(m):
  b,c = map(int,input().split()) 
  for j in range(b):
    d.append(c)
bc.sort(key=lambda x:x[1])
d=d[::-1]
for i in range(len(d)):
  for j in range(n):
    if a[j] < d[i]:
      a[j]=d[i]
      break
print(sum(a))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for i in range(m)]
bc.sort(key=lambda x:x[1])
for b,c in bc[::-1]:
  a.extend([c]*b)
  if len(a)>2*n:
    break
a.sort(reverse=True)
print(sum(a[:n]))
A,B = map(int,input().split())
C = [int(input()) for _ in range(A)]
c = []
p = 0
C = sorted(C)
for i in range(B,A+1):
  c.append(max(C[i-(B):i]) - min(C[i-(B):i]))
  print(C[i-(B):i])
print(min(c))

### FIXED CODE ###

A = int(input())
B = [int(input()) for _ in range(A)]
p = 0
B = sorted(B)
b = B.pop(-1)
for i in B:
  p += i
print(b//2 + p)
x,y=int(input())
a=[300000,200000,100000]
add=0
if x*y==1:
    add=400000
print(a[x-1]+a[y-1]+add)


### FIXED CODE ###

x,y=map(int,input().split())
a=[300000,200000,100000]
b=[0]*300
a=a+b
add=0
if x*y==1:
    add=400000
print(a[x-1]+a[y-1]+add)
s=input()
l=["SUN","MON","TUE","WED","THU","FRI","SAT"]
print(7-l.index(s)

### FIXED CODE ###

s=input()
l=["SUN","MON","TUE","WED","THU","FRI","SAT"]
print(7-l.index(s))
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]
BC = sorted(BC,key= lambda x: x[1],reverse=True)
A.sort()
n = 0
i = 0
m = 0
while A[i]<BC[n][1]:
    A[i] = BC[n][1]
    m = m+1
    if m >=BC[n][0]:
        m = 0
        n = n+1
    i += 1
print(sum(A))

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]
BC = sorted(BC,key= lambda x: x[1],reverse=True)
A.sort()
n = 0
i = 0
m = 0
while A[i]<BC[n][1]:
    A[i] = BC[n][1]
    m = m+1
    if m >=BC[n][0]:
        m = 0
        n = n+1
    i += 1
    if n==M:
      break
    if i == N:
      break
print(sum(A))
A, B = map(int, input().split())
import math

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

print(lcm(A, B) )

### FIXED CODE ###

import fractions
a, b = map(int, input().split())
print(a * b // fractions.gcd(a, b))
a = int(input())
b = int(input())
print((a + b)//2)


### FIXED CODE ###

a, b = map(int, input().split())
print((a + b)//2)
n = int(input())
plus = []
minus = []
for a in map(int,input().split()):
    if a>=0:
        plus.append(a)
    else:
        minus.append(a)
ans = sum(plus)-sum(minus)
if len(minus)%2==1:
    ans = ans - 2*min(abs(max(minus)),min(plus))
print(ans)

### FIXED CODE ###

n = int(input())
plus = []
minus = []
for a in map(int,input().split()):
    if a>=0:
        plus.append(a)
    else:
        minus.append(a)
ans = sum(plus)-sum(minus)
if len(minus)%2==1:
    if plus==[]:
        ans = ans + 2*max(minus)
    else:
        ans = ans - 2*min(abs(max(minus)),min(plus))
print(ans)
#include <iostream>
using namespace std;

int main() {
    int A, B;
    cin >> A >> B;
    if (B % A == 0) cout << A+B << endl;
    else cout << B-A << endl;
}


### FIXED CODE ###

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

if (B % A == 0):
    print(A+B)
else:
    print(B-A)
N = int(input())
S = input()

cnt = 0

for i in range(1000):
    if 0 <= i < 10:
        a = "00" + str(i)
    elif 10 <= i < 100:
        a = "0" + str(i)
    elif 100 <= i:
        a = str(i)
    
    idx = 0
    for j in range(S):
        if S[i] == a[idx]:
            idx += 1
            if idx == 3:
                cnt += 1
                break

### FIXED CODE ###

N = int(input())
S = list(map(int, list(input())))

cnt = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            pin = [i, j, k]
            x = 0

            for a in S:
                if a == pin[x]:
                    x += 1
                    if x == 3:
                        cnt += 1
                        break

print(cnt)
K=int(input())
S=input()
s=list(S)

if len(s) =< K:
    print(S)
else:
    print(S[0:K:]+"...")


### FIXED CODE ###

K=int(input())
S=input()
s=list(S)

if len(s) <= K:
    print(S)
else:
    print(S[0:K:]+"...")
N = int(input())
ans = 1


i = [int(a) for a in input().split()]

if '0' in i:
    print(0)
    return

  for b in range(N):
    ans = ans * i[b]
 
    if ans > 10**18:
      ans = -1
 
print(ans)

### FIXED CODE ###

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

ans = 1

if 0 in a:
    print("0")
    exit()

for i in a:
    ans *= i

    if ans > 10**18:
        print("-1")
        exit()
        
print(ans)
x = int(input())
if x = 1:
  print(0)
else:
  print(1)

### FIXED CODE ###

x = int(input())
if x == 1:
  print(0)
else:
  print(1)
s=input()s=input()

if int(s[1])>4:
  print('TBD')
elif int(s[0])==1:
  print('TBD')
else:
  print('Heisei')
  
  

### FIXED CODE ###

s=input()

if int(s[6])>4:
  print('TBD')
elif int(s[5])==1:
  print('TBD')
else:
  print('Heisei')
N, M = list(map(int, input().split()))
L = [tuple(map(int, input().split())) for i in range(N)]
L.sort()
# print(L)
ct = 0
cost = 0
i = 0
while ct < M:
    a = min(M-ct, L[i][1])
    ct += a
    cost += a*L[i][0]
    # print(ct,cost)
    i += 1
print(cos

### FIXED CODE ###

N, M = list(map(int, input().split()))
L = [tuple(map(int, input().split())) for i in range(N)]
L.sort()
# print(L)
ct = 0
cost = 0
i = 0
while ct < M:
    a = min(M-ct, L[i][1])
    ct += a
    cost += a*L[i][0]
    # print(ct,cost)
    i += 1
print(cost)
a = list(map(int,input().split()))
if a[0] >= a[3]:
  print(a[3])
else:
  a[3] = a[3] -a[0]
  if a[1] >= a[3]:
    print(a[0])
  else:
    print(a[0]-a[3]+a[1])

### FIXED CODE ###

a = input()
b = input()
c = len(a)
a = a + b[c]
if (a == b):
  print("Yes")
else:
  print("No")
import sys

count = [0 for _ in range(101)]
mode = [0]

for s in sys.stdin:
    x = int(s)
    count[x] += 1

for i in range(len(count)):
    if count[i] > mode[0]:
        mode.clear()
        mode.append(i)
    elif count[i] == mode[0]:
        mode.append(i)

for i in mode:
    print(i)

### FIXED CODE ###

import sys

count = [0 for _ in range(101)]
mode = 0

for s in sys.stdin:
    x = int(s)
    count[x] += 1
    mode = max(mode, count[x])

for i in range(101):
    if count[i] == mode:
        print(i)
N, A, B = map(int, input().split())

li = [N , A , B]
print(min(li()))

### FIXED CODE ###

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

x = N*A
y = B

li = [x,y]
print(min(li))
b = input()
if b == T:
  print("A")
elif b == A:
  print("T")
elif b == G:
  print("C")
else:
  print("G")

### FIXED CODE ###

b = input()
if b == "T":
  print("A")
elif b == "A":
  print("T")
elif b == "G":
  print("C")
else:
  print("G")
N = int(input())
S = list(map(int, input().split()))
indexed_S = sorted([i,s for i,s in enumerate(S)], key = lambda x: x[1])
print(" ".join([iS[0] for iS in indexed_S])

### FIXED CODE ###

N = int(input())
S = list(map(int, input().split()))
indexed_S = sorted([[i,s] for i,s in enumerate(S)], key = lambda x: x[1])
print(" ".join([str(iS[0]+1) for iS in indexed_S]))
num_list=input.split()
a=int(num_list[0])
b=int(num_list[1])
c=int(num_list[2])
if a>b>c:
    print('Yes')
else :
    print('No')

### FIXED CODE ###

a,b,c=map(int,input().split())
if(a<b<c):
    print("Yes")
else:
    print("No")
X,Y = int(input())
print(X + Y / 2)

### FIXED CODE ###

X,Y = map(int,input().split())
print(X + Y // 2)
N,M = map(int,input().split())
a_list = []
b_list = []
c_list = []
d_list = []
lists = []
max = 0
for i in range(N):
    a,b = map(int,input().split())
    a_list.append(a)
    b_list.append(b)
for i in range(M):
    c,d = map(int,input().split())
    c_list.append(c)
    d_list.append(d)
for i in range(N):
    min = 9999
    for j in range(M):
        distance = abs(a_list[i] - c_list[j]) + abs(b_list[i] - d_list[j])
        if min > distance:
            min = distance
            index = j
    lists.append(index+1)
for i in range(len(lists)):
    print(lists[i])


### FIXED CODE ###

N,M = map(int,input().split())
a_list = []
b_list = []
c_list = []
d_list = []
lists = []
for i in range(N):
    a,b = map(int,input().split())
    a_list.append(a)
    b_list.append(b)
for i in range(M):
    c,d = map(int,input().split())
    c_list.append(c)
    d_list.append(d)
for i in range(N):
    min = 9999999999999999999999999
    for j in range(M):
        distance = abs(a_list[i] - c_list[j]) + abs(b_list[i] - d_list[j])
        if min > distance:
            min = distance
            ind = j
    lists.append(ind+1)
for i in range(len(lists)):
    print(lists[i])
N = int(input())
for total in N:
  (N += 1)
  print(N + (N + 1))

### FIXED CODE ###

N = int(input())
print(int(N * (N + 1) / 2))
N=int(input())
X=input()

def calc(n,count):
    popcount=bin(n).count("1")
    next_n=n%popcount
    #print(next_n)
    if next_n==0:
        return count+1
    else:
        return calc(next_n, count+1)



for i in range(N):
    if X[i]=="1":
        change="0"
    else:
        change="1"

    nowbin=X[:i]+change+X[i+1:]
    #print(int(nowbin, 2))
    print(calc(int(nowbin, 2),0))

### FIXED CODE ###

N=int(input())
X=input()
def calc(n,count):
    if n==0:
        return count
    popcount=bin(n).count("1")
    next_n=n%popcount
    #print(next_n)
    if next_n==0:
        return count+1
    else:
        return calc(next_n, count+1)

popcount=X.count("1")
if popcount==1:
    plus=0
    for i in range(N):
        x=X[i]
        if x=="1":
            plus+=pow(2,N-i-1,popcount+1)
    for i in range(N):
        x=X[i]
        if x=="1":
            print(0)
        else:
            ans=plus+pow(2,N-i-1,popcount+1)
            ans%=(popcount+1)
            print(calc(ans,1))
    exit()


plus=0
minus=0
for i in range(N):
    x=X[i]
    if x=="1":
        plus+=pow(2,N-i-1,popcount+1)
        minus+=pow(2,N-i-1,popcount-1)
        plus%=(popcount+1)
        minus%=(popcount-1)

for i in range(N):
    x=X[i]
    if x=="1":
        ans=minus-pow(2,N-i-1,popcount-1)
        ans%=(popcount-1)
        print(calc(ans,1))

    else:
        ans=plus+pow(2,N-i-1,popcount+1)
        ans%=(popcount+1)
        print(calc(ans,1))
a, b, k = map(int, input().split())

num_list = list(range(a, b+1))

length = len(num_list)

for x in range(0, min(length, k)):
    print(num_list[x])

for x in range(max(k, length-k+1), length):
    print(num_list[x])


### FIXED CODE ###

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

for x in range(a, min(b+1, a+k)):
    print(x)

for x in range(max(a+k, b-k+1), b+1):
    print(x)
n=int(input())
m,t=map(int,input().split())
if n<=t-m:
  print('OK')
else:
  print('NG')
elif n==1:
  print('OK')
  
    

### FIXED CODE ###

i=int(input())
n,m=map(int,input().split())
s=[]
if n%i==0:
  print('OK')
elif m%i==0:
  print('OK')
else:
  for j in range(n,m+1):
    if j%i==0:
      s.append(j)
  if len(s)>0:
    print('OK')
  else:
    print('NG')
a,b,c,d=map(int,input().split())
count=0
while True:
    c=c-b
    print(count+=1)
    if c<=0:
  		print("Yes")
  		break
	a=a-d
    print(count+=1)
  	if a<=0:
  		print("No")
  		break

### FIXED CODE ###


a, b, c, d = map( int, input().split() )
#print( a, b, c, d )
 
for i in range( 200 ):
    c = c - b
    if c <= 0:
        print( "Yes" )
        exit()
 
    a = a - d
    if a <= 0:
        print( "No" )
        exit()
def main():
    お寿司, 食べたい = map(int, input().split())
    築地 = [[] for _ in range(お寿司)]
    for _ in range(食べたい):
        鮪, 蛸 = map(lambda x: int(x) - 1, input().split())
        築地[鮪].append(蛸)
        築地[蛸].append(鮪)

    やってるかい = [False] * お寿司
    寿司くいねぇ = おなかすいた(0, 築地, やってるかい, 0)

    print(寿司くいねぇ)


def おなかすいた(市場, 築地, やってるかい, お勘定):
    やってるかい[市場] = True
    if all(やってるかい):
        return お勘定 + 1

    for 豪遊 in 築地[市場]:
        if やってるかい[豪遊]:
            continue
        お勘定 = おなかすいた(豪遊, 築地, やってるかい, お勘定)
        やってるかい[豪遊] = False

    return お勘定


if __name__ == '__main__':
    main()


### FIXED CODE ###

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

if a == b:
  print("Yes")
else:
  print("No")
S = int(h = (S / 3600), m = (S % 3600 / 60), for S in range(0, 60) input())
print(S)

### FIXED CODE ###

S = int(input())

s = S % 60
m = S // 60 % 60
h = S // 60 // 60

print("{0}:{1}:{2}".format(h,m,s))
from sys import stdin
A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
d = sorted([A,B,C])

a = A % 2
b = B % 2
c = C % 2

if a == b == c:
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    
elif a == b:
    A += 1
    B += 1
    d = sorted([A,B,C])
    ans += 1
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    
elif a == c:
    A += 1
    C += 1
    d = sorted([A,B,C])
    ans += 1
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2

elif c == b:
    A += 1
    C += 1
    d = sorted([A,B,C])
    ans += 1
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2

print(ans)

### FIXED CODE ###

from sys import stdin
A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
d = sorted([A,B,C])
 
a = A % 2
b = B % 2
c = C % 2
 
if a == b == c:
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    
elif a == b:
    A += 1
    B += 1
    d = sorted([A,B,C])
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    ans += 1
    
elif a == c:
    A += 1
    C += 1
    d = sorted([A,B,C])
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    ans += 1
 
elif c == b:
    B += 1
    C += 1
    d = sorted([A,B,C])
    ans = ((d[2] - d[1]) + (d[2] -d[0])) // 2
    ans += 1
 
    
print(ans)
import sys
import math
import bisect

def main():
	n = int(input())
    print(48 - n)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import math
import bisect
 
def main():
    n = int(input())
    print(48 - n)
 
if __name__ == "__main__":
    main()
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
# Ciの値でsortする、Tを0000で固定した後、最後に2**N倍
N = ir()
C = np.array(lr())
C.sort()
two_power = np.array([(1+N-i) * pow(2, (N-2), MOD) for i in range(N)])
answer = (C * two_power % MOD).sum() * pow(2, N, MOD)
print(answer%MOD)


### FIXED CODE ###

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# Ciの値でsortする、Tを0000で固定した後、最後に2**N倍
N = ir()
C = np.array(lr())
MOD = 10 ** 9 + 7
C.sort()
two_power = np.array([(1+N-i) * pow(2, (N-2), MOD) % MOD if i < N-1 else pow(2, i, MOD) for i in range(N)])
answer = (C * two_power % MOD).sum() * 2**N
print(answer%MOD)
l = (("A","T"),("G","C"))
i = inpit()
if i in l[0]:
  if i == l[0][0]:
    print(l[0][1])
  else: print(l[0][0])
else:
  if i == l[1][0]:
    print(l[1][1])
  else: print(l[1][0])

### FIXED CODE ###

# coding: utf-8

l = (("A","T"),("G","C"))
i = input()
if i in l[0]:
    if i == l[0][0]:
        print(l[0][1])
    else: print(l[0][0])
else:
    if i == l[1][0]:
        print(l[1][1])
    else: print(l[1][0])
from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,k=mis()
    ave=float(k/2)
    if n>=k:
        n%=k
        print(k%n)
        exit()
    else: print(n if n<ave else k-n)



if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,k=mis()
    if n>=k:
        n%=k
        print(k%n if n!=0 else 0)
        exit()    
    print(n if n<=k//2 else k-n)



if __name__ == "__main__":
    main()
S = input()
T = input()

if T.startswith(S):
  print("Yes")
  
else:
  primt("No")


### FIXED CODE ###

S = str(input())
T = str(input())

if T.startswith(S):
  print("Yes")
else:
  print("No")
A = int(input())
for i in 9:
  for j in 9:
    if i*j == A:
      print('Yes')
print('No')

### FIXED CODE ###

A = int(input())
def calc(A):
  for i in range(1, 10):
    for j in range(1, 10):
      if i*j == A:
        return 'Yes'
  return 'No'
print(calc(A))
from math import gcd

def lcm(a, b):
    return (a*b)//gcd(a,b)


def solve(a, b, c, d):
    div = ((b//c) - ((a-1)//c)) + ((b//d) - ((a-1)//d)) - ((b//lcm(c,d)) -
            ((a-1)//lcm(c,d))) 

    return (b - a + 1) - div

a, b, c, d = map(int, input().split())
print(solve(a,b,c,d))


### FIXED CODE ###

def gcd(a, b):
  return a if b == 0 else gcd(b, a%b)

def lcm(a, b):
    return (a*b)//gcd(a,b)

def solve(a, b, c, d):
    div = ((b//c) - ((a-1)//c)) + ((b//d) - ((a-1)//d)) - ((b//lcm(c,d)) -
            ((a-1)//lcm(c,d))) 

    return (b - a + 1) - div

a, b, c, d = map(int, input().split())
print(solve(a,b,c,d))
##E
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.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0

for i in range(X):
    if p[i] > r[0]:
        psum += p[i]
    else:
        psum += rsort[0]
        r.pop(0)
for i in range(Y):
    if q[i] > r[0]:
        psum += q[i]
    else:
        psum += r[0]
        r.pop(0)
print(psum)

### FIXED CODE ###

##E
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.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0

for i in range(X):
        r.append(p[i])
for i in range(Y):
        r.append(q[i])
        
r.sort(reverse=True)
ans = 0

for i in range(X+Y):
		ans += r[i]

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

ac = [0] * (n+1)
wa = [0] * (n+1)
pena = 0

for i in range(m):
    question, answer = input().split()
    question = int(question)
    if (answer == "AC") and (ac[question] == 0):
        ac[question] = 1
        pena += wa[question]
    elif (answer == "WA") and (ac[question] == 0):
        wa[question] += 1

print(sum(ac), pena)

### FIXED CODE ###

alpha2num=lambda c:ord(c)-ord('a')+1

result=(alpha2num(input()))

if result==1:
    print('b')
elif result==2:
    print('c')
elif result==3:
    print('d')
elif result==4:
    print('e')
elif result==5:
    print('f')
elif result==6:
    print('g')
elif result==7:
    print('h')
elif result==8:
    print('i')
elif result==9:
    print('j')
elif result==10:
    print('k')
elif result==11:
    print('l')
elif result==12:
    print('m')
elif result==13:
    print('n')
elif result==14:
    print('o')
elif result==15:
    print('p')
elif result==16:
    print('q')
elif result==17:
    print('r')
elif result==18:
    print('s')
elif result==19:
    print('t')
elif result==20:
    print('u')
elif result==21:
    print('v')
elif result==22:
    print('w')
elif result==23:
    print('x')
elif result==24:
    print('y')
elif result==25:
    print('z')