peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def gcd(a, b):
  if (b == 0):
    return a
  return gcd(b, a % b)

def gcd_xyz(x, y, z):
  xy = gcd(x, y)
  xyz = gcd(xy, z)
  return xyz

def past(p):
  if(p == 2):
    return 1
  else:
    return past(p-1)+(p-2)*4+6

K = int(input())
sum=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      sum += gcd_xyz(i,j,k)
print(sum)
# Judge status: Accepted
N , M = map(int, input().split())

ab = []
for _ in range(N):
    a, b = map(int, input().split())
    ab.append([a, b])

cd = []
for _ in range(M):
    c, d = map(int, input().split())
    cd.append([c, d])

# print(ab)
# print(cd)

for i in range(N):
    a, b = ab[i]
    tmp = float('inf')
    p = -1
    for j in range(M):
        c, d = cd[j]
        dist = abs(a-c)+abs(b-d)
        if tmp > dist:
            tmp = dist
            p = j+1
    print(p)
# Judge status: Accepted
def main():
    x, y, z = map(int, input().split())
    print(x*y//2)
    

main()
# Judge status: Accepted
a, b = map(int, input().split())
if a<=5 :
    print(0)
elif 6<= a <= 12:
    print(b//2)
else :
    print(b)
# Judge status: Accepted
a,b=map(int,input().split())

def factorization(n):
    a=[]
    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

s_a=set(factorization(a))
s_b=set(factorization(b))
ans_arr=s_a&s_b
print(len(ans_arr)+1)
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))

movable = [0]*N
i = 0
while i < N-1:
    j = i
    while j < N-1 and H[j] >= H[j+1]:
        movable[i] += 1
        j += 1
    i = i + movable[i] + 1

print(max(movable))
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))
L.sort()
if L[-1] < sum(L[:N-1]):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n, k = map(int, input().split())
count = 0
for i in range(n):
    a, b = map(int, input().split())
    count += b
    if count>=k:
        print(a)
        break
# Judge status: Accepted
h = int(input())
w = int(input())
n = int(input())
j = 0
k = 1
if h > w:
  j = h
else:
  j = w
while n > j:
  n = n - j
  k = k + 1
print(k)
# Judge status: Accepted
s = input()
n = len(s)
w = "keyence"
 
for i in range(7):
    if s[:i] == w[:i] and s[n-7+i:] == w[i:]:
        print("YES")
        exit()

print("NO")
# Judge status: Accepted
def main():
    s = input().rstrip()
    k = int(input())
    for i in range(len(s)):
        x = ord("z") - ord(s[i]) + 1
        if k >= x and x != 26:
            k -= x
            s = s[:i] + "a" + s[i+1:]
        if i == len(s)-1:
            s = s[:i] + (chr(ord(s[i]) + (k%26)))
    print(s)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n=int(input())
for i in range(n,999):
    if i%111==0:
        print(i)
        break
# Judge status: Accepted
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():
        s=input()
        print('ABC' if s=="ARC" else "ARC")


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N,K = map(int, input().split())
*D, = map(int, input().split())

l = [0,1,2,3,4,5,6,7,8,9]

for i in range(len(D)):
    l.remove(D[i])
l = set(l)

for n in range(N,10000,1):
    j = set(list(map(int, list(str(n)))))
    if l>=j:
        print(n)
        break
# Judge status: Accepted
c = [list(map(int, input().split())) for _ in range(3)]

c0 = [c[0][0]-c[0][1], c[0][0]-c[0][2], c[0][1]-c[0][2]]
c1 = [c[1][0]-c[1][1], c[1][0]-c[1][2], c[1][1]-c[1][2]]
c2 = [c[2][0]-c[2][1], c[2][0]-c[2][2], c[2][1]-c[2][2]]

