peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
x = int(input())

ans = int(x/11*2)
tmp = x%11
if tmp > 6:
    ans+=2
else:
    ans+=1

print(ans)
# Judge status: Accepted
from collections import defaultdict
mod = 10**9 + 7
n = int(input())
d = defaultdict(int)
for c in list(input()):
    d[c] += 1

res = 1
for c in d:
    res *= (d[c]+1)
    res %= mod
res = res + mod - 1
res %= mod
print(res)
# Judge status: Accepted
n, m = map(int, input().split())

right = 2*m+1

if m%2 == 0:
    for i in range(m//2):
        print(1+i, 1+m-i)
        print(2+m+i, right-i)

else:
    center = m+1
    for i in range(m//2):
        print(1+i, center-i)
        print(center+1+i, right-i)
    print(m//2+1, m//2+2)
# Judge status: Accepted
def main():
    X,K,D=map(int,input().split())

    zero_flag=0
    if abs(X)>=K*D:
        zero_flag=1

    if zero_flag==0:
        d=abs(X)%D
        d_=abs(X)//D
        if (K-d_)%2==1:
            print(abs(D-d))
        else:
            print(abs(X)-abs(D*d_))
    else:
        print(abs(X)-K*D)

if __name__=="__main__":
    main()
# Judge status: Accepted
n, m = map(int, input().split())
a = list(map(int, input().split()))

from fractions import gcd
from functools import reduce

a = [i >> 1 for i in a]

def applied_lcm(x, y):
    g = gcd(x, y)
    x //= g
    y //= g
    if x %2 == 0:
        return 0
    if y %2 == 0:
        return 0
    n = x * y * g
    if n >> 10**9:
        return 0

    return n

p = reduce(applied_lcm, a)
if p == 0:
    ans = 0
else:
    ans = (m//p) - (m//(p+p))
print(ans)
# Judge status: Accepted
import collections
N = int(input())
*A, = map(int, input().split())
print(max(collections.Counter(A + [a-1 for a in A] + [a+1 for a in A]).values()))
# Judge status: Accepted
s = input()
t = input()

if sorted(s) < sorted(t, reverse=True):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import math
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
logof2=[0]*N
mi=0
#print(A)
for i in range(N):
    logof2[i]=math.log2(A[i])
#print(logof2)
for i in range(M):
    if logof2[0]<0:
        break
    else:
        logof2[0]=logof2[0]-1
        logof2.sort(reverse=True)
    #print(logof2)
for i in range(N):
    mi=mi+math.floor(pow(2,logof2[i]))

print(mi)
# Judge status: Accepted
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
x,y=map(int,input().split())
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
if __name__ == "__main__":
    n, m = map(int, input().split())
    al = list(map(int, input().split()))
    al.sort()
    res = sum(al[:m])
    print(n - res)
# Judge status: Wrong Answer
a,b,c=map(int, input().split())

print(a*b/2)
# Judge status: Wrong Answer
s = input()

print("2017"+s[4:])
# Judge status: Accepted
S=input()
K=int(input())

ans=1
for i in range(min(len(S),K)):
    if S[i]!='1':
        ans=S[i]
        break
    
print(ans)
# Judge status: Accepted
x,a,b=map(int, input().split())

if a-b>=0:
  print("delicious")
  
elif (a-b)<0 and abs(a-b)<=x:
  print("safe")
else:
  print("dangerous")
# Judge status: Wrong Answer
a,v=(int(x) for x in input().split())
b,w=(int(x) for x in input().split())
t = int(input())

flag = 0
if v > w and a<=b:
    for i in range(t):
        if a+v*i >= b+w*i:
            flag = 1
            break

if flag ==1:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
def main():
    a,b,t = map(int,input().split())
    ans = 0
    for i in range(1,t + 1, 1):
        if i % a == 0:
            ans += b
    print(ans)
main()
# Judge status: Accepted
x = int(input())
if 400 <= x < 600:
    print(8)
elif 600 <= x < 800:
    print(7)
elif 800 <= x < 1000:
    print(6)
elif 1000 <= x < 1200:
    print(5)
elif 1200 <= x < 1400:
    print(4)
elif 1400 <= x < 1600:
    print(3)
elif 1600 <= x < 1800:
    print(2)
elif  1800 <= x < 2000:
    print(1)
# Judge status: Wrong Answer
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

X = i()
print(360//X)
# Judge status: Accepted
from heapq import heappush, heappop, heapify

def neg_int(n):
    return -int(n)
    
N, M = map(int, input().split())
a_list = list(map(neg_int, input().split()))
heapify(a_list)
for _ in range(M):
    a = -heappop(a_list)
    a //= 2
    heappush(a_list, -a)
print(-sum(a_list))
# Judge status: Accepted
n, k = map(int, input().split())
snuke = [1 for i in range(n)]
for _ in range(k):
	d = int(input())
	a = list(map(int, input().split()))
	for i in a:
		snuke[i -1] = 0
		
print(sum(snuke))
# Judge status: Accepted
N = int(input())
if N < 1000:
    print("ABC")
else:
    print("ABD")
# Judge status: Accepted
A, B = map(int,input().split())

ans = 0
def palindrome(string): return 0 if string==string[::-1] else 1
for i in range(A, B+1):
    if palindrome(str(i)) == 0 :
        ans += 1

print(ans)
# Judge status: Accepted
# coding:utf-8
import sys 
from collections import Counter
def main():
    n = int(input())
    a = list(map(int, [input() for i in range(n)]))
    a_count = Counter(a)
    ans = []

    for i in a_count.items():
        if i[1] % 2 != 0:
            ans.append(i[0])

    print(len(ans))
    
if __name__ == '__main__' :
    main()
# Judge status: Accepted
A,B=map(int,input().split())
if A==1:
  A=100
if B==1:
  B=100
  
if A>B:
  print("Alice")
elif A<B:
  print("Bob")
else:
  print("Draw")
# Judge status: Accepted
X=int(input())
x500=X//500
X=X%500
x5=X//5
print(x500*1000+x5*5)
# Judge status: Accepted
s = input()

for l in range(len(s) - 2, 0, -2):
    s = s[0:l]
    if s[0:l // 2] == s[l // 2:l]:
        break
print(l)
# Judge status: Accepted
N=int(input())
b=0
x = N //100
for y in range(100*x,105*x+1):
  if N==y:
    print(1)
    exit()
print(0)
# Judge status: Accepted
N = int(input().rstrip())
A = sorted([int(v) for v in input().rstrip().split()])

r = 1
for v in A:
    if v == 0:
        r = 0
        break

    r *= v
    if r > 1000000000000000000:
        r = -1
        break

print(r)
# Judge status: Wrong Answer
N,x = [int(hoge) for hoge in input().split()]
A = [int(hoge) for hoge in input().split()]
#x個のお菓子を配る。
#和がxを越えないように最も多い数のaを選ぶ
A.sort()
ans = 0
cur = 0
for a in A:
    cur += a
    if cur > x:
        print(ans)
        exit()
    ans += 1
print(ans)
# Judge status: Accepted
sx, sy, tx, ty = map(int,input().split())

dx = (tx - sx)
dy = (ty - sy)

s = 'U' * dy + 'R' * dx

s += 'D' * dy + 'L' * dx

s += 'L' + 'U' * (dy+1) + 'R' * (dx+1) + 'D'

s += 'R' + 'D' * (dy+1) + 'L' * (dx+1) + 'U'

print(s)
# Judge status: Accepted
S = list(input())

flg = True

for i in range(ord('a'), ord('z') + 1):
    if S.count(chr(i)) == 0:
        flg = False
        ans = chr(i)
        break

print("None" if flg else ans)
# Judge status: Accepted
n = int(input())
s = input()
import collections
temp1 = 0
for j in range(1,n-1):
    i,k = j-1,j+1
    while i >= 0 and k < n:
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            temp1 += 1
        i,k = i-1,k+1
c = collections.Counter(s)
temp2 = 1
for key in "RGB":
    temp2 *= c[key]
print(temp2-temp1)
# Judge status: Accepted
def solve():
    N, M, L = map(int, input().split())
    if N >= M+L:
        return 0
    return -(N-M-L)

print(solve())
# Judge status: Wrong Answer
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)


n = int(input())
t1 = int(input())
ans = 0
for _ in range(n-1):
    t2 = int(input())
    ans = t1*t2 // gcd(t1, t2)
    t1 = ans
print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    ls = [0]
    ans = []

    for i in range(1,N+1):
        ls.append(ls[-1]+i)
        ans.append(i)
        if N<=ls[-1]:
            break
                
    for i in range(len(ans)):
        if ans[i]==(ls[-1]-N):
            pass
        else:
            print(ans[i])

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = input()
if "9" in N:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
N, K = map(int, input().split())
p = list(map(int, input().split()))

p = sorted(p, reverse=True)
ans = 0
for k in range(K):
  ans += p[k]
# Judge status: Accepted
n, t = map(int, input().split())
res = 1000 + 1
for i in range(n):
    ci, ti = map(int, input().split())
    if ti <= t:
        res = min(res, ci)

if res == 1001:
    print("TLE")
else:
    print(res)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

x = [a, b, c, d]
y = [b, c, d, e]

def chk(x, y):
    return(abs(x - y))


result = 'Yay!'
for i in x:
    for j in y:
        if i != j:
            if chk(i, j) > k:
                result = ':('

print(result)
# Judge status: Wrong Answer
n,a,b = map(int, input().split())

count = (a+b) // n 
if count == 0:
    count = 2
con = count*(a+b)
if con - n > b:
    con -= b
    if con - n > a:
        print(a*(count-1))
    else:
        print(a*(count-1)+(a+b)*(count-1) + a -n-1)
else:
    print(a*count)
# Judge status: Accepted
import random
D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for k in range(D)]

def score(t):
    ret = 0
    last = [0]*26
    for k in range(D):
        last[t[k]-1] = k+1
        ret += s[k][t[k]-1]
        for i in range(26):
            ret -= c[i]*(k+1-last[i])
    return ret

ans = [1+k%26 for k in range(365)]
print(*ans,sep="\n")
# Judge status: Accepted
params = [int(input()) for i in range(3)]

a = params[0]
b = params[1]
h = params[2]

print(int((a + b)*h/2))
# Judge status: Accepted
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    S = input().strip()

    c = collections.Counter(S)
    ans = c["R"] * c["G"] * c["B"]

    for i in range(N):
        for j in range(i + 1, N):
            if j + j - i > N - 1:
                break
            if S[i] != S[j] and S[j] != S[j + j - i] and S[i] != S[j + j - i]:
                ans -= 1
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
s = list(input())
ans = "Yes"
s.sort()
if s[0] != s[1]:
    ans = "No"
elif s[2] != s[3]:
    ans = "No"
print(ans)
# Judge status: Accepted
X,Y,Z=map(int,input().split())
print((X-Z)//(Y+Z))
# Judge status: Accepted
import string
C = input()
R = string.ascii_lowercase

for i, r in enumerate(R):
  if r == C:
    print(R[i + 1])
# Judge status: Wrong Answer
n,x = map(int,input().split())
l_list = list(map(int,input().split()))
total = 0
ans = 0
for i in range(n):
    if total <= x:
        ans += 1
    else:
        break
    total += l_list[i]
print(ans)
# Judge status: Wrong Answer
n = int(input())
y_count = 0
x = 800*n

for i in range(1,n):
    if i%15==0:
        y_count+=1
    
print(x-y_count*200)
# Judge status: Accepted
#   AtCoder abc054 a
#   ストレッチ課題

#   入力
alice, bob = map(int, input().split())

#   判定
if alice == bob:
    print("Draw")
elif (alice == 1) or ((bob != 1) and (alice > bob)):
    print("Alice")
else:
    print("Bob")
# Judge status: Accepted
a, b, c, d, e = map(int, input().split())

hour = e // 60
min = e % 60

a += hour
b += min

if b >= 60:
    a += b // 60
    b %= 60

ans = 0
if b > d:
    c -= 1
    ans += 60 - (b - d)
else:
    ans += (d - b)

if c >= a:
    ans += 60 * (c - a)
else:
    print(0)
    exit()

print(ans)
# Judge status: Accepted
from collections import deque
from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
l = a[0]
r = a[-1]
ll = deque([l])
rl = deque([r])
for i in range(1,n-1):
    l = gcd(l,a[i])
    r = gcd(r,a[-(i+1)])
    ll.append(l)
    rl.appendleft(r)

llas = ll.pop()
rlas = rl.popleft()

res = max(llas,rlas)
for i in range(n-2):
    res = max(res, gcd(ll.pop(), rl.pop()))
print(res)
# Judge status: Wrong Answer
a = int(input())
b = int(input())

if a == 1 and b == 2:
  print(3)
elif a == 2 and b == 3:
  print(1)
else:
  print(2)
# Judge status: Accepted
S = {i:list(input()) for i in "abc"}
s = "a"
while S[s]:
    s = S[s].pop(0)
print(s.upper())
# Judge status: Accepted
n,m=map(int,input().split())
def divisor(n):
  ass=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      ass.append(i)
      if i!=n//i:ass.append(n//i)
  return ass
ans=0
for i in divisor(m):
  if m//i>=n:ans=max(ans,i)
print(ans)
# Judge status: Wrong Answer
print("Yes" if sum(list(map(int,input().split())))>=22 else "No")
# Judge status: Accepted
ab,bc,ca = map(int,input().split())
import math
print(math.floor(ab * bc / 2))
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    K, A, B = [int(x) for x in input().split()]

    if B - A <= 2 or K <= A:
        print(K + 1)
        return
    ans = A
    K -= (A - 1)
    ans += (K // 2) * (B - A)
    ans += K % 2
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N, K = map(int, input().split())
numlist = []
for i in range(K*2):
    numlist.append(list(map(int,input().split())))
anslist=[]

i=0
while i<K*2:
    if not i%2==0:
        anslist.append(numlist[i])
    i+=1

checklist=str(anslist)
ans=0
j=1
while j<N+1:
    check=j
    if str(check) not in checklist:
        ans+=1
    j+=1
    
print(ans)
# Judge status: Accepted
k=int(input())
x=7
for i in range(1,k+1):
  if x%k==0:
    print(i)
    break
  x=(x*10+7)%k
else:
  print(-1)
# Judge status: Accepted
s = input()
t = input()
count = 0
for i in range(len(s)):
  if s[i] != t[i]:
    count+=1
print(count)
# Judge status: Wrong Answer
# 1
s = input()
if (s[:2] == "AA" or s[:2] == "BB" or s[-2:] == "AA" or s[-2:] == "BB"):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
a,b,c=map(int,input().split())
k=int(input())
num=0
while a>=b:
    b*=2
    num+=1
    if b>a:
        break
while b>=c:
    c*=2
    num+=1
    if c>b:
        break
if num<=k:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, K = map(int, input().split())
S = input()

ans = 0
for i in range(N):
    if S[i] == 'L':
        if i - 1 < 0:
            continue
        if S[i - 1] == 'L':
            ans += 1
    else:
        if i + 1 >= N:
            continue
        if S[i + 1] == 'R':
            ans += 1


X = min(len([s for s in S.split('L') if s != '']), len([s for s in S.split('R') if s != '']))
ans += min(X, K) * 2
print(min(ans, N - 1))
# Judge status: Wrong Answer
n, y = map(int, input().split())

ans = [-1] * 3
i = 0

while i < n:
    j = 0
    while j < n-i:
        if i*10000 + j*5000 + (n-i-j)*1000 == y:
            ans[0] = i
            ans[1] = j
            ans[2] = n-i-j
        j += 1
    i += 1

print(ans[0], ans[1], ans[2])
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n<=k:
    print(n*x)
else:
    print(k*x+y*(n-k))
# Judge status: Wrong Answer
def main():
    N, K = (int(i) for i in input().split())
    A = []
    B = []
    from bisect import bisect_left
    for i in range(N):
        a, b = (int(i) for i in input().split())
        A.append(a)
        B.append(b)
    from itertools import accumulate
    B = list(accumulate(B))
    idx = bisect_left(B, K)
    # print(A, B, idx)
    print(A[idx])


if __name__ == '__main__':
    main()
# Judge status: Accepted
import math

def main():
    nums = [int(x) for x in input().split()]
    ave = sum(nums)/len(nums)
    print(math.ceil(ave))

if __name__=='__main__':
    main()
# Judge status: Accepted
n, T = map(int, input().split())
ans = 100000
for i in range(n):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
if ans == 100000:
    print("TLE")
else:
    print(ans)
# Judge status: Accepted
N,M=map(int,input().split())
ans=0
if N>1:
  ans += N*(N-1)//2
else:
  pass
if M>1:
  ans += M*(M-1)//2
else:
  pass
print(ans)
# Judge status: Wrong Answer
n = int(input())
cnt=0
for i in range(1,n):
    if len(str(i))%2 != 0:
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
n,d=map(int,input().split())
dis = [list(map(int,input().split())) for i in range(n)]

def is_square(n):
    res=n**0.5
    return res.is_integer()
  
  
cnt=0
for j in range(n-1):
    dist = 0
    for i in range(d):
        dist += (dis[j][i]-dis[j+1][i])**2
    if is_square(dist) == True: cnt+=1

dist = 0
for i in range(d):
    dist += (dis[0][i]-dis[-1][i])**2
if is_square(dist) == True: cnt+=1
print(cnt)
# Judge status: Accepted
N = int(input())
ans = 0
for i in range(1,N+1):
    if 10000 <= i <= 99999 or 100 <= i <= 999 or 1 <= i <= 9: 
        ans += 1
print(ans)
# Judge status: Wrong Answer
N=int(input())
M=N%10
if M==2 or 4 or 5 or 7 or 9:
  print("hon\n")
elif M==3:
  print("bon\n")
else:
  print("pon\n")
# Judge status: Wrong Answer
x,k,d = map(int,input().split())
n = (-x+k*d)//(2*d)
cur = float('inf')
if n < 0:
    print(x-k*d)
else:
    if n == 0:
        L = [0,1]
    else:
        L = [n-1,n,n+1]
    for i in range(len(L)):
        cur = min(cur, abs(x+L[i]*d-(k-L[i])*d))
    print(cur)
# Judge status: Wrong Answer
import math
import numpy as np

def action(A):
  B = np.array([0] * N)
  for i in range(N):
    s = math.ceil(i - A[i] - 0.5)
    e = math.ceil(i + A[i] + 0.5)
    if s < 0:
      s = 0
    if e > N:
      e = N
    B[s:e] += 1 
  return B

N, K = map(int, input().split())
A = np.array([int(s) for s in input().split()])

for i in range(K):
  A = action(A)
  
print(A)
# Judge status: Accepted
N = int(input())

ans = 0
f = 2
while True:
  if N%f==0:
    c = 0
    while N%f==0:
      N /= f
      c += 1
    n = 1
    while n*(n+1)//2<=c:
      n += 1
    ans += n-1
  if f*f>N:
    break
  f += 1
if N>1:
  ans += 1
print(ans)
# Judge status: Wrong Answer
def is_number(num):
    try:
        int(num)
        return True
    except:
        return False

A, B = map(int, input().split())
S = input()
for i in range(A):
    if not is_number(S[i]):
        print("No")
        exit()
if S[A] != "-":
    print("No")
    exit()
for i in range(A + 1, B):
    if not is_number(S[i]):
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
N = int(input())
A = [int(input()) for i in range(N)]

firstVal = max(A)
firstInd = A.index(firstVal)
secondVal = max(A[0:firstInd] + A[firstInd+1:])

for i in range(firstInd):
    print(firstVal)

print(secondVal)

for i in range(N-firstInd-1):
    print(firstVal)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 17:09:47 2020

@author: sd18016
"""   

x = int(input())

if x <= 6:
    print("1")
elif x <= 11:
    print("2")
else:
    a = x // 11
    b = x % 11
    if b == 0:
        print(2*a)
    elif b < 6:
        print(2*a+2)
    else:
        print(2*a+1)
# Judge status: Accepted
n=int(input())
a=10*5
def k(n):
    s=tuple(map(int,tuple(str(n))))
    return sum(s)

for i in range(1,n):
    s=k(i)+k(n-i)
    if a>s:
        a=s
print(a)
# Judge status: Accepted
MOD = 10**9 + 7

N = int(input())
S = input()
lis = [1] * 26
for i in range(N):
    lis[ord(S[i])-ord('a')] += 1
ans = 1
for i in range(26):
    ans *= lis[i]
    ans %= MOD
print(ans - 1)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))

if A.count(1)==0:
  print('-1')
  exit()
  
if A==sorted(A):
  print('0')
  exit()

ans=0
j=1

for i in range(N):
  if A[i]==j:
    ans+=1
    j+=1
    print('OK')
  else:
    print('a')
  
print(N-ans)
# Judge status: Wrong Answer
N=int(input())
A=[int(input()) for _ in range(N)]
A.sort()
ans=0
b=A[0]
c=0
for i in range(N):
  if b!=A[i]:
    ans+=(c%2)
    b=A[i]
    c=1
  else:
    c+=1
print(ans)
# Judge status: Accepted
N, A, B = map(int, input().split())

q, r = divmod(N, A + B)
ans = 0
ans += q * A
ans += min(r, A)

print(ans)
# Judge status: Wrong Answer
A, B = list(map(int, input().split())) 

if A+B > 24:
  print(A+B-24)
else:
  print(A+B)
# Judge status: Accepted
import sys
n,k=map(int,input().split())
d=list(map(int,input().split()))
allowed=set()
for i in d:
  allowed.add(i)
for i in range(n,10**7):
  b=str(i)
  c=set()
  for j in range(len(b)):
    c.add(int(b[j]))
  if allowed.intersection(c)==set():
    print(i)
    sys.exit()
# Judge status: Accepted
n, m, q = map(int, input().split())

abcd = [list(map(int, input().split())) for _ in range(q)]
from itertools import combinations_with_replacement as cwr
AList = list(cwr(range(1, m+1), n))


maxPoint = 0
for A in AList:
  point = 0
  for abc in abcd:
    a = abc[0]
    b = abc[1]
    c = abc[2]
    d = abc[3]
    if A[b-1] - A[a-1] == c:
      point += d
  if point > maxPoint:
    maxPoint = point
print(maxPoint)
# Judge status: Accepted
x, y, a, b, c = map(int, input().split())
p_list = sorted(list(map(int, input().split())))
q_list = sorted(list(map(int, input().split())))
r_list = sorted(list(map(int, input().split())))

p_list = p_list[a - x:]
q_list = q_list[b - y:]

pqr_list = p_list + q_list + r_list
pqr_list = sorted(pqr_list,reverse=True)
pqr_list = pqr_list[:x + y]

print(sum(pqr_list))
# Judge status: Wrong Answer
x=int(input())
print(round(x/2))
# Judge status: Accepted
a,b,c,d = map(int, input().split())

if a >= c:
    if a >= d:
        print(0)
    elif b >= d:
        print(d-a)
    else:
        print(b-a)
else:
    if b <= c:
        print(0)
    elif b <= d:
        print(b-c)
    else:
        print(d-c)
# Judge status: Accepted
# coding: utf-8
import sys

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

S = sr()
red = S.count('0')
blue = S.count('1')
answer = 2 * min(red, blue)
print(answer)
# Judge status: Accepted
n=input().rstrip().split()
if int(n[0])+int(n[1])>=int(n[2]):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
from collections import defaultdict


def resolve():
    s = input()

    cnt = defaultdict(int)
    cnt[0] += 1
    tmp = 0
    for i, c in enumerate(s[::-1]):
        c = int(c)
        tmp = (tmp + c * pow(10, i, 2019)) % 2019
        cnt[tmp] += 1

    ans = sum(c * (c - 1) // 2 for c in cnt.values())
    print(ans)


resolve()
# Judge status: Accepted
N,K = (int(x) for x in input().split())
S = list(input())

ans = N
count = 0

for i in range(N-1):
    if S[i] == S[i+1]:
        count += 1

print(min(N-1,count+2*K))
# Judge status: Accepted
N, K = map(int, input().split())
count = 0
arr = [list(map(int, input().split())) for _ in range(N)]
arr.sort()
for i in arr:
    count += i[1]
    if count >= K:
        print(i[0])
        exit()
print(arr[-1][0])
# Judge status: Accepted
import math

n, k = map(int, input().split())
aa = tuple(map(int, input().split()))

p = 0
for i in range(n):
    if aa[i] == 1:
        p = i
        break

n -= 1
k -= 1
x = math.ceil(n / k)
print(x)
# Judge status: Accepted
x, y = map(int, input().split())
if (x + y) % 3 != 0:
    print(0)
    exit()
a = (x + y) // 3
x -= a
y -= a
if x < 0 or y < 0:
    print(0)
    exit()
mod = 10 ** 9 + 7
def combination(n, r):
    x = 1
    y = 1
    for i in range(r):
        x = x * (n - i) % mod
        y = y * (r - i) % mod
    return (x * pow(y, mod-2, mod)) % mod
print(combination(x+y, min(x, y)))
# Judge status: Accepted
import sys

input = sys.stdin.readline

h, n = map(int, input().split())

magics = []
max_cost = 0
for _ in range(n):
    at, cost = map(int, input().split())
    max_cost = max(max_cost, cost)
    magics.append((at, cost))

dp = [float('inf')] * (h+max_cost)
dp[0] = 0
for i in range(len(dp)):
    for at, cost in magics:
        if at <= i:
            dp[i] = min(dp[i], dp[i-at] + cost)
print(min(dp[h:]))
# Judge status: Wrong Answer
line = int(input())
print(int((line * line * 3.14) / (1 * 1 * 3.14)))
# Judge status: Accepted
#!/usr/bin/env python3
N = int(input())
A = [int(s) for s in input().split()]

print(' '.join([str(s) for _, s in sorted(zip(A, list(range(1, N+1))))]))
# Judge status: Accepted
n,h,*ab = map(int,open(0).read().split())
a_max = max(ab[::2])
b_sort = sorted(ab[1::2],reverse = True)

ans = 0
i = 0
while h>0:
    if i<n and b_sort[i] > a_max:
        h -= b_sort[i]
        i += 1
        ans += 1
    else:
        ans += -(-h//a_max)
        h = 0
print(ans)