Harryxun/stf_run huggingface dataset:
A,B,K=map(int, raw_input().split())
l=range(A,B+1)

if len(l)/2>=K:
	for i in l[:K]:
		print i
	for i in l[-K:]:
		print i
elif len(l)/2<K and K<len(l):
	for i in l[:K]:
		print i
	for i in l[ ( K-(2*K-len(l)) )*-1:]:
		print i
elif len(l)/2<K and K>=len(l):
	for i in l:
		print i
	

### FIXED CODE ###

A,B,K=map(int, raw_input().split())
c=set()
for i in range(A,min(B+1,A+K)):
	c.add(i)

for i in range(B,max(A-1,B-K),-1):
	c.add(i)


a=list(c)
a.sort()
for i in a:
	print i
n=int(input())
l=[]
for i in range(n):
    a,b,c=map(int,input().split())
    if c>0:
        l.append([a,b,c])
s=l[0]
l2=[]
for x in range(100):
    for y in range(100):
        l2.append([x,y,s[2]+abs(x-s[0])+abs(y-s[1])])
for s in l2.copy():
    for t in l:
        if s[2]!=t[2]+abs(s[0]-t[0])+abs(s[1]-t[1]):
            try:
                l2.remove(s)
            except:
                continue
            
print(*l2[0])

### FIXED CODE ###

n=int(input())
l=[]
for i in range(n):
    a,b,c=map(int,input().split())
    l.append((a,b,c))
    if c>0:
        x,y,h=a,b,c
ma=len(l)
for s in range(101):
    for t in range(101):
        x2,y2,h2=s,t,h+abs(x-s)+abs(y-t)  #候補点
        c=0
        if all(h3==max(h2-abs(x3-x2)-abs(y3-y2),0)for(x3,y3,h3)in l):
            print(x2,y2,h2)
            exit()
print(-1,-1,-1)
x,y = int(input())
print(x+int(y/2))

### FIXED CODE ###

