Harryxun/stf_run huggingface dataset:
from sys import stdin
import numpy as np
X, Y, A, B, C = (int(i) for i in input().split())
p = [[int(x), "A"] for x in stdin.readline().rstrip().split()]
q = [[int(x), "B"]  for x in stdin.readline().rstrip().split()]
r = [[int(x), "C"] for x in stdin.readline().rstrip().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
apples = p+q+r

apples.sort(reverse=True)
#print(apples)
ans = 0
pend = 0

while (X > 0 or Y > 0) and X+Y > pend:
    if apples[0][1] == "C":
        pend += 1
        ans += apples[0][0]
        apples.pop(0)
    elif apples[0][1] == "A":
        if X > 0:
            ans += apples[0][0]
            apples.pop(0)
            X -= 1
        else:
            apples.pop(0)
    elif apples[0][1] == "B":
        if Y>0:
            ans += apples[0][0]
            apples.pop(0)
            Y -= 1
        else:
            apples.pop(0)
    #print(ans)
    #print("XY", X, Y, pend)
#print("XY", X, Y, pend)
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
X, Y, A, B, C = (int(i) for i in input().split())
p = [[int(x), "A"] for x in input().split()]
q = [[int(x), "B"] for x in input().split()]
r = [[int(x), "C"] for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
apples = p+q+r


apples.sort(reverse=True)
#print(apples)
ans = 0
pend = 0


for hapi, col in apples:
    if col == "C":
        pend += 1
        ans += hapi
    elif col == "A":
        if X > 0:
            ans += hapi
            X -= 1

    elif col == "B":
        if Y>0:
            ans += hapi
            Y -= 1

    if (X < 1 and Y < 1) or X+Y == pend:
        break
    #print(ans)
    #print("XY", X, Y, pend)
#print("XY", X, Y, pend)
print(ans)
n=int(input())
a=list(map(int, input().split()))
q=int(input())
num=[0]*(10**5-1)
tot=0
for i in range(n):
    num[a[i]-1]+=1
    tot+=a[i]

for i in range(q):
    b,c=map(int, input().split())
    tot+=num[b-1]*(c-b)
    print(tot)
    num[c-1]+=num[b-1]
    num[b-1]=0

### FIXED CODE ###

n=int(input())
a=list(map(int, input().split()))
q=int(input())
num=[0]*(10**5)
tot=0
for i in range(n):
    num[a[i]-1]+=1
    tot+=a[i]

for _ in range(q):
    b,c=map(int, input().split())
    tot+=(num[b-1]*(c-b))
    num[c-1]+=num[b-1]
    num[b-1]=0
    print(tot)
n = int(input())
a = list(map(int, input().split()))
ans = 0

while True:
  if a%2 == 1:
    break
  ans += 1
print(ans)

### FIXED CODE ###

s = input()
s1 = int(s[0])
s2 = int(s[1])
s3 = int(s[2])

print(s1 + s2+s3)
n = int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh = sorted(xyh, key=lambda x:(x[2]), reverse=True)

for cx in range(101):
    for cy in range(101):
        flg = True
        x, y, h = xyh[0][0], xyh[0][1], xyh[0][2]
        ch0 = max(abs(cx-x) + abs(cy-y) + h, 0)
        for i in range(1,n):
            x, y, h = xyh[i][0], xyh[i][1], xyh[i][2]
            ch = max(abs(cx-x) + abs(cy-y) + h, 0)
            if ch > 0 and ch != ch0:
                flg = False
                break
        if flg:
            anscx, anscy = cx, cy
            ansh = ch0
            break
    if flg:
        break

print(anscx, anscy, ch0)

### FIXED CODE ###

n = int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh = sorted(xyh, key=lambda x:(x[2]), reverse=True)

ans = -1, -1, -1
for cx in range(101):
    for cy in range(101):
        flg = True
        x, y, h = xyh[0][0], xyh[0][1], xyh[0][2]
        ch = abs(cx-x) + abs(cy-y) + h
        for i in range(1,n):
            x, y, h = xyh[i][0], xyh[i][1], xyh[i][2]
            tmph = max(ch - abs(cx-x) - abs(cy-y), 0)
            if h != tmph:
                flg = False
                break
        if flg:
            ans = cx, cy, ch
print(*ans)
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom


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

def num(i):
    if i > N - K + 1:
        return 0
    else:
        num1 = ncr(N-K+1, i) % (10**9 + 7)
        num2 = ncr(K-1, i-1) % (10**9 + 7)
        num = (num1 * num2) % (10**9 + 7)
        return int(num)


for i in range(1, K+1):
    print(num(i))

### FIXED CODE ###

import operator as op
from functools import reduce
 
def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom
 
 
N, K = list(map(int, input().split()))
 
def num(i):
    if i > N - K + 1:
        return 0
    else:
        num1 = ncr(N-K+1, i) % (10**9 + 7)
        num2 = ncr(K-1, i-1) % (10**9 + 7)
        num = (num1 * num2) % (10**9 + 7)
        return num
 
 
for i in range(1, K+1):
    print(num(i))
N,A,B = map(int().input().strip())

A = A * N

if (A < B):
	print(A)
else:
	print(B)
	


### FIXED CODE ###

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

A = A * N

if (A < B):
	print(A)
else:
	print(B)
N, A, B = [int(i) for i in input().split()]
i=(N//(A+B))*A
if N%(A+B)>A:
    i=i+A
else:
    i=i+(N%(A+B))
print(i)

### FIXED CODE ###

S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')
import sys
sys.getrecursionlimit(100000)

N, M = (int(_) for _ in input().split())
vertices = [Vertice(i) for i in range(N)]
L, R, D = ([None for i in range(M)] for j in range(3))


from math import inf
class Vertice:
  def __init__(self, num):
    self.num = num
    self.connected = []
    self.edge = []
    self.pos = inf
    
def DFS(vertice):
  judge = True
  for con in vertice.connected:
    index = vertice.connected.index(con)
    if con.pos == inf:
      con.pos = vertice.pos + vertice.edge[index]
      judge = DFS(con)
    elif con.pos != vertice.pos + vertice.edge[index]:
      judge = False
    if judge == False:
      break
  return judge



for i in range(M):
  L[i], R[i], D[i] = (int(_) for _ in input().split())
for i in range(M):
  if not vertices[R[i] - 1] in vertices[L[i] - 1].connected:
    vertices[L[i] - 1].connected.append(vertices[R[i] - 1])
    vertices[R[i] - 1].connected.append(vertices[L[i] - 1])
    vertices[L[i] - 1].edge.append(D[i])
    vertices[R[i] - 1].edge.append(-D[i])
judge = True
for i in range(N):
  if vertices[i].pos == inf:
    vertices[i].pos = 0
    judge = DFS(vertices[i])
    if judge == False:
      print("No")
      break
if judge:
  print("Yes")

### FIXED CODE ###

import sys
sys.setrecursionlimit(2000002)

def DFS(i, pos, connected, distances):
  if pos[i] == None:
    pos[i] = 0
  size = len(connected[i])
  for j in range(size):
    if pos[connected[i][j]] == None:
      pos[connected[i][j]] = pos[i] + distances[i][j]
      if DFS(connected[i][j], pos, connected, distances) == False:
        return False
    elif pos[connected[i][j]] != pos[i] + distances[i][j]:
      return False
  return True

N, M = map(int, input().split())
pos = [None for i in range(N + 1)]
connected = [[] for i in range(N + 1)]
distances = [[] for i in range(N + 1)]
for i in range(M):
  l, r, d = map(int, input().split())
  connected[l].append(r)
  distances[l].append(d)
  connected[r].append(l)
  distances[r].append(-d)
judge = True
for i in range(1, N + 1):
  if pos[i] == None:
    judge = DFS(i, pos, connected, distances)
    if judge == False:
      break
if judge:
  print('Yes')
else:
  print('No')
n = int(input())
s = input()
i = 0
while i < n - 1:
  while s[i] == s[i + 1]:
    s.pop(i + 1)
    n -= 1
  i += 1
print(n)


### FIXED CODE ###

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

ans = 1
current = s[0]
for i in range(n):
  if current != s[i]:
    ans += 1 
    current = s[i]
print(str(ans))
n, m = map(int,input().split())

l = [[0 for _ in range(2)] for _ in range(m)]

f = 0
con = ""

for i in range(n):
    s, c = map(int,input().split())
    if l[s-1][1] == 0 or l[s-1][0] == c:
        if s == 1 and c == 0:
            f = 1
            break
        l[s-1][0] = c
        l[s-1][1] = 1
    else:
        f = 1
        break
else:
    for j in range(m):
        if l[j][0] != 0:
            break
        else:
            f = 1
            break

if f:
    print(-1)
else:
    for i in range(m):
        con += str(l[i][0])
    print(int(con))

### FIXED CODE ###

# n = int(input())
n, m = map(int,input().split())
# l = [[0 for _ in range(n)] for _ in range(n)]
l = []
f = 0

for i in range(m):
    l.append(list(map(int,input().split())))

# print(l)

for i in range(1000):
    si = str(i)
    if len(si) == n:
        for j in range(m):
            # print(si, l)
            if si[l[j][0]-1] == str(l[j][1]):
                # print('OK')
                f = 0
            else:
                f = 1
                break
    else:
        continue
    if f == 0:
        print(si)
        exit()

print(-1)
from functools import reduce
from math import gcd

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

def gcd_list(nums):
    return reduce(gcd, nums)

ans = -1

for i in range(N-1):
    g = gcd_list(A[:i] + A[i+1:])
    if g > ans:
        ans = g

g = gcd_list(A[:N-1])
if g > ans:
    ans = g

print(ans)


### FIXED CODE ###

def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

N = int(input())
A = list(map(int, input().split()))
divisors = sorted(make_divisors(A[0]) + make_divisors(A[1]), reverse=True)

ans = 0
for d in divisors:
    ok_cnt = 0
    for a in A:
        if a % d == 0:
            ok_cnt += 1
    if ok_cnt >= N-1:
        ans = d
        break
print(ans)
a, b, c = input().split()
if b == '+':
  print(a+c)
else:
  print(a-c)

### FIXED CODE ###

a, b, c = input().split()
if b == '+':
  print(int(a)+int(c))
else:
  print(int(a)-int(c))
from math import factorial
def nc2(n):
	if n<r:
		return 0
	else:
		return (n*(n-1))//2

n = int(input())
arr = list(map(int,input().split()))
d = {}
for i in range(n):
	try:
		d[arr[i]].append(i)
	except KeyError:
		d[arr[i]] = [i]

done = {}
for i in range(n):
	try:
		if done[arr[i]] > -1:
			continue
	except KeyError:
		ans = 0
		for j in d.keys():
			if j == arr[i]:
				ans+= ncr(len(d[j])-1,2)
			else:
				ans+= ncr(len(d[j]),2)
		done[arr[i]] = int(ans)

for i in arr:
	print(done[i])
	



### FIXED CODE ###

from math import factorial
def ncr(n,r):
	if n<r:
		return 0
	else:
		return factorial(n)/(factorial(n-r)*factorial(r))
n,m = map(int,input().split())
print(int(ncr(n,2)+ncr(m,2)))
# ans

N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100000
for i in range(N):
  cnt[i] += 1
Q = int(input())
S = sum(A)

for i in range(Q):
  B, C = map(int, input().split())
  diff = (C - B) * cnt[B]
  S += diff
  print(S)
  cnt[C] += cnt[B]
  cnt[B] = 0

### FIXED CODE ###

# ans

N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100001
for i in A:
  cnt[i] += 1
Q = int(input())
S = sum(A)

for i in range(Q):
  B, C = map(int, input().split())
  diff = (C - B) * cnt[B]
  S += diff
  print(S)
  cnt[C] += cnt[B]
  cnt[B] = 0
x, y = input().split
print(int(x) + int(y) / 2)

### FIXED CODE ###

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

H, W = map(int, input().split())
mas = []
for i in range(H):
    line = input()
    temp = []
    for j in range(W):
        temp.append(line[j])
    mas.append(temp)

color = []
for i in range(H):
    color.append([-1] * W)

def DFS(node, c_color):
    x = node[0]
    y = node[1]
    nb = [[x, y-1], [x, y+1], [x+1, y], [x-1, y]]
    deq = deque()
    for i in range(4):
        if(nb[i][0] >= 0 and nb[i][0] < H and nb[i][1] >= 0 and nb[i][1] < W):
            if(color[nb[i][0]][nb[i][1]] == -1):
                deq.append(nb[i])

    deq_ = deque()
    while(deq):
        next_node = deq.popleft()
        if(mas[next_node[0]][next_node[1]] != mas[node[0]][node[1]]):
            color[next_node[0]][next_node[1]] = c_color
            deq_.append(next_node)
            
    while(deq_):
        next_node = deq_.popleft()
        DFS(next_node, c_color)
    return
        
current_color = 0
for i in range(H):
    for j in range(W):
        if(color[i][j] >= 0):
            continue
        else:
            color[i][j] = current_color
            DFS([i, j], current_color)
            current_color += 1

color_num = []
for i in range(current_color):
    color_num.append([0, 0])


for i in range(H):
    for j in range(W):
        if(mas[i][j] == '#'):
            color_num[color[i][j]][0] += 1
        else:
            color_num[color[i][j]][1] += 1

ans = 0
for i in range(len(color_num)):
    ans += color_num[i][0] * color_num[i][1]

print(ans)


### FIXED CODE ###

from collections import *
import sys
sys.setrecursionlimit(10**6)

H, W = map(int, input().split())
mas = []
for i in range(H):
    line = input()
    temp = []
    for j in range(W):
        temp.append(line[j])
    mas.append(temp)

color = []
for i in range(H):
    color.append([-1] * W)

def DFS(node, c_color):
    x = node[0]
    y = node[1]
    nb = [[x, y-1], [x, y+1], [x+1, y], [x-1, y]]
    deq = deque()
    for i in range(4):
        if(nb[i][0] >= 0 and nb[i][0] < H and nb[i][1] >= 0 and nb[i][1] < W):
            if(color[nb[i][0]][nb[i][1]] == -1):
                deq.append(nb[i])

    deq_ = deque()
    while(deq):
        next_node = deq.popleft()
        if(mas[next_node[0]][next_node[1]] != mas[node[0]][node[1]]):
            color[next_node[0]][next_node[1]] = c_color
            deq_.append(next_node)
            
    while(deq_):
        next_node = deq_.popleft()
        DFS(next_node, c_color)
    return
        
current_color = 0
for i in range(H):
    for j in range(W):
        if(color[i][j] >= 0):
            continue
        else:
            color[i][j] = current_color
            DFS([i, j], current_color)
            current_color += 1

color_num = []
for i in range(current_color):
    color_num.append([0, 0])


for i in range(H):
    for j in range(W):
        if(mas[i][j] == '#'):
            color_num[color[i][j]][0] += 1
        else:
            color_num[color[i][j]][1] += 1

ans = 0
for i in range(len(color_num)):
    ans += color_num[i][0] * color_num[i][1]

print(ans)
import fractions

def a(A, B):
    C = fractions.gcd(A, B)
    return int((A * B)/C)

N = int(input())

T = []

for _ in range(N):
    T.append(int(input()))

T = sorted(T)
C = T[0]

if N > 1:
    for i in range(1, N):
        C = a(C, T[i])
print(C)


### FIXED CODE ###

import fractions

def a(A, B):
    C = fractions.gcd(A, B)
    return (A * B)//C

N = int(input())

T = []

for _ in range(N):
    T.append(int(input()))

T = sorted(T)
C = T[0]

if N > 1:
    for i in range(1, N):
        C = a(C, T[i])
print(C)
a,b,c = map(int,input(),split())
print(len([x for x in range(a,b+1) if (c % x) == 0]))

### FIXED CODE ###

a,b,c = map(int,input().split())
print(len([x for x in range(a,b+1) if (c % x ) == 0]))
S = input()
N = len(S)
A = (N-1)//2
B = ((N+2)//2)
if S[0:A] == S[B:N]:
  print('Yes')
elif:
  print('No')

### FIXED CODE ###

S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')
n,k=map(int,input().split())
S=[] #[ネタ種類、おいしさ]のリスト
for i in range(n):
    S.append(list(map(int,input().split())))
S.sort(reverse=1,key=lambda x:x[1])

netano_min=min(S[j][0] for j in range(n))
for i in range(n):
    S[i][0]-=netano_min-1

neta=max(S[j][0] for j in range(n)) #ネタの種類数

F=[0 for i in range(neta+1)] #ネタi種のときの美味しさの和の最大値のリスト

ma=sum(S[i][1] for i in range(k))

neta_s=len(set([S[i][0] for i in range(k)]))

netano_min=min(S[j][0] for j in range(n))

F[neta_s]=ma

#print(S)
#print(F)
#print(ma)

netalist=[0 for i in range(n)] #i種類目のネタを使った個数
keseru=[] #ネタに重複がある寿司のリスト(消してもいい寿司)
for i in range(k):
    if netalist[S[i][0]]>=1 :
        keseru.append(S[i])
        
    netalist[S[i][0]]+=1

#print(keseru)
#print(netalist)

right=len(keseru)-1
left=k
i=neta_s+1
while len(keseru)>0 and i<=k and right>=0 and left<=n-1 :
    while left<=n-1 and netalist[S[left][0]]!=0 :
        left+=1
    if left==n :
        break
    netalist[S[left][0]]+=1
    F[i]=F[i-1]+S[left][1]-keseru[right][1]
    right-=1
    left+=1
    i+=1

#print(F)
for j in range(neta_s,i+1-1) :
    F[j]+=j**2

print(max(F))


### FIXED CODE ###

n,k=map(int,input().split())
S=[] #[ネタ種類、おいしさ]のリスト
for i in range(n):
    S.append(list(map(int,input().split())))
S.sort(reverse=1,key=lambda x:x[1])

netano_min=min(S[j][0] for j in range(n))
for i in range(n):
    S[i][0]-=netano_min-1

neta=max(S[j][0] for j in range(n)) #ネタの種類数

F=[0 for i in range(neta+1)] #ネタi種のときの美味しさの和の最大値のリスト

ma=sum(S[i][1] for i in range(k))

neta_s=len(set([S[i][0] for i in range(k)]))

netano_min=min(S[j][0] for j in range(n))

F[neta_s]=ma

#print(S)
#print(F)
#print(ma)

netalist=[0 for i in range(n+1)] #i種類目のネタを使った個数
keseru=[] #ネタに重複がある寿司のリスト(消してもいい寿司)
for i in range(k):
    if netalist[S[i][0]]>=1 :
        keseru.append(S[i])
        
    netalist[S[i][0]]+=1

#print(keseru)
#print(netalist)

right=len(keseru)-1
left=k
i=neta_s+1
while len(keseru)>0 and i<=k and right>=0 and left<=n-1 :
    while left<=n-1 and netalist[S[left][0]]!=0 :
        left+=1
    if left==n :
        break
    netalist[S[left][0]]+=1
    F[i]=F[i-1]+S[left][1]-keseru[right][1]
    right-=1
    left+=1
    i+=1

#print(F)
for j in range(neta_s,i+1-1) :
    F[j]+=j**2

print(max(F))
time = int(input())
sec = time%60
min = (time/60)%60
hour = time/60
print (hour+":"+min+":"+sec)



### FIXED CODE ###

#
# 1d
#

def main():
    S = int(input())
    h = S // 60 // 60
    m = S // 60 % 60
    s = S % 60
    print(f"{h}:{m}:{s}")


if __name__ == '__main__':
    main()
# C Monsters Battle Royale
N = int(input())
Monsters = list(map(int, input().split()))
Monsters.sort()

ans = Monsters[0]
for i in range(len(Monsters) - 1):
    tempList = [val % Monsters[i] for val in Monsters[i+1:] if not val % Monsters[i] == 0]
    if tempList:
        if min(tempList) < ans:
            ans = a
        
print(ans)

### FIXED CODE ###

N = int(input())
Mons = list(map(int, input().split()))
Mons = list(set(Mons))
Mons.sort()

minHP = Mons[0]

if minHP == 1 or len(Mons) == 1:
    print(minHP)
    exit()
    
minSA = minHP

for a,b in zip(Mons[:],Mons[1:]):
    sa = b % a
    if sa and sa < minSA:
        minSA = sa

ans = minSA

while 1:
    hoge = [val % ans for val in Mons if val % ans]

    if hoge:
        if ans == min(hoge):
            break
        else:
            ans = min(hoge)
    else:
        break

print(ans)
N,M = map(int,input().split())
A = []
MOD = 10**9+7
memo = {}
for _ in range(M):
  A.append(int(input()))
def step(cur):
  global res
  if cur in memo:
    return memo[cur]
  if cur == N:
    memo[cur] = 1
    return memo[cur]
  if cur > N or cur in A:
    memo[cur] = 0
    return memo[cur]

  memo[cur] = (step(cur+1) + step(cur+2))%MOD
  return memo[cur]

res = 0
print(step(0)%MOD)


### FIXED CODE ###

N,M = map(int,input().split())
MOD = 10**9+7
dp = [0] * (N+1)
dp[1] = 1
for _ in range(M):
  dp[int(input())] = -1
if N<2:
  print(dp[N])
  exit()

if dp[2] != -1:
  dp[2] = 1
for i in range(N+1):
  if dp[i] == -1: continue
  if i-1>=0 and dp[i-1] != -1:
    dp[i] += dp[i-1]
  if i-2>=0 and dp[i-2] != -1:
    dp[i] += dp[i-2]
  dp[i] %= MOD

print(dp[N])
n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
ans=1
if n==k or max(a)<=0 or min(a)>0:
    a.sort(reverse=True)
    for i in range(k):
        ans*=a[i]
        ans%=mod
    print(ans)
    exit()
pos,neg=[],[]
for num in a:
    if num<0:
        neg.append(-num)
    else:
        pos.append(num)
neg.sort(reverse=True)
pos.sort(reverse=True)
nn=len(neg)
np=len(pos)
cand=[]
i,j=0,0
while k>0:
    if i<np-1 and j<nn-1:
        if k>=2:
            if pos[i+1]*pos[i]<neg[i+1]*neg[i]:
                cand.append(-neg[j+1])
                cand.append(-neg[j])
                k-=2
                j+=2
            else:
                cand.append(pos[i])
                k-=1
                i+=1
        else:
            cand.append(pos[i])
            k-=1
            i+=1
    elif j>=nn-1:
        cand.append(pos[i])
        k-=1
        i+=1
    elif i==np-1:
        if k==1:
            cand.append(pos[i])
            i+=1
            k-=1
        else:
            cand.append(-neg[j+1])
            cand.append(-neg[j])
            j+=2
            k-=2
    elif i==np:
        cand.append(-neg[j+1])
        cand.append(-neg[j])
        j+=2
        k-=2
for num in cand:
    ans*=num
    ans%=mod
print(ans)
    

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
ans=1
if n==k or max(a)<0 or min(a)>=0:
    if max(a)<0 and k%2==0:
        a.sort()
    else:
        a.sort(reverse=True)
    for i in range(k):
        ans*=a[i]
        ans%=mod
    print(ans)
    exit()
pos,neg=[],[]
for num in a:
    if num<0:
        neg.append(-num)
    else:
        pos.append(num)
neg.sort(reverse=True)
pos.sort(reverse=True)
nn=len(neg)
np=len(pos)
cand=[]
i,j=0,0
while k>0:
    if i<np-1 and j<nn-1:
        if k>=2:
            if pos[i+1]*pos[i]<neg[j+1]*neg[j]:
                cand.append(-neg[j+1])
                cand.append(-neg[j])
                k-=2
                j+=2
            else:
                cand.append(pos[i])
                k-=1
                i+=1
        else:
            cand.append(pos[i])
            k-=1
            i+=1
    elif j>=nn-1:
        cand.append(pos[i])
        k-=1
        i+=1
    elif i==np-1:
        if k==1:
            cand.append(pos[i])
            i+=1
            k-=1
        else:
            cand.append(-neg[j+1])
            cand.append(-neg[j])
            j+=2
            k-=2
    elif i==np:
        cand.append(-neg[j+1])
        cand.append(-neg[j])
        j+=2
        k-=2
for num in cand:
    ans*=num
    ans%=mod
print(ans)
import copy

def main():
    _data = copy.deepcopy(data)
    while 1 < len(_data):
        d1, v1 = _data[0]
        d2, v2 = _data[1]
        l = f1(v1, v2)
        v = l
        m1, m2 = list(f2(l, v1, v2))
        d = f1(d1*m1, d2*m2)
        for i in range(2): del _data[0]
        _data.append([d, v])
    else:
        f3(_data[0])

def f1(a, b):
    x, y = (a, b) if a >= b else (b, a)
    g = gcd(x, y)
    return lcm(x, y, g)
    
def f2(l, *s):
    for v in s:
        yield l/v
        
def f3(_data):
    d1, v1 = _data
    for d2, v2 in data:
        ans = str((float(d1)/v1)/(float(d2)/v2))
        print int(ans[:-2])
        
def gcd(x, y):
    while y != 0:
        x = x-(x/y)*y
        x, y = y, x
    else:
        return x
    
def lcm(x, y, g):
    return (x*y)/g

while True:
    n = int(raw_input())
    if n == 0: break
    data = [map(int, line.rstrip().split()) for line in open('s.txt')]
    main()

### FIXED CODE ###

import copy

def main():
    _data = copy.deepcopy(data)
    while 1 < len(_data):
        d1, v1 = _data[0]
        d2, v2 = _data[1]
        l = f1(v1, v2)
        v = l
        m1, m2 = list(f2(l, v1, v2))
        d = f1(d1*m1, d2*m2)
        for i in range(2): del _data[0]
        _data.append([d, v])
    else:
        f3(_data[0])

def f1(a, b):
    x, y = (a, b) if a >= b else (b, a)
    g = gcd(x, y)
    return lcm(x, y, g)
    
def f2(l, *s):
    for v in s:
        yield l/v
        
def f3(_data):
    d1, v1 = _data
    for d2, v2 in data:
        ans = str((float(d1)/v1)/(float(d2)/v2))
        print int(ans[:-2])
        
def gcd(x, y):
    while y != 0:
        x = x-(x/y)*y
        x, y = y, x
    else:
        return x
    
def lcm(x, y, g):
    return (x*y)/g

while True:
    n = int(raw_input())
    if n == 0: break
    data = [map(int, raw_input().split()) for i in range(n)]
    main()
n = input()

for i in range(n):
  t, x, y = map(int, input().split())
  if((x+y) > t or (t+x+y) % 2:
     print("No")
     exit()
print("Yes")

### FIXED CODE ###

n = int(input())

for i in range(n):
  t, x, y = map(int, input().split())
  if(x+y) > t or (t+x+y) % 2:
      print("No")
      exit()
print("Yes")