Harryxun/stf_run huggingface dataset:
s = [*input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)

### FIXED CODE ###

s = [s for s in input()]
ans = 1000
for i in range(len(s)-2):
    x = int(s[i]+s[i+1]+s[i+2])
    if ans > abs(753-x):
        ans = abs(753-x)
print(ans)
from collections import deque
import sys
input = sys.stdin.readline

def bfs(graph, out, start):
    queue = deque([])
    queue.append(start)
    pos[start] = 0
    dis = {0:start}
    mx = 0
    mn = 0
    mod = 10**9

    while queue:
        u = queue.popleft()
        if u not in graph:
            if graph != {}:
                u = min(graph.keys())
            else:
                continue
        for v,d in graph[u].items():
            if v not in pos:
                pos[v] = pos[u] + d
                dis[pos[u] + d] = v
                queue.append(v)
                if pos[v]> mx:
                    mx = pos[v]
                    if mx - mn > mod:
                        return False
            elif pos[v] != pos[u] + d:
                return False
        del graph[u]
        if u not in out:
            continue
        for v,d in out[u].items():
            if v not in pos:
                pos[v] = pos[u] + v
                queue.append(v)
                if pos[v] < mn:
                    mn = pos[v]
                    if mx - mn > mod:
                        return False
            elif pos[v] != pos[u] + d:
                return False
        # print(queue)
    return True

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

graph = {}
out = {}
for i in range(m):
    l,r,d = map(int, input().split())
    if l not in graph:
        graph[l] = {}
    graph[l][r] = d
    if r not in out:
        out[r] = {}
    out[r][l] = -d

pos = {}
if m == 0 or bfs(graph, out, min(graph.keys())):
    print('Yes')
else:
    print('No')

# print(graph)
# print(pos)


### FIXED CODE ###

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

def bfs(graph, start):
    while graph != {}:
        start = min(graph.keys())
        queue = deque([])
        queue.append(start)
        pos = {}
        pos[start] = 0
        while queue:
            u = queue.popleft()
            for v,d in graph[u].items():
                if v not in pos:
                    pos[v] = pos[u] + d
                    if v in graph:
                        queue.append(v)
                elif pos[v] != pos[u] + d:
                    return False
            del graph[u]
            # print(queue)
    return True

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

graph = {}
for i in range(m):
    l,r,d = map(int, input().split())
    if l not in graph:
        graph[l] = {}
    graph[l][r] = d
    if r not in graph:
        graph[r] = {}
    graph[r][l] = -d

if m == 0 or bfs(graph, min(graph.keys())):
    print('Yes')
else:
    print('No')
# print(graph)
ls = input().split()
s = list(input())

n = int(ls[0])
k = int(ls[1])

if s[k] == 'A':
  s[k] == 'a'
elif s[k] == 'B':
  s[k] == 'b'
elif s[k] == 'C':
  s[k] == 'c'
  
print(''.join(s))

### FIXED CODE ###

ls = input().split()
s = list(input())
 
n = int(ls[0])
k = int(ls[1]) - 1
 
if s[k] == 'A':
  s[k] = 'a'
elif s[k] == 'B':
  s[k] = 'b'
elif s[k] == 'C':
  s[k] = 'c'
  
print(''.join(s))
N = input()
S = 0
for n in N:
  S += int(n)

if S % N:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

N = input()
S = 0
for n in N:
  S += int(n)

if int(N) % S:
  print('No')
else:
  print('Yes')
s=list(input())

ch=[]
for i in range(len(s)):
    if s[i]!='x':
        ch.append(s[i])
        