if c0 == c1 == c2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a, b, t = map(int, input().split())
print((t+0.5)//a * b)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int,input().split()))
res = "APPROVED"
for a in A :
    if a % 2 == 0 and (a % 3 == 0 or a % 5 == 0) :
        res = "DENIED"
print(res)
# Judge status: Accepted
from itertools import permutations
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
i = a = b = 0
for x in permutations(range(1, N+1), N):
  i += 1
  if x == P:
    a = i
  if x == Q:
    b = i
print(abs(a - b))
# Judge status: Accepted
x,a,b = map(int,input().split())
if a>=b:
  print("delicious")
elif (b-a) <= x:
  print("safe")
else:
  print("dangerous")
# Judge status: Accepted
N,*A = map(int, open(0).read().split())
s = 0
m = 1000000007
for x in A:
    s = (s+x) % m
ans = 0
for x in A:
    s = (s-x) % m
    ans = (ans+x*s) % m
print(ans)
# Judge status: Wrong Answer
N = int(input())
print(int(N/2+0.5/N))
# Judge status: Accepted
a,b,c=map(int,input().split())
print('Yes' if (a>c and b<c) or (a<c and b>c) else 'No')
# Judge status: Accepted
N,M,X,Y = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
Xmax = max(A)
Ymin = min(B)
out = "War"
Xmax = max(Xmax,X)
Ymin = min(Ymin,Y)
if Xmax<Ymin:
    out = "No War"
print(out)
# Judge status: Accepted
n = int(input())
a = int(input())
if n%500 <= a:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
from collections import deque

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


left=0
right=0
for i in range(n):
  if s[i]=="(":
    left+=1
  else:
    if left>0:
      left-=1
    else:
      right+=1
    
      

for _ in range(left):
    s.append(")")
    

for _ in range(right):
    s.appendleft("(")

print("".join(s))
# Judge status: Accepted
import math
 
def dic(s):
  l = len(s)
  if l == 0:
    return 0
  c = s[0]
  tmp = ((sorted(s)).index(c)-1) * math.factorial(l -1)
  return tmp + dic(s[1:])
 
n = input()
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
 
print(abs(dic(s1)-dic(s2)))
# Judge status: Wrong Answer
n,x = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
a.sort()

for i in range(n):
  if x - a[i] >= 0:
    cnt += 1
    x -= a[i]
if x != 0:
  cnt -= 1

print(max(0,cnt))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
data = []
for i in range(N):
    data.append((A[i], i+1))

data.sort()
answer = []
for ele in data:
    answer.append(str(ele[1]))

print(" ".join(answer))
# Judge status: Wrong Answer
import math
A, B = map(int, input().split())
 
 
def prime_factorize(n):
    a = [1]
    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)
    a.sort()
    return a
 
 
print(len(prime_factorize(math.gcd(A, B))))
# Judge status: Wrong Answer
N = int(input())
h = list(map(int, input().split(" ")))

dp = [1000000 for i in range(N+10)]
dp[0] = 0
i = 0
for i in range(0, N-1):
    dp[i + 1] = min(dp[i + 1], abs(h[i + 1] - h[i]) + dp[i])
    if i + 2 < len(h) - 1:
        dp[i + 2] = min(dp[i + 2], abs(h[i + 2] - h[i]) + dp[i])

print(dp[N-1])
# Judge status: Accepted
A, B = map(int, input().split())
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
n=int(input())
if n%1000==0:
    print("0")
else:
    z=n//1000
    print((z+1)*1000-n)
# Judge status: Accepted
#!/usr/bin/env python3


def main():
    S = input()
    T = input()
    if S == T[:len(S)]:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import re
a = input()
b = input()
c = re.search('(\d+)\s(\d+)', a)
d = int(c.group(1))
e = int(c.group(2))
result = ''
for n in range(d):
    if n == d - 1:
        r = str(b[n]).lower()
        result += r
    else:
        result += b[n]