x, y = map(int, input().split())
print(x+int(y/2))
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    A = sorted(A, reverse=True)

    i = 0
    while(pow(2,i)<N): i+=1
    # print(A)

    rem = N-2**(i-1)
    if rem%2 == 1: od = 1
    else: od = 0
    # print(A[:2**(i-2)])
    ans = sum(A[:2**(i-2)])*2 - A[0]
    # print(ans)
    # print(A[2**(i-2):2**(i-2)+rem//2])
    ans+= sum(A[2**(i-2):2**(i-2)+rem//2])*2
    # print(ans)

    if od:
        ans+= A[2**(i-2)+rem//2]
    print(ans)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    A = sorted(A, reverse=True)
    if N==2:
        print(A[0])
        return

    i = 0
    while(pow(2,i)<N): i+=1
    # print(A)

    rem = N-2**(i-1)
    if rem%2 == 1: od = 1
    else: od = 0
    # print(A[:2**(i-2)])
    ans = sum(A[:2**(i-2)])*2 - A[0]
    # print(ans)
    # print(A[2**(i-2):2**(i-2)+rem//2])
    ans+= sum(A[2**(i-2):2**(i-2)+rem//2])*2
    # print(ans)

    if od:
        ans+= A[2**(i-2)+rem//2]
    print(ans)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
T = ["dream", "dreamer", "erase", "eraser"]

def match(s):
	if s == "":
		return True
	else:
		ans = False
		for i in T:
			if len(i) <= len(s) and s[:len(i)] == i:
				ans |= match(s[len(i):])
		return ans

S = raw_input()
if match(S):
	print "YES"
else:
	print "NO"

### FIXED CODE ###

T = ["maerd", "remaerd", "esare", "resare"]

s = raw_input()
s = s[::-1]

ans = True
while True:
	if s == "":
		ans = True
		break
	elif s[0] == "m" and len(s) >= len(T[0]) and s[:len(T[0])] == T[0]:
		s = s[len(T[0]):]
	elif s[0] == "r" and len(s) > 2:
		if s[2] == "m" and len(s) >= len(T[1]) and s[:len(T[1])] == T[1]:
			s = s[len(T[1]):]
		elif s[2] == "s" and len(s) >= len(T[3]) and s[:len(T[3])] == T[3]:
			s = s[len(T[3]):]
		else:
			ans = False
			break
	elif s[0] == "e" and len(s) >= len(T[2]) and s[:len(T[2])] == T[2]:
		s = s[len(T[2]):]
	else:
		ans = False
		break

if ans:
	print "YES"
else:
	print "NO"
n,m=map(int,input().split())
x=[0 for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  x[a-1]+=1;x[b-1]+=1
for i in range(n):print(n[i])

### FIXED CODE ###

n,m=map(int,input().split())
x=[0 for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  x[a-1]+=1;x[b-1]+=1
for i in range(n):print(x[i])
def solve(): 

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

    i = 0
    result = 0

    while i < N:
        while i+1 < n and A[i] == A[i+1]:
            i += 1
        if i+1 < N and A[i] < A[i+1]:
            while i+1 < n and A[i] <= A[i+1]:
                i += 1
        elif i+1 < N and A[i] > A[i+1]:
            while i+1 < n and A[i] >= A[i+1]:
                i += 1
        
        result += 1
        i += 1

    print(result)    

if __name__ == "__main__":
    solve()


### FIXED CODE ###

def solve(): 

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

    i = 0
    result = 0

    while i < N:
        while i+1 < N and A[i] == A[i+1]:
            i += 1
        if i+1 < N and A[i] < A[i+1]:
            while i+1 < N and A[i] <= A[i+1]:
                i += 1
        elif i+1 < N and A[i] > A[i+1]:
            while i+1 < N and A[i] >= A[i+1]:
                i += 1
        
        result += 1
        i += 1

    print(result)    

if __name__ == "__main__":
    solve()
# -*- coding: utf-8 -*-

import sys

def isPrime(p):
    if p == 2:
        return True
    elif p < 2 or p%2 == 0:
        return False
    elif pow(2, p-1, p) == 1:
        return True
    else:
        return False

for line in sys.stdin:
    n = int(line)
    count = 0
    for i in range(n):
        if isPrime(int(raw_input())):
            count += 1
    print count

### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys
import math

def countPrimes(n):
    m = int(math.sqrt(n))
    keys = [n/i for i in range(1, m+1)]
    keys += range(keys[-1]-1, 0, -1)
    h = {i:i-1 for i in keys}
    for i in range(2, m+1):
        if h[i] > h[i-1]:
            hp = h[i-1]
            i2 = i*i
            for j in keys:
                if j < i2:
                    break
                h[j] -= h[j/i]-hp
    return h[n]

for line in sys.stdin:
    print countPrimes(int(line))
a, b = map(int, input().split())
d = b - a
def s(n):
	if n == 1:
		return 1
	else:
		return s(n-1)+n
print(s(d)-b)

### FIXED CODE ###

a, b = map(int, input().split())
d = b - a
print(int((d*(d+1)/2)-b))
def main():
    a = input()
    b = input()
    c = input()
    A, B, C = len(a), len(b), len(c)
    ab = [True]*10000
    ac = [True]*10000
    bc = [True]*10000

    def check(c1, c2):
        if c1 == '?' or c2 == '?' or c1 == c2:
            return False
        return True

    for i in range(A):
        for j in range(B):
            if check(a[i], b[j]):
                ab[i-j+5000] = False
    for i in range(A):
        for j in range(C):
            if check(a[i], c[j]):
                ac[i-j+5000] = False
    for i in range(B):
        for j in range(C):
            if check(b[i], c[j]):
                bc[i-j+5000] = False
    ans = A + B + C
    for i in range(-(B+C), A+C):
        for j in range(-(B+C), A+B):
            if ab[i+5000] and ac[j+5000] and bc[j-i+5000]:
                L = min(0, i, j)
                R = max(A, i+B, j+C)
                ans = min(ans, R - L)
    print(ans)


main()


### FIXED CODE ###

A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(A[k-1])
forecasts = list(input())
    actuals = list(input())
    ex_count = 0
    for x in range(3):
        if forecasts[x] == actuals[x]:
            ex_count = ex_count + 1
    print("{}".format(ex_count))

### FIXED CODE ###

forecasts = list(input())
actuals = list(input())
ex_count = 0
for x in range(3):
    if forecasts[x] == actuals[x]:
        ex_count = ex_count + 1
print("{}".format(ex_count))
# -*- coding: utf-8 -*-
N = map(str, input().split())
out = "No"
N_list = list(N)
if N_list[0]==N_list[1] and N_list[0]==N_list[2]:
    out = "Yes"
elif N_list[1]==N_list[2] and N_list[1]==N_list[3]:
    out = "Yes"

print(out)

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = str, input()
out = "No"
N_list = list(N[1])

if N_list[0]==N_list[1] and N_list[0]==N_list[2]:
    out = "Yes"
elif N_list[1]==N_list[2] and N_list[1]==N_list[3]:
    out = "Yes"

print(out)
N, M = map(int, input().split())
mid, las = [], []
ans = 0

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        mid.append(b)
    
    elif b == N:
        las.append(a)

if set(mid) & set(las) != 0:
    ans = 1　

print('POSSIBLE' if ans == 1 else 'INPOSSIBLE') 

### FIXED CODE ###

N, M = map(int, input().split())
mid, las = [], []
ans = 0

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        mid.append(b)
    
    elif b == N:
        las.append(a)

if len(set(mid) & set(las)) != 0:
    ans =1

print('POSSIBLE' if ans == 1 else 'IMPOSSIBLE')
import sys
input=sys.stdin.readline

s=int(input())

#0<= x,y <=10**9
#s/2

if s<=10**9:
    print(0,0,1,0,0,s)
    exit()

hoge=int(s**0.5)

for i in range(hoge):
    ss=i
    #print(ss)
    if s%ss==0 and s//ss<=10**9:
        print(0,0,ss,0,0,s//ss)
        exit()



### FIXED CODE ###

import sys
input=sys.stdin.readline

s=int(input())

#0<= x,y <=10**9
#s/2

if s<=10**9:
    print(0,0,1,0,0,s)
    exit()

y=(-1*s//(10**9))*(-1)
x=10**9*y-s

print(0,0,10**9,1,x,y)
import math

a, b, c, d = map(int, input().split())
def answer(x, i, j):
    lcm = (i * j) // math.gcd(i, j)
    xi = x // i
    xj = x // j
    xlcm = x // lcm
    return x - xi - xj + xlcm
ans = answer(b, c, d) - answer(a-1, c, d)
print(ans)

### FIXED CODE ###

import fractions
def answer(x, i, j):
    lcm = (i * j) // fractions.gcd(i, j)
    xi = x // i
    xj = x // j
    xlcm = x // lcm
    return x - xi - xj + xlcm
a, b, c, d = map(int, input().split())
ans = answer(b, c, d) - answer(a-1, c, d)
print(ans)
n = int(input())
input()

for i in range(n):
	board = [list(input()) for i in range(8)]
	sx = int(input()) - 1
	sy = int(input()) - 1
	input()
	
	board[sy][sx] == 2
	bomb = []
	n_bomb = [[sy, sx]]
	points = []
	for j in range(len(board)):
		while '1' in board[j]:
			px = board[j].index('1')
			py = j
			points.append([py, px])
			board[j][px] = '2'
	
	while len(n_bomb) != 0:
		bomb += n_bomb
		n_bomb = []
		for b in bomb:
			for p in points:
				if (p[0] == b[0] and b[1]-3 <= p[1] <= b[1]+3) or (p[1] == b[1] and b[0]-3 <= p[0] <= b[0]+3):
					points.remove(p)
					n_bomb.append(p)
	
	ans = [['0'] * 8 for j in range(8)]
	for p in points:
		ans[p[0]][p[1]] = '1'

	print("Data %s:" % str(i+1))
	for p in ans:
		print("".join(p))

### FIXED CODE ###

n = int(input())

for i in range(n):
	input()
	board = [list(input()) for i in range(8)]
	sx = int(input()) - 1
	sy = int(input()) - 1

	board[sy][sx] == 2
	bomb = []
	n_bomb = [[sy, sx]]
	points = []
	for j in range(len(board)):
		while '1' in board[j]:
			px = board[j].index('1')
			py = j
			points.append([py, px])
			board[j][px] = '2'
	
	while len(n_bomb) != 0:
		bomb += n_bomb
		n_bomb = []
		for b in bomb:
			for p in points:
				if (p[0] == b[0] and b[1]-3 <= p[1] <= b[1]+3) or (p[1] == b[1] and b[0]-3 <= p[0] <= b[0]+3):
					points.remove(p)
					n_bomb.append(p)
	
	ans = [['0'] * 8 for j in range(8)]
	for p in points:
		ans[p[0]][p[1]] = '1'

	print("Data %s:" % str(i+1))
	for p in ans:
		print("".join(p))
from heapq import heappush 
def inpl(): return list(map(int, input().split()))

Q = int(input())
L = []
R = []

B = 0
M = 0

for _ in range(Q):
    q = inpl()
    if len(q) == 3:
        B += q[2]
        if len(R) == 0:
            L.append(-q[1])
            R.append(q[1])
            continue

        M += min(abs(-L[0] - q[1]), abs(R[0] - q[1]))
        heappush(L, -q[1])
        if -L[0] > R[0]:
            L[0], R[0] = -L[0], -R[0]
        heappush(R, q[1])
        if -L[0] > R[0]:
            L[0], R[0] = -L[0], -R[0]
        assert max(L) <= min(R)
    else:
        print(-L[0], B+M)

### FIXED CODE ###

from heapq import heappush, heappop
def inpl(): return list(map(int, input().split()))

Q = int(input())
L = []
R = []

B = 0
M = 0

for _ in range(Q):
    q = inpl()
    if len(q) == 3:
        B += q[2]
        if len(R) == 0:
            L.append(-q[1])
            R.append(q[1])
            continue

        M += min(abs(-L[0] - q[1]), abs(R[0] - q[1])) * (not (-L[0] <= q[1] <= R[0]))
        if q[1] < R[0]:
            heappush(L, -q[1])
            heappush(L, -q[1])
            heappush(R, -heappop(L))
        else:
            heappush(R, q[1])
            heappush(R, q[1])
            heappush(L, -heappop(R))
    else:
        print(-L[0], B+M)
S = input(string())
 if S == Sunny:
     print(Cloudy)
 elif S == Cloudy:
     print(Rainy)
 else :
     print(Sunny)

### FIXED CODE ###

def main():
    S = input()
    if S[0] == 'S':
        print("Cloudy")
    elif S[0] == 'R':
        print("Sunny")
    else:
        print("Rainy")
    pass
 
 
if __name__ == "__main__":
    main()
import sys

f = open('input.txt')
# f = input()

N = int(f.readline())


out = []
sum = 0
for i in range(0, N+1):
    sum = sum + i
    out.append(i)
    if sum > N:
        r = sum - N
        out.remove(r)
        break
    
out.remove(0)

for n in out:
    print(n)

# print(' '.join(map(str, out)))

### FIXED CODE ###

import sys

# f = open('input.txt')
f = input()

N = int(f)


out = []
sum = 0
for i in range(0, N+1):
    sum = sum + i
    out.append(i)
    if sum > N:
        r = sum - N
        out.remove(r)
        break
    
out.remove(0)

for n in out:
    print(n)

# print(' '.join(map(str, out)))
# 初期入力
import numpy as np 
N,Q = (int(x) for x in input().split())
aa=0  
bb=0
a=[0] 
b=[0]
a_set =set()
ki_kouzou =np.zeros((N+1,1),dtype=np.int32)
ki_kouzou_dic ={i:set() for i in range(1,N+1)}

#木の構造を入力
for i in range(1,N): #直接つながっているところ。
    aa,bb = (int(x) for x in input().split())
    if bb in a_set: #親子判定 頂点3⇒頂点2もありうる
        #np.append(ki_kouzou[bb,:],aa,axis=1)
        a_set.add(aa)
        ki_kouzou_dic[bb].add(aa)
    else:
        #np.append(ki_kouzou[aa,:],bb,axis=1)
        #ki_kouzou[aa].append(bb)
        ki_kouzou_dic[aa].add(bb)
        a_set.add(bb)
    a.append(aa)     
    b.append(bb)


#間接的に繋がっているところ
kansetu ={i:set() for i in range(1,N+1)}
for ki_key in range(1,N+1) :
    for v_v in ki_kouzou_dic[ki_key]:
        if v_v in ki_kouzou_dic.keys():
            kansetu[ki_key] = kansetu[ki_key] | ki_kouzou_dic[v_v] 

for i in range(1,N+1):
    ki_kouzou_dic[i] =ki_kouzou_dic[i] | kansetu[i] #直接 ＋ 間接
    ki_kouzou_dic[i].add(i) #各頂点自身はは必ずポイント加算あり


# ポイント入力-計算
point={i:0 for i in range(1,N+1)}
pp=0 ; xx=0
for _ in range(Q):
    pp,xx = (int(x) for x in input().split())
    for i in ki_kouzou_dic[pp]:
        point[i] += xx 

print(*point.values())

### FIXED CODE ###

# 初期入力
NN,K = (int(x) for x in input().split())

#K個の和、初項と修項
p =10**9 + 7
seq =[i for i in range(NN+1)] #0-Nまでの数列
ans =[0] *(NN+1)
st =[0]*(NN+1)
fi =[0]*(NN+1)
st[0] =sum(seq[  :K])
fi[0] =sum(seq[-K: ])
ans[0] =fi[0] -st[0] +1
if NN==1 and K==1:
    print(3)
else:
    for i in range(NN -K+1):
        st[i+1] =st[i] +seq[K+i]
        fi[i+1] =fi[i] +seq[-K-i-1]
        ans[i+1] =(fi[i+1] -st[i+1] +1)
    print(sum(ans) %p)
can_reach = True
for i in range(N):
  next_T, next_X, next_Y = map(int, input().split())
  
  z = next_T - T - abs(X - next_X) - abs(Y - next_Y)
  if z >= 0 and z % 2 == 0:
    T, X, Y = next_T, next_X, next_Y
  else:
    can_reach = False
    break
    
if can_reach:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = int(input())
T, X, Y = 0, 0, 0

can_reach = True
for i in range(N):
  next_T, next_X, next_Y = map(int, input().split())
  
  z = next_T - T - abs(X - next_X) - abs(Y - next_Y)
  if z >= 0 and z % 2 == 0:
    T, X, Y = next_T, next_X, next_Y
  else:
    can_reach = False
    break
    
if can_reach:
  print('Yes')
else:
  print('No')
while True:
    try:
	h = 0
	for i in range(8):
            tmp = raw_input()
            if int(tmp) != 0:
                a[h] = tmp
		h += 1
      	if h == 4:
	    print "B"
	elif h == 1:
	    print "C"
	elif h == 2:
            c = int(a[0])/int(a[1])
            if c == 1:
            	print "A"
	    elif c == 10:
		print "E"
	    elif c == 0:
            	print "G"
	else:
	    c = int(a[0])/int(a[2])
	    if c ==	10:
            	print "F"
	    else:
            	print "D"

### FIXED CODE ###

while True:
    try:
        h = 0
        a=["","","",""]
        for i in range(8):
            tmp = raw_input()
            if int(tmp) != 0:
                a[h] = tmp
                h += 1
    	if h == 1:
            print "C"
        elif h == 2:
            c = a[0].index("1") - a[1].index("1")
            if c == 0:
                print "A"
            elif c == -1:
                print "E"
            else:
                print "G"
        elif h == 3:
            c = a[0].index("1") - a[2].index("1")
            print "D" if c == 1 else "F"
        else:
            print "B"
    	raw_input()
    except:
	break
import sys
import re
import numpy as np
from itertools import combinations

def answer(l):
    results = []
    for i, j in combinations(l, 2):
        v_a = np.array(i)
        v_b = np.array(j)
        results.append(np.linalg.norm(v_a - v_b))
    return sum(float.is_integer(i) for i in results)

rows = re.split('\n', sys.stdin.readline())
args = [list(map(int, row.split(' '))) for row in rows][1:]
print(answer(args))

### FIXED CODE ###

n, d = map(int, input().split())
coodinates = [[int(x) for x in input().split()] for _ in range(n)]
result = 0
for left in range(n-1):
    for right in range(left+1,n):
        dist = 0
        for i in range(d):
            dist += (coodinates[left][i] - coodinates[right][i])**2
        dist = dist ** 0.5
        result += 1 if dist.is_integer() else 0
print(result)
import sys
S=list(raw_input())
if len(S)>10:
	print "NO"
	sys.exit()

if S.index("K")+1!=S.index("I") or S.index("I")+1!=S.index("H"):
	print "NO"
	sys.exit()

for i in S:
	if i=="A":
		S.remove("A")


if ''.join(S)=="KIHBR":
	print "YES"
else:
	print "NO"


### FIXED CODE ###

import sys
S=list(raw_input())
if len(S)>10:
	print "NO"
	sys.exit()

if "K" in S and "I" in S and "H" in S:
	pass
else:
	print "NO"
	sys.exit()
	
if S.index("K")+1!=S.index("I") or S.index("I")+1!=S.index("H"):
	print "NO"
	sys.exit()

for i in S:
	if i=="A":
		S.remove("A")


if ''.join(S)=="KIHBR":
	print "YES"
else:
	print "NO"
A, B, C, X, Y = map(int,input().split())
value = 0
ans = []
if X > 0 and Y > 0 and A + B > 2*C:
    m = min(X, Y)
    value += m * 2*C
    X = X - m
    Y = Y - m
value += (X * A + Y * B)
ans.append(value)
ans.append(max(X,Y) * 2*C)
print(min(ans))

### FIXED CODE ###

N, X = map(int,input().split())
l = []
for _ in   range(N):
    l.append(int(input()))
X = X - sum(l)
cnt = X // min(l)
print(N+cnt)
# cook your dish here
import numpy as np
if __name__ == '__main__':
    xy = [int(i) for i in input().split()]
    a1 = np.array([xy[0], xy[1]])
    a2 = np.array([xy[2], xy[3]])
    b = a2 - a1
    r = np.pi / 2
    rot = np.matrix((
        (np.cos(r), np.sin(r)),
        (-np.sin(r), np.cos(r))
    ))
    c = np.dot(b, rot)
    a3 = a2+c
    a4 = a1+c
    print('{} {} {} {}'.format(np.round(a3[0,0]), np.round(a3[0,1]), np.round(a4[0,0]), np.round(a4[0,1])))


### FIXED CODE ###

if __name__ == '__main__':
    K = int(input())
    odds = int((K+1)/2)
    even = int(K/2)
    print(odds*even)
#D
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = c = []
for _ in range(m):
    tmp = list(map(int, input().split()))
    b.append(tmp[0])
    c.append(tmp[1])
a.sort
for i in range(m):
    a += [c[i]] * b[i]
a=sorted(a,reverse=True)
a = a[n:]
print(sum(a))

### FIXED CODE ###

#D
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())
    d.append([b, c])
#print(d)
d = sorted(d, key=lambda x: x[1], reverse=True)
#print(d)
k = 0
for i in range(n):
    if d[k][0] == 0:#追加できなくなる
        k += 1
        if k == len(d):  #配列末
            break
    if a[i] >= d[k][1]:  #a>=cなのでこれ以上置き換わっても意味がない
        break
    a[i] = d[k][1]  #cに置き換わった
    d[k][0] -= 1  #dの追加出来る数を１減らす
print(sum(a))
import sys
mt_heigts = map(int, sys.stdin.readlines())
mt_heigts.sort(reverse=True)
for height in mt_heights[:3]:
    print height

### FIXED CODE ###

import sys
mt_heights = map(int, sys.stdin.readlines())
mt_heights.sort(reverse=True)
for height in mt_heights[:3]:
    print height
N, K, Q = map(int, input().split())
A = []
for i in range(Q):
  A.append(int(input()))

B = []
for j in range(1, N+1):
  sj = 0
  for k in range(Q):
    if j != A[k]:
      sj += 1
    if sj >= K:
      break
  if sj < K:
    B.append('Yes')
  else:
    B.append('No')

for l in range(len(B)):
  print(B[i])

### FIXED CODE ###

N, K, Q = map(int, input().split())
A = []
for i in range(Q):
  A.append(int(input()))
B = [0 for b in range(N)]

for j in range(len(A)):
  B[A[j]-1] += 1
  
for l in range(len(B)):
  if B[l] > Q - K:
    print('Yes')
  else:
    print('No')
K=int(input())
S=input()
if len(S)<K:
  print(S)
else:
  print(S[:,K]+"...")
    

### FIXED CODE ###

K=int(input())
S=input()
if len(S)<=K:
  print(S)
else:
  print(S[:K]+"...")
import re

s = input()
ans = max(
    len(m.group()) for m in re.findall('[AGCT]+', s),
    default=0
)

print(ans)


### FIXED CODE ###

import re

s = input()
ans = max(
    map(len, re.findall('[AGCT]+', s)),
    default=0
)

print(ans)
# C - Successive Subtraction

N = int(input())
A = list(int(a) for a in input().split())

M = []
P = []
for a in A:
    if a >= 0:
        P.append(a)
    else:
        M.append(a)

P.sort(reverse=True)
M.sort()
lenP = len(P)
lenM = len(M)    

ans = []
anssum = 0

if lenM ==0:
    ans.append((P[-1], P[-2]))
    tmp = P.pop() - P.pop()
    M.append(tmp)
    lenP -= 2
elif lenP ==0:
    ans.append((M[-1], M[-2]))
    tmp = M.pop() - M.pop()
    P.append(tmp)
    lenP += 1
for i in range(lenP-1):
    ans.append((M[-1], P[-1]))
    tmp = M.pop() - P.pop()
    M.append(tmp)
while M != []:
    ans.append((P[-1], M[-1]))
    tmp = P.pop() - M.pop()
    P.append(tmp)
anssum = P.pop()

print(anssum)
for i in range(len(ans)):
    print(' '.join(map(str, ans[i])))


### FIXED CODE ###

# C - Successive Subtraction

N = int(input())
A = list(int(a) for a in input().split())

M = []
P = []
for a in A:
    if a >= 0:
        P.append(a)
    else:
        M.append(a)

P.sort(reverse=True)
M.sort()
lenP = len(P)
lenM = len(M)    

ans = []
anssum = 0

if lenM ==0:
    if lenP >= 3:
        ans.append((P[-1], P[-2]))
        tmp = P.pop() - P.pop()
        M.append(tmp)
        lenP -= 2
    else:
        ans.append((P[-2], P[-1]))
        tmp = P.pop() - P.pop()
        tmp *= -1
        P.append(tmp)
        lenP -= 2
elif lenP ==0:
    ans.append((M[-1], M[-2]))
    tmp = M.pop() - M.pop()
    P.append(tmp)
    lenP += 1
for i in range(lenP-1):
    ans.append((M[-1], P[-1]))
    tmp = M.pop() - P.pop()
    M.append(tmp)
while M != []:
    ans.append((P[-1], M[-1]))
    tmp = P.pop() - M.pop()
    P.append(tmp)
anssum = P.pop()

print(anssum)
for i in range(len(ans)):
    print(' '.join(map(str, ans[i])))