error=0
for i in range(len(ch)//2):
    if ch[i]!=ch[len(ch)-i-1]:
        error=1
        break

if error==1:
    print('-1')
else:
    ans=0
    li=0
    ri=0
    for i in range(len(ch)//2+1):
        x=0
        while s[li]!=ch[i]:
            x += 1
            li += 1
        li += 1
        y=0
        while s[len(s)-1-ri]!=ch[len(ch)-1-i]:
            y += 1
            ri += 1
        ri += 1
        ans += abs(x-y)
    print(ans)

### FIXED CODE ###

s=list(input())

ch=[]
for i in range(len(s)):
    if s[i]!='x':
        ch.append(s[i])

if len(ch)==0:
    print(0)
    exit()
for i in range(len(ch)//2):
    if ch[i]!=ch[len(ch)-i-1]:
        print(-1)
        exit()

ans=0
li=0
ri=0
for i in range(len(ch)//2+1):
    x=0
    while s[li]!=ch[i]:
        x += 1
        li += 1
    li += 1
    y=0
    while s[len(s)-1-ri]!=ch[len(ch)-1-i]:
        y += 1
        ri += 1
    ri += 1
    ans += abs(x-y)

print(ans)
#!/usr/bin/env python3

MOD = int(1e9)+7

def extgcd(a, b):
    if b == 0:
        return [1, 0, a]
    x, y, g = extgcd(b, a%b)
    return [y, x - a//b * y, g]


def mod_inverse(a, m):
    x, y, _ = extgcd(a, m)
    return (m+x%m) % m


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

maxf = 2*n + 10
f = [1 for _ in range(maxf)]
invf = [1 for _ in range(maxf)]

for i in range(1, maxf):
    f[i] = (i * f[i - 1]) % MOD
 
invf[maxf-1] = pow(f[maxf - 1], MOD-2, MOD)
for i in range(maxf-1, 0, -1):
    invf[i-1] = (i*invf[i]) % MOD
 
def comb(a, b):
    if b > a:
        return 0
    return (((f[a]*invf[b]) % MOD) * invf[a-b]) % MOD

a = [ int(x) for x in input().split() ]
a.sort(reverse=True)

ans = 0

for i, v in enumerate(a):
    ans += v*comb(n-i-1, k-1)
    ans %= MOD
    ans -= v*comb(i, k-1)
    ans %= MOD
    
print(ans)



### FIXED CODE ###

N = input()
A = map(int, raw_input().split())
 
MOD = 10 ** 9 + 7

def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

def lcm(x, y):
    return x/gcd(x, y)*y
 
l = A[0]
for a in A:
    l = lcm(l, a)
 
res = 0
for a in A:
    res = (res + (l * pow(a, MOD - 2, MOD)) % MOD) % MOD
 
print(res)
n, m = map(int, input().split())
nnode = [0]*n
for _ in range(n):
    a, b = map(int, input().split())
    nnode[a-1] += 1
    nnode[b-1] += 1
for i in nnode:
    if i%2==1:
        print('NO')
        break
else:
    print('YES')

### FIXED CODE ###

n, m = map(int, input().split())
nnode = [0]*n
for _ in range(m):
    a, b = map(int, input().split())
    nnode[a-1] += 1
    nnode[b-1] += 1
for i in nnode:
    if i%2==1:
        print('NO')
        break
else:
    print('YES')
from collections import deque
import sys

input = sys.stdin.readline
b = deque(map(int, input()))
cnt = 0
i = 0
while len(b) > 1:

    if len(list(set(b))) == 1:
        break
    if b[i] != b[i + 1]:
        b.pop(i)
        b.pop(i)
        cnt += 1
        i = 0
        continue
    i += 1
print(cnt * 2)


### FIXED CODE ###

s = input()
zom = min(s.count("1"),s.count("0"))
if len(set(list(s))) == 1:
    zom = 0
print(zom*2)
N,A = map(int,input().split())
x = list(map(int,input().split()))
xsum =sum(x)

dp = [ [ [ 0 for j in range(N+1)] for i in range(xsum+1) ] for k in range(N+1)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(xsum+1):
        for k in range(N):
            if j - x[i] >=0:
                dp[i+1][j][k+1] = dp[i][j-x[i]][k]
            dp[i+1][j][k] += dp[i][j][k]

ans = 0
for k in range(1,N+1):
    ans += dp[N][A*k][k]
print(ans)


### FIXED CODE ###

N,A = map(int,input().split())
x = list(map(int,input().split()))
xsum =sum(x)

dp = [ [ [ 0 for j in range(N+1)] for i in range(2501) ] for k in range(N+1)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(2501):
        for k in range(N):
            if j - x[i] >=0:
                dp[i+1][j][k+1] = dp[i][j-x[i]][k]
            dp[i+1][j][k] += dp[i][j][k]

ans = 0
for k in range(1,N+1):
    ans += dp[N][A*k][k]
print(ans)
n = int(input())
a = list(map(int, input().split()))

nn = n + max(a)
ml = [0] * nn
pl = [0] * nn

out = 0

for i in range(0, n):
    pl[i+a[i]] += 1
    if(i-a[i]>=0):
        ml[i-a[i]] += 1

for i in range(0, nn):
    out += pl[i] * ml[i]

print(out)


### FIXED CODE ###

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

ml = [0] * n
pl = [0] * n

out = 0

for i in range(0, n):
    if(i+a[i]<n):
        pl[i+a[i]] += 1
    if(i-a[i]>=0):
        ml[i-a[i]] += 1

for i in range(0, n):
    out += pl[i] * ml[i]

print(out)
while (True):
  st = input()
  st = [i for i in st if i in ["(",")","[","]"]
  han = []
  ans = "Yes"
  for i in st:
    if i == "(":
      han.append("maru")
    elif i == "[":
      han.append("kaku")
    elif i == ")":
      if han == []:
        ans = "No"
        break
      elif han[-1] == "maru":
        del han[-1]
      else:
        ans = "No"
        break
    elif i == "[":
      if han == []:
        ans = "No"
        break
      elif han[-1] == "kaku":
        del han[-1]
      else:
        ans = "No"
        break
  if ans == "No" or han != []:
    print("No")
  else:
    print(ans)


### FIXED CODE ###

while (True):
  st = input()
  if st == ".":
      quit()
  han = []
  ans = "yes"
  for i in st:
    if i == "(":
      han.append("maru")
    elif i == "[":
      han.append("kaku")
    elif i == ")":
      if han == []:
        ans = "no"
        break
      elif han[-1] == "maru":
        del han[-1]
      else:
        ans = "no"
        break
    elif i == "]":
      if han == []:
        ans = "no"
        break
      elif han[-1] == "kaku":
        del han[-1]
      else:
        ans = "no"
        break
  if ans == "no" or han != []:
    print("no")
  else:
    print(ans)
s = int(input())
l = s / 100
r = s % 100

if(1 <= l && l <= 12):
    if(1 <= r && r <= 12):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if(1 <= r && r <= 12):
        print('YYMM')
    else:
        print('NA')

### FIXED CODE ###

s = int(input())
l = s / 100
r = s % 100

if(1 <= l and l <= 12):
    if(1 <= r and r <= 12):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if(1 <= r and r <= 12):
        print('YYMM')
    else:
        print('NA')
first = input()
split_first = first.split()

d = int(split_first[0])
a = int(split_first[1])
b = int(split_first[2])

if a >= b:
   print ('delicious')
else if b - a <= d:
   print ('safe')
else:
   print ('dangerous')

### FIXED CODE ###

stdin = input()

d = int(stdin.split(" ")[0])
a = int(stdin.split(" ")[1])
b = int(stdin.split(" ")[2])

if b <= a:
    print ("delicious")
elif b <= a + d:
    print ("safe")
elif b > a + d:
    print ("dangerous")
n, = map(int,input().split())
li = input().split()
h_list = [int(li[i]) for i in range(n)]

indices = [*range(len(h_list))]
sorted_indices = sorted(indices, key=lambda i: h_list[i])
answer = [sorted_indices[i] + 1 for i in range(n)]
print(answer)

### FIXED CODE ###

n, = map(int,input().split())
li = input().split()
h_list = [int(li[i]) for i in range(n)]


sorted_indices = sorted(range(n), key=lambda i: h_list[i])
answer = [str(sorted_indices[i] + 1) for i in range(n)]
print(' '.join(answer))
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
A = set(map(int, input().split()))
A = sorted(A)

ans = 1
for i in range(1, A[1]+1):
    if A[0] % i != 0 and A[1] % i != 0:
        continue
    else:
        if len(list(filter(lambda x: x % i != 0, A))) <= 1:
            ans = i
print(ans)


### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


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


N = int(input())
A = list(map(int, input().split()))
L = [0]*(N+1)
R = [0]*(N+1)

for i in range(N):
    L[i+1] = gcd(L[i], A[i])

for i in reversed(range(N)):
    R[i] = gcd(R[i+1], A[i])

ans = max([gcd(x, y) for x, y in zip(L, R[1:])])
print(ans)
n = int(input())
s = input()
k = int(input())

ans = ""
for i in s:
	if i == s[k]:
    	ans += s[k]
	else:
    	ans += "*"
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
k = int(input())

ans_list = []
t = s[k-1]
for i in s:
  if i == t:
    ans_list.append(t)
  else:
    ans_list.append("*")
print("".join(ans_list))
S = input()
list1 = list(S)

list2 = [0 for i in range(len(list1))]

t = 0 #現在地
coutR = 0
coutL = 0
RLsindex = 0

def countLnum(t,coutL):
        if t+2 >= len(list1):
                return coutL
        elif list1[t+2] == "R" :
                return int(coutL)
        else:
                coutL = countLnum(t+1,coutL+1)
                return coutL


def RLstart(t,coutL):
        list2[t] +=1
        list2[t+1] +=1 #RL部分の初期値はそのままループし続ける
        if coutR %2 ==0:
                list2[t] += int(coutR/2)
                list2[t+1] += int(coutR/2)
        else:
                list2[t] += int(coutR/2 -0.5)
                list2[t+1] += int(coutR/2 +0.5)
        if coutL %2 == 0 :
                list2[t] += int(coutL/2)
                list2[t+1] += int(coutL/2)
        else:
                list2[t] += int(coutL/2 +0.5)
                list2[t+1] += int(coutL/2 -0.5)


while t < len(list1):
        if list1[t] == "R":
                if list1[t+1] == "R":
                        coutR += 1
                        t += 1
                elif list1[t+1] == "L":
                        coutL = countLnum(t,0)
                        RLstart(t,coutL)
                        t+=2 + coutL
                        coutR,coutL = 0,0
s = ""
for i in range(len(list2)):
        s += str(list2[i]) + " "
print(s)

### FIXED CODE ###

s = input()

import sys
sys.setrecursionlimit(1000000)
list1 = [0]*len(s)


def r_search(start,index,count):
    if s[index] == "L":
        count -= 1 #RLで計算が始まる為
        if count == 0: #LRLの要な場合
            list1[index-1] += 1
            list1[index] += 1
            return index+1
        elif count %2 != 0: #奇数
            list1[index-1] += count//2 + 1 #このへんの+1は元々のRLの分
            list1[index] += count//2 +1 + 1
            return index+1
        else: #偶数
            list1[index-1] += count//2 + 1
            list1[index] += count//2 + 1
            return index+1
    else:
        return r_search(start,index+1,count+1)
        



def l_search(start,index,count): #start-1がL,-2がRで有ることが決まっている
    if index >= len(s) or s[index] == "R":
        if count %2 != 0: #奇数の場合逆側に１多く入る
            list1[start-2] += count//2+1
            list1[start-1] += count//2
            return index
        else:
            list1[start-2] += count//2
            list1[start-1] += count//2
            return index

    else:
        return l_search(start,index+1,count+1)
i = 0
while True:
    if i >= len(s):
        break
    elif s[i] == "R":
        i = r_search(i,i,0)
    else:
        i = l_search(i,i,0)
print(" ".join(map(str,list1)))
N = int(input())

d = list(map(int,input().split()))

S = sum(d)

ans = 0

for i in range(N):
    ans += (S-d[i])*d[i]
print(ans(

### FIXED CODE ###

N = int(input())

d = list(map(int,input().split()))

S = sum(d)

ans = 0

for i in range(N):
    ans += (S-d[i])*d[i]
print(int(ans/2))
import math

def main():
    a, b, x = map(int, input().split())
    mid = a**2*b/2
    c = x/(a**2)
    if mid == x:
        ans = 90 - math.degrees(math.atan(a/b))
    elif mid < x:
        d = 2*x/(a**2) - b
        ans = 90 - math.degrees(math.atan(a/(b-d)))
    else:
        d = 2*a*c/b
        ans = 90 - math.degrees(math.atan(d/b))

    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import math

def main():
    a, b, x = map(int, input().split())
    if a*a*b == x:
        print(0)
        return
    mid = a**2*b/2
    c = x/(a**2)
    if mid == x:
        ans = 90 - math.degrees(math.atan(a/b))
    elif mid < x:
        d = 2*x/(a**2) - b
        ans = 90 - math.degrees(math.atan(a/(b-d)))
    else:
        d = 2*a*c/b
        ans = 90 - math.degrees(math.atan(d/b))

    print(ans)

if __name__ == "__main__":
    main()
[a, b, c] = [x for x in map(int, input().split(' '))]
k = int(input())
a_b_flg = False if a >= b else True
b_c_flg = False if b >= c else True

for kdx in range(0, k):
  if not a_b_flg:
    b = b*2
  elif not b_c_flg:
    c = c*2
  a_b_flg = False if a >= b else True
  b_c_flg = False if b >= c else True
  if a_b_flgw and b_c_flg:
    print('Yes')
    break
if not (a_b_flgw and b_c_flg):
  print('No')

### FIXED CODE ###

[a, b, c] = [int(x) for x in input().split(" ")]
k = int(input())
a_b_flg = False if a >= b else True
b_c_flg = False if b >= c else True

for kdx in range(0, k):
  if not a_b_flg:
    b = b*2
  elif not b_c_flg:
    c = c*2
  a_b_flg = False if a >= b else True
  b_c_flg = False if b >= c else True
  if a_b_flg and b_c_flg:
    print('Yes')
    break
if not (a_b_flg and b_c_flg):
  print('No')
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

v = a * a * b
s = 0
try:
    s = x / a
except:
    s = 0

import math

if x < v / 2:
    # print(math.degrees(math.atan(2 * s / b / b)))
    print(90 - math.degrees(math.atan(2 * s / b / b)))
else:
    print(90 - math.degrees(math.atan(a / (b - (2 * s / a - b)))))



### FIXED CODE ###

import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b, x = map(int, readline().split())

v = a * a * b
s = x / a

if x == v:
    print(0)
    exit()

if x <= v / 2:
    # print(math.degrees(math.atan(2 * s / b / b)))
    print(90 - math.degrees(math.atan(2 * x / a / b / b)))
else:
    print(90 - math.degrees(math.atan(a / (b - (2 * s / a - b)))))
N, K = map(int, input().split())
print("No" if K < N else "Yes\n" + "\n".join(map(str, range(1, K * 2))))

### FIXED CODE ###

N = int(input())
a, b = input(), input()

result = 0
for i in range(N):
    if b.startswith(a[i:]):
        break
    result += 1
print(result + N)
# def i():
#     yield "100000"
#     a = 0
#     b = 0
#     c = 0
#     l = []
#     for i in range(100000):
#         import random
#         r = random.randint(0, 2)
#         if r == 0:
#             l.append(str(a))
#             a += 1
#         elif r == 1:
#             l.append(str(b))
#             b += 1
#         else:
#             l.append(str(c))
#             c += 1
#     yield " ".join(l)
# input = i().__next__
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    cur = 1
    nums = []
    for i in range(N):
        if A[i] == 0:
            cur *= 1
            nums.append(0)
            continue
        #A[i] != 0
        cnt = 0
        for j, n in enumerate(nums):
            if n == A[i] - 1:
                if cnt == 0:
                    if len(nums) <= j:
                        print(0)
                        return
                    nums[j] += 1
                cnt += 1
        cur *= cnt
        cur %= 10**9+7
        # print(nums)
    m = [0, 3, 6, 6]
    
    print((cur * m[len(nums)]) % (10**9+7))
main()

### FIXED CODE ###

# def i():
#     yield "100000"
#     a = 0
#     b = 0
#     c = 0
#     l = []
#     for i in range(100000):
#         import random
#         r = random.randint(0, 2)
#         if r == 0:
#             l.append(str(a))
#             a += 1
#         elif r == 1:
#             l.append(str(b))
#             b += 1
#         else:
#             l.append(str(c))
#             c += 1
#     yield " ".join(l)
# input = i().__next__
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    cur = 1
    nums = []
    for i in range(N):
        if A[i] == 0:
            cur *= 1
            nums.append(0)
            continue
        #A[i] != 0
        cnt = 0
        for j, n in enumerate(nums):
            if n == A[i] - 1:
                if cnt == 0:
                    if len(nums) <= j:
                        print(0)
                        return
                    nums[j] += 1
                cnt += 1
        cur *= cnt
        cur %= 10**9+7
        # print(nums)
    m = [0, 3, 6, 6]
    if len(nums) >= 4:
        print(0)
        return
    
    print((cur * m[len(nums)]) % (10**9+7))
main()
#C - Guess The Number
n,m = list(map(int,input().split()))
tmp = []
s = []
c = []
flg = False
counter = 0
ans = 0
tmp = [input() for i in range(m)]
for i in tmp:
    i.split()
    s.append(i[0])
    c.append(i[2])
if(n ==3):
  for j in range(100,1000):
    if(flg == True):
      break
    list_j = list(str(j))
    counter = 0
    for k in s:
        if(list_j[int(k)-1] != c[counter]):
          break
        if(list_j[int(k)-1] == c[counter]):
          counter += 1
          if(counter == len(c)):
            flg = True
            break
    if(flg == True):
      ans = j
      break
if(n ==2):
  for j in range(10,100):
    if(flg == True):
      break
    list_j = list(str(j))
    counter = 0
    for k in s:
        if(list_j[int(k)-1] != c[counter]):
          break
        if(list_j[int(k)-1] == c[counter]):
          counter += 1
          if(counter == len(c)):
            flg = True
            break
    if(flg == True):
      ans = j
      break
if(n ==1):
  for j in range(0,10):
    if(flg == True):
      break
    list_j = list(str(j))
    counter = 0
    for k in s:
        if(list_j[int(k)-1] != c[counter]):
          break
        if(list_j[int(k)-1] == c[counter]):
          counter += 1
          if(counter == len(c)):
            flg = True
            break
    if(flg == True):
      ans = j
      break

if(flg == True):
    print(ans)
else:
    print('-1')


### FIXED CODE ###

#A - Duplex Printing
n = int(input())
ans = n // 2
if(n % 2 == 1):
    ans += 1
print(ans)
3*r*r

### FIXED CODE ###

n=int(input()) 
a = n*n*3
print(a)
N = int(input())
a = list(map(int,input().split()))
t = [];s = 0
for i in range(N):
    for j in range(N):
        if i != j:
            if a[i]*a[j]<10**9+7:
                t.append(a[i]*a[j])
            else:
                t.append(a[i]%7*a%[j]%7)
for i in t:
    s += i
s = s//2
print(s%10**9+7)

### FIXED CODE ###

import itertools
N = int(input())
a = list(map(int,input().split()))
a2 = itertools.accumulate(a)
b = [0]
b += list(a2)
s = 0
for i in range(N):
    s += (a[i] * (b[-1] - b[i+1]))
print(s % (10**9+7))
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)
ans = 0
nokorix = x
nokoriy = y
pin =0
qin=0
rin=0
for i in range(x+y):
    c=0
    if nokorix !=0:
        if p[pin]>= max(q[qin],r[rin]):
            ans+=p[pin]
            nokorix -=1
            pin +=1
            c+=1
    if nokoriy != 0:
        if q[qin] >=max(p[pin], r[rin]):
            ans+=q[qin]
            nokoriy -=1
            qin +=1
            c+=1
    if c==0 and (nokorix!=0 or nokoriy!=0):
        if q[qin] >= p[pin] and p[pin]<=r[rin]:
            ans+=r[rin]
            nokorix -=1
            qin+=1
        elif p[pin] >=q[qin] and q[qin] <=r[rin] :
            ans+=r[rin]
            nokoriy-=1
            qin+=1      

print(ans)




### 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]))
n, k = [int(i) for i in input().split()]

ans = [0, 0]

for i in range(1, n+1):
    if k % 2 == 0 and i % k == d:
        ans[0] += 1
    if i % k == 0:
        ans[1] += 1

print(ans[0] ** 3 + ans[1] ** 3)

### FIXED CODE ###

n, k = [int(i) for i in input().split()]

ans = [0, 0]
d = k // 2

for i in range(1, n+1):
    if k % 2 == 0 and i % k == d:
        ans[0] += 1
    if i % k == 0:
        ans[1] += 1

print(ans[0] ** 3 + ans[1] ** 3)
a, b, c, d = input().split()
a = int(a)#体力
b = int(b)
c = int(c)#体力
d = int(d)

x = a//d +1
y = c//b

if y == 1:
  if x <= y:
  	print("No")
  print("No")
else:
  print("Yes")

### FIXED CODE ###

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

if a > b:
  print('safe')
else:
  print('unsafe')