print(result)
# Judge status: Wrong Answer
n, k = map(int, input().split())
*A, = map(int, input().split())
l = A.index(1)
r = n-l-1
print(-(-l//(k-1))-(-r//(k-1)))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
d=Counter(a)
b=[]
for i in d:
  if d[i]>1:b.append(i)
  if d[i]>3:b.append(i)
if len(b)<2:exit(print(0))
b.sort()
print(b[-1]*b[-2])
# Judge status: Accepted
k,n = map(int, input().split())
al = list(map(int, input().split()))

res = al[-1] - al[0]
for i in range(1,n):
    r = k - al[i] + al[i-1]
    res = min(res, r)

print(res)
# Judge status: Accepted
import sys
from collections import defaultdict
import math

def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse=True)
    g = A[0]

    for i in range(1,N):
        g = math.gcd(g,A[i])

    print(g)





if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import math

N, K = map(int, input().split())
A = list(map(float, input().split()))

if K == 0:
  print(int(max(A)))
  exit()

if N == 1:
  print(math.ceil(A[0]/K))
  exit()


min_A = 0
max_A = max(A) + 1

while( max_A - min_A > 1):
  now = (min_A + max_A) // 2
  temp = 0
  for i in A:
    temp += (i // now)
  if temp > K:
    min_A = now
  else:
    max_A = now
print(min_A, max_A)
print(int(min_A) + 1)
# Judge status: Accepted
AB, BC, CA = map(int, input().split())

print(int(AB * BC / 2))
# Judge status: Accepted
x,y,z=map(int,input().split())

print((x-z)//(y+z))
# Judge status: Accepted
n, k, s = map(int, input().split())

result = []
if s < 3:
  result.extend([s + 1] * (n - k))
  result.extend([s] * k)
else:
  result.extend([s - 1] * (n - k))
  result.extend([s] * k)

print(*result)
# Judge status: Accepted
N = int(input())
A = [[] for _ in range(N)]
B = [[] for _ in range(N)]
for i in range(N):
    A[i], B[i] = map(int, input().split())

A.sort()
B.sort()
if N%2 == 1:
    m_min = A[N//2]
    m_max = B[N//2]
    diff = m_max - m_min
    print(diff +1)
else:
    m_min = (A[N//2-1] +A[N//2])/2
    m_max = (B[N//2-1] +B[N//2])/2
    diff = m_max - m_min
    print(int(diff//0.5)+1)
# Judge status: Accepted
input()
print(sum([int(i)%2 for i in input().split()[::2]]))
# Judge status: Accepted
S,C=map(int,input().split())
scc=0

if 2*S<=C:
    scc+=S
    C-=S*2
    scc+=C//4
else:
    scc=C//2
    
print(scc)
# Judge status: Accepted
a,b,c,d = input()
if a == b == c or d == b == c:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))

x = A[0]
ct = 0
for a in A:
    if x < a:
        x = a
    elif x > a:
        ct += (x-a)
print(ct)
# Judge status: Wrong Answer
# A - Range Product
a,b = map(int,input().split())
ans = 1
for x in range(a,b+1):
    ans *= x
if x>0:
    print('Positive')
elif x<0:
    print('Negative')
else:
    print('Zero')
# Judge status: Accepted
def f(n):
    if n == 1:
        return 1
    return f(n - 1) * n


n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
l = list(range(1, n + 1))
a = 0
for i, x in enumerate(p[:-1]):
    a += l.index(x) * f(n - i - 1)
    l.remove(x)
b = 0
l = list(range(1, n + 1))
for i, x in enumerate(q[:-1]):
    b += l.index(x) * f(n - i - 1)
    l.remove(x)
print(abs(b - a))
# Judge status: Accepted
A, B, C, D = map(int, input().split())

if A==C:
    print(min(B-A,D-C))

elif A<C:
    if B>=D:
        print(max(0,D-C))
    elif B<=D:
        print(max(0,B-C))

else:
    if D>=B:
        print(max(B-A,0))

    elif D<=B:
        print(max(D-A,0))
# Judge status: Accepted
S,W=map(int,input().split())
if S<=W:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())
x = 0
while a >= b:
    b *= 2
    x += 1
while b >= c:
    c *= 2
    x += 1
if x <= k:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
print("Yes")if len(set(input()))==len(set(input())) else print("No")
# Judge status: Wrong Answer
l=list(map(int, input().split()))
l.sort()
cnt=0
while l[0]!=l[2]:
    l.sort()
    print(l)
    if l[1] == l[2]:
        l[0] += 2
    else:
        l[0] += 1
        l[1] += 1
    cnt+=1

print(cnt)
# Judge status: Accepted
s = input()
se = set()
for c in s:
  se.add(c)
if len(se) == 2 and s.count(s[0]) == 2:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
        
l=[]
m=[]
for i in range(n-1):
    m.clear()
    for j in range(d):
        a=(x[i][j]-x[i+1][j])**2
        m.append(a)
    l.append(sum(m))

m.clear()
for k in range(d):
    b=(x[-1][k]-x[0][k])**2
    m.append(b)
l.append(sum(m))

c=0

for i in l:
    g=i**(0.5)
    if g.is_integer()==True:
        c+=1
    
print(c)
# Judge status: Wrong Answer
S = input()

hi = S.replace('hi', '')

if hi == "":
   print("yes")
else:
   print("No")
# Judge status: Accepted
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

from math import log10

n,k=nm()
a=nl()
b=[1]*(n+1)

for i in range(n):
  b[i+1] = log10(a[i])+b[i]

for i in range(n-k):
  if b[i+k+1]-b[i+1] > b[i+k]-b[i]:
    print('Yes')
  else:
    print('No')
# Judge status: Wrong Answer
N = list(input())
a = set(N)
a = list(a)
if len(a) <= 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from math import gcd

N, M = map(int, input().split())
A = list(map(int, input().split()))

memo = {}

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

b = 1

for a in A:
    b = lcm(a//2, b)
    if b > M:
        break

if any([2 * b // a % 2 == 0 for a in A]):
    print(0)
else:
    ans = M // b
    print(ans - ans // 2)
# Judge status: Accepted
s,w = map(int,input().split())
print('unsafe' if w >= s else 'safe')
# Judge status: Accepted
N, M, X, Y = map(int, input().split())
x = max(map(int, input().split()))+1
y = min(map(int, input().split()))

for i in range(x, Y+1):
  if X < i <= y:
    print("No War")
    exit()
print("War")
# Judge status: Wrong Answer
N = int(input())
S = str(input())
T = str(input())

res = 0
for i in range(N):
    if S[i:] == T[:N-i]:
        res = N-i

print(2 * N - res)
# Judge status: Wrong Answer

a, b, c = list(map(int, input().split(' ')))
cnt = 0
if a == b == c:
    cnt = -1  
else:
    while (a+1)%2 or (b+1)%2 or (c+1)%2:
        cnt += 1
        a,b,c=(b+c)/2,(a+c)/2,(a+b)/2

print(cnt)
# Judge status: Accepted
k = int(input())
a, b = tuple(map(int, input().split()))

for i in range(a, b+1):
    if i % k == 0:
        print('OK')
        exit()

print('NG')
# Judge status: Accepted
N = int(input())
for i in range(N//4+1):
    if (N-4*i) % 7 == 0:
        print("Yes")
        exit()
print("No")
# Judge status: Wrong Answer
N = int(input())
ans = ''
while N != 0:
    r = N%2
    N = (N-r)//(-2)
    ans += '1' if r else '0'

print(ans[::-1])
# Judge status: Wrong Answer
N,K=map(int,input().split())
p=[int(x) for x in input().split()]
T=[0 if x=='r' else (1 if x=='s' else 2) for x in input()]
B=[-1]*K

s=0
for i in range(N):
  v=(T[i]+2)%3
  if v!=B[i%K]:
    s+=p[v]
    B[i%K]=v
  else:
    B[i%K]=T[i]
    if i<N-K:
      if (T[i+K]+2)%3!=T[i]:
        B[i%K]=(T[i+K]+1)%3

print(s)
# Judge status: Accepted
# 6, 5, 6, 5, ...

x = int(input())
q = x // 11
r = x % 11
if r == 0:
    ans = q * 2
elif 1 <= r <= 6:
    ans = q * 2 + 1
elif 7 <= r <= 10:
    ans = q * 2 + 2
print(ans)
# Judge status: Accepted
def resolve():
    N = int(input())
    a = list(map(int, input().split()))
    cnt = 1
    ans = 0
    for i in range(N):
        if a[i] == cnt:
            cnt += 1
        else:
            ans += 1
    if ans == N:
        print(-1)
        return
    print(ans)

    return
resolve()
# Judge status: Accepted
n=int(input())
L=[[] for _ in range(n)]
ans=0
for i in range(n):
    L[i]=sorted(list(input()))
L=sorted(L)
tmp=1
ans=0
for i in range(n-1):
    if L[i]==L[i+1]:
        tmp+=1
    else:
        ans+=tmp*(tmp-1)//2
        tmp=1
ans+=tmp*(tmp-1)//2
print(ans)
# Judge status: Wrong Answer
s = input()
x = dict()
for i in s:
  if i in x:
    x[i]+=1
  else:
    x[i]=1

flag=False
for k,v in x.items():
  if v>=3:
    flag=True
    break
if flag:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
gcd = int(input())
count = 0

for a in range(1,gcd):
    for b in range(1,gcd,-1):
        if a*b < gcd:
            count += b
            break

print(count)
# Judge status: Wrong Answer
s = list(input())
if (s[0] == "A") and (s[2:-2].count("C")==1):
    print("aa")
    s[0] = "a"
    s[s[2:-2].index("C")+2] = "c"
    l = list()
    for i in range(len(s)):
        l.append(s[i].lower())
    #(s,l)
    if s == l:
        print("AC")
        exit()
print("WA")
# Judge status: Accepted
D, T, S = map(int, input().split())
if T * S >= D:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a <= c <= b:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
s = list(input())

size = len(s)


for i in range(size):
    s[i] = "x"

print(s)
# Judge status: Accepted
x, y = map(int, input().split())
print(min(y*j - x*i + (i,j).count(-1) for i, j in [[1,1],[1,-1],[-1,1],[-1,-1]] if y*j >= x*i))
# Judge status: Accepted
# -*- coding: utf-8 -*-

N = int(input())

c = {}

for n in range(1, N+1):
    n_list = list(str(n))
    first = n_list[0]
    end = n_list[-1]
    if first + end in c:
        c[first + end] += 1
    else:
        c[first + end] = 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        if str(i) + str(j) in c and str(j) + str(i) in c:
            ans += c[str(i) + str(j)] * c[str(j) + str(i)]

print(ans)
# Judge status: Wrong Answer
n=int(input())
d=list(map(int,input().split()))
if d[0]!=0:
    print(0)
    exit()
del d[0]
for i in range(n-1):
    if d[i]==0:
        print(0)
        exit()
dcnt=[0]*(n)
for i in range(n-1):
    dcnt[d[i]]+=1
for j in range(n-1,-1,-1):
    if dcnt[j]==0:
        del dcnt[j]
    else:
        break
if len(dcnt)==0:
    print(0)
    exit()
sum=1
for i in range(1,len(dcnt)):
    sum*=pow(dcnt[i-1],dcnt[i])
print(sum)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
if a + b + c > 22:
  print('bust')
elif a + b + c<=21:
  print('win')
# Judge status: Accepted
s = int(input())
#最後に切った場所がiであるようなパターンの数をdp[i]とする
dp=[0]*(s+1)
dp[0]=1
if s<3:
  print("0")  
else:
  for i in range(3,s+1):
    dp[i]=dp[i-1]+dp[i-3]
    dp.append(dp[i])
    score=dp[s]%(10**9+7)
  print(score)
# Judge status: Accepted
n = input()
l = n[-1]
m = int(l)
if m==3:
    print("bon")
elif m==0 or m==1 or m==6 or m==8:
    print("pon")
else: print("hon")
# Judge status: Accepted
s = input()
ans = 753

for i in range(len(s) - 2):
	substring = s[i: i + 3]	
	ans = min(ans, abs(753 - int(substring)))

print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
x = N % K
ans = min(abs(x-K), x)
print(ans)
# Judge status: Accepted
s = input()
print("2018/01/" + s[-2] + s[-1])
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
# Vacation

'''
3
10 40 70
20 50 80
30 60 90
'''

N = int(input())

dp = [[None] * 3 for _ in range(N)]
dp[0] = list(map(int, input().split()))
# print(dp)

for i in range(1, N):
    data = list(map(int, input().split()))
    print(data)

    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + data[0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + data[1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + data[2]

# print(dp)
print(max(dp[N-1]))
# Judge status: Accepted
N,X,Y = map(int, input().split())
cnt = [0]*N
for i in range(1,N+1):
    for j in range(i+1,N+1):
        if abs(X-i)+abs(j-Y)+1 < j-i:
            cnt[abs(X-i)+abs(j-Y)+1] += 1
        else:
            cnt[j-i] += 1
for i in range(1,N):
    print(int(cnt[i]))
# Judge status: Wrong Answer
print({1,2,3}.difference(set(map(int,input().split(' ')))))
# Judge status: Accepted
o=input()
e=input()
ans=""
for i in range(len(o)+len(e)):
    if i%2==0:
        ans+=o[i//2]
    else:
        ans+=e[i//2]
print(ans)
# Judge status: Accepted
r, g, b, = input().split()
print("YES" if int(g+b) % 4 == 0 else "NO")
# Judge status: Accepted
n, k = map(int, input().split())
s = input()
print(s[:k - 1] + s[k - 1].lower() + s[k:])
# Judge status: Wrong Answer
A = input().split()
 
if (int(A[0]) == int(A[1])) and (int(A[1]) == int(A[2])):
  print("No")
elif (int(A[0]) != int(A[1])) and (int(A[1]) != int(A[2])):
  print("No")
else:
  print("Yes")
# Judge status: Accepted
d=int(input())
c0=input().split()
cl=[]
csum=0
for i in range(26):
  c1=int(c0[i])
  cl.append(c1)
  csum+=c1
  
cd=[0 for i in range(26)]
for i in range(d):
  a0=input().split()
  addmax=0
  max26=0
  for j in range(26):
    a1=int(a0[j])
    add1=a1+(cd[j]+1)*cl[j]
    if addmax<add1:
      addmax=add1
      max26=j
  print(max26+1)
  for j in range(26):
    if j!=max26:
      cd[j]+=1
# Judge status: Accepted
a,b = input().split()
print(int(a) * int(b))
# Judge status: Wrong Answer
n, t = map(int, input().split())
res = t + 1
for i in range(n):
    ci, ti = map(int, input().split())
    if ti <= t:
        res = min(res, ci)

if res == t + 1:
    print("TLE")
else:
    print(res)
# Judge status: Accepted
N = int(input())

cnt = 0
for i in range(1, N + 1):
    if len(str(i)) % 2 == 1:
        cnt += 1
    
print(cnt)
# Judge status: Accepted
import collections

N = int(input())
A_list = list(map(int, input().split()))
A_collection = collections.Counter(A_list)

for i in range(N):
    print(A_collection[i+1])
# Judge status: Accepted
n=int(input())
h=list(map(int,input().split()))
ans="Yes"
FL=False
Fx=-1
for i in range(n-1):
  if n==1:
    break
  if h[i]>=Fx:
    FL=False 
  if h[i]-h[i+1]==1:
    if FL:
      ans="No"
      break  
    else:
      FL=True
      Fx=h[i]
  elif h[i]-h[i+1]>1:
    ans="No"
    break  
    
print(ans)
# Judge status: Accepted
s=input()
k=int(input())
fl=0
t=0
ans='1'
for i in range(len(s)):
  if s[i]=='1' and fl==0:
    t+=1
  else:
    if fl==0:
      ans=s[i]
      fl=1
if t>=k:
  ans='1'
print(ans)
# Judge status: Accepted
n=int(input())
if n<1000:
    print('ABC')
else:
    print('ABD')
# Judge status: Accepted
x = int(input())

money = 100
ans = 0
while money < x:
    ans += 1
    money *= 101
    money //= 100

print(ans)
# Judge status: Accepted
import math
N = int(input())
print(2**math.floor(math.log(N,2)))
# Judge status: Wrong Answer
L = [chr(ord('a') + i) for i in range(26)]
U = [chr(ord('A') + i) for i in range(26)]
 
a = input()
if a in U:
    print('a')
if a in L:
    print('A')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
b = len([a for a in A if a % 4 == 0])
c = len([a for a in A if a % 2])
d = len([a for a in A if a % 2 == 0 and a % 4])
print("YNeos"[not(b>=c if d else b >= c-1)::2])
# Judge status: Accepted
import math

X = int(input())

x = math.ceil(X / 11)

if 11 * x - 4 <= X:
  print(2 * x)
else:
  print(2 * x - 1)
# Judge status: Accepted
n = int(input())
x = [ int(x) for x in input().split() ]

s = sum(x)
avg = s // n

t = u = 0
for e in x:
    t += (e - avg)**2
    u += (e - (avg + 1))**2

print(min([t, u]))
# Judge status: Wrong Answer
from sys import stdin

def I(): return int(stdin.readline().rstrip())

a,b,h = [I() for i in range(3)]

ans = (a+b)*h/2

print(ans)
# Judge status: Wrong Answer
a=2
b=5
print(a*b)
# Judge status: Accepted
N, x = map(int, input().split())
A = list(map(int, input().split()))
sum_A = sum(A)

for i in range(1, N):
    diff = A[i - 1] + A[i] - x
    if diff <= 0:
        continue
    v1 = min(A[i], diff)
    v2 = diff - v1
    A[i] -= v1
    A[i - 1] -= v2
    # print('A', A)
ans = sum_A - sum(A)
print(ans)
# Judge status: Wrong Answer
N = int(input())
if N%2 == 0:
    a = N/2
else:
    a = N//2+1

print(a)
# Judge status: Wrong Answer
import  sys
N=int(input())
a = [int(input()) for _ in range(N)]
cnt=1
t=1
for i in range(10**5):
    cnt+=1
    t=a[t-1]
    if a[t-1]==2:
        print(cnt)
        sys.exit()

print(-1)
# Judge status: Accepted
#!/usr/bin/env python3


def main():
    x = int(input())
    ans, mod = divmod(x, 11)
    ans *= 2
    if mod >= 7:
        ans += 2
    elif mod > 0:
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
# coding: utf-8
X,Y,A,B,C = list(map(int, input().split()))
P = sorted(list(map(int, input().split())))[-X:]
Q = sorted(list(map(int, input().split())))[-Y:]
R = list(map(int, input().split()))

total = sorted(P + Q + R)[-X-Y:]
print(sum(total))