Harryxun/stf_run huggingface dataset:
n = int(input())
V = list(map(int, input().split()))

even = []
odd = []
for nn in range(n):
    if nn % 2 == 0:
        even.append(V[nn])
    else:
        odd.append(V[nn])

e = collections.Counter(even).most_common()
o = collections.Counter(odd).most_common()

if e[0][0] != o[0][0]:
    print(n - e[0][1] - o[0][1])
else:
    if len(e) == 1 and len(o) == 1:
        print(n // 2)
    elif len(e) == 1 and len(o) >= 2:
        print(n - o[0][1])
    elif len(e) >= 2 and len(o) == 1:
        print(n - e[0][1])
    else:
        print(n - max(e[1][1] + o[0][1], e[0][1] + o[1][1]))

### FIXED CODE ###

import collections
n = int(input())
V = list(map(int, input().split()))

even = []
odd = []
for nn in range(n):
    if nn % 2 == 0:
        even.append(V[nn])
    else:
        odd.append(V[nn])

e = collections.Counter(even).most_common()
o = collections.Counter(odd).most_common()

if e[0][0] != o[0][0]:
    print(n - e[0][1] - o[0][1])
else:
    if len(e) == 1 and len(o) == 1:
        print(n // 2)
    elif len(e) == 1 and len(o) >= 2:
        print(n - o[0][1])
    elif len(e) >= 2 and len(o) == 1:
        print(n - e[0][1])
    else:
        print(n - max(e[1][1] + o[0][1], e[0][1] + o[1][1]))
import sys
import numpy as numpy
#input = sys.stdin.readline

N,M = map(int,input().split())
XY = [[] for i in range(N)]

path = [-1] * (N + 1)

for i in range(M):
  x,y = map(int,input().split())
  XY[x - 1].append(y - 1)

  
def recur(n):
  if path[n] != -1:
    return path[n]
  
  elif XY[n] == []:
    path[n] = 0
    return path[n]
        
  else:
    ret = 0
    for chi in XY[n]:
      ret = max(ret,recur(chi) + 1)
    
    path[n] = ret
    #return path[n]
    
for i in range(N):
  recur(i)

print(max(path))

### FIXED CODE ###

import sys
import numpy as numpy
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 5)

N,M = map(int,input().split())
XY = [[] for i in range(N + 1)]

path = [-1] * (N + 1)

for i in range(M):
  x,y = map(int,input().split())
  XY[x - 1].append(y - 1)

  
def recur(n):
  if path[n] != -1:
    return path[n]
  
  elif XY[n] == []:
    path[n] = 0
    return path[n]
        
  else:
    ret = 0
    for chi in XY[n]:
      ret = max(ret,recur(chi) + 1)
    
    path[n] = ret
    return path[n]
    
for i in range(N):
  recur(i)

print(max(path))
N = int(input())
A = list(map(int, input().strip().split()))
day=0
money=1000
stock=0
is_up=True
while day<N :
    if is_up :
        past_day=day
        while A[day]<=A[day+1]:
            day+=1
            if day==N-1:
                break
        stock=int(money/A[past_day])
        money+=stock*(A[day]-A[past_day])
        day+=1
        is_up=False
    else :
        while A[day]>=A[day+1] :
            day+=1
            if day==N-1:
                day+=1
                break
        is_up=True


print("{}".format(money))





### FIXED CODE ###

N = int(input())
A = list(map(int, input().strip().split()))
day=0
money=1000
stock=0
is_up=True
while day<N :
    if is_up :
        past_day=day
        while A[day]<=A[day+1]:
            day+=1
            if day==N-1:
                break
        stock=int(money/A[past_day])
        money+=stock*(A[day]-A[past_day])
        day+=1
        if day==N-1:
            break
        is_up=False
    else :
        while A[day]>=A[day+1] :
            day+=1
            if day==N-1:
                day+=1
                break
        is_up=True


print("{}".format(money))
a = [int(x) for x in input().split(" ")]
if a[1] <= 0:
  print(0)
  exit()
kisu = a[0] // 2 if a[0] % 2 == 0 else a[0] // 2 + 1
gusu = a[0] // 2
yokokisu = a[1] // 2 if a[1] % 2 == 0 else a[1] // 2 + 1
yokogusu = a[1] // 2
ans = kisu * yokokisu + gusu * yokogusu
print(ans)

### 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]
print(a[int(input()) + -1])
N = int(input())
from collections import defaultdict
d = defaultdict(int)
for i in range(N):
  d[input()] += 1

max_cnt = max(d.value())
for v in sorted([key for key,value in d.items() if value == max_cnt]):
  print(v)

### FIXED CODE ###

N = int(input())
from collections import defaultdict
d = defaultdict(int)
for i in range(N):
  d[input()] += 1

max_cnt = max(d.values())
for v in sorted([key for key,value in d.items() if value == max_cnt]):
  print(v)
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

def search(s,k_, lis_p, lis_c, lis):
    if len(lis) >= k_:
        return lis
    s = lis_p[s - 1]
    lis.append(lis_c[s - 1])
    return search(s, k_, lis_p, lis_c, lis)

ans = -10**10
for i in range(n):
    l = search(i+1, k, p, c, [])
    d = max([sum(l[:j+1]) for j in range(len(l))])
    if d> ans:
        ans = d
print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
P = list(map(int, input().split()))
for i in range(N):
    P[i] -= 1
C = list(map(int, input().split()))
 
ans = -(10 ** 18)
 
for si in range(N):
    x = si
    loop = []
    total = 0
    while 1:
        x = P[x]
        loop.append(C[x])
        total += C[x]
        if x == si:
            break
    T = len(loop)  # 周期の大きさ
    tmp = 0
    for i in range(T):
        tmp += loop[i]
        if K < i + 1:
            break
        now = tmp
        if total > 0:  # loopの和が正ならloopを回した方がお得
            loop_times = (K - (i + 1)) // T  # 何周できるか
            now += total * loop_times
        ans = max(ans, now)
 
print(ans)
K, X= map(int, input().split())
if K * 500 >= X:
  print("Yes")
else:
  prine("No")

### FIXED CODE ###

K, X= map(int, input().split())
if K * 500 >= X:
  print("Yes")
else:
  print("No")
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9
    N=I()
    from math import gcd
    d={}
    for i in range(N):
        a,b=MI()
        g=gcd(abs(a),abs(b))
        a=a//g
        b=b//g
        if (a,b) in d:
            d[(a,b)]+=1
             
        else:
            d[(a,b)]=1
        
    ans=1
    L=[]
    for k in d.keys():
        L.append((k,d[k]))


    for i in range(len(L)):
        k=L[i][0]
        v=d[k]
        d[k]=0
        temp=pow(2,v)
        a,b=k
        if (-b,a) in d:
            v2=d[(-b,a)]
            if v2!=0:
                temp+=pow(2,v2)-1
                d[(-b,a)]=0
        if (b,-a) in d:
            v2=d[(b,-a)]
            if v2!=0:
                temp+=pow(2,v2)-1
                d[(b,-a)]=0
        ans=(ans*temp)%mod
        
        
        

        
    print(ans-1)
        
        
            
            
    #せんぶ０の組みをひく
        
    

main()


### FIXED CODE ###



def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    from math import gcd
    from collections import defaultdict
    dd = defaultdict(int)
    temp0=0

    for i in range(N):
        a,b=MI()
        if (a,b)==(0,0):
            temp0+=1
            continue
        
        if a<0:
            a*=-1
            b*=-1
        
        #(+,+)と(+,-)だけにする
        if a*b!=0:
            g=gcd(a,b)
            a=a//g
            b=b//g
            if a*b>0:#(+,+)
                dd[(a,b)]+=1
                dd[b,-a]+=0
                
            else:#(+,-)
                dd[(a,b)]+=1
                dd[(-b,a)]+=0
            
        elif (a,b)!=(0,0):
            #assert 0
            if a==0:
                b=1
            else:
                a=1
                
            dd[(a,b)]+=1
            dd[(b,a)]+=0
        

    ans=1
    
    for k,v in dd.items():
        a,b=k
        if b<=0:
            continue
        #( +,+)と(0,1)だけ見る
        
        if a*b!=0:
            v=dd[k]
            v2=dd[(b,-a)]
        else:
            v=dd[k]
            v2=dd[(b,a)]
        temp=pow(2,v,mod)+pow(2,v2,mod)-1
        
        ans=(ans*temp)%mod

    ans=(ans-1+temp0)%mod
    print(ans)
        
        
            
            
    #せんぶ０の組みをひく
        
    

main()
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
if N%2==0:
    for i in range(N):
        if A[i]%2==1 and (A[i]+1)/2<=N/2:
            B[(A[i]-1)//2]+=1
        else:
            print(0)
            exit()
    for i in range(len(B)):
        if B[i]!=2:
            print(0)
            exit()
    print(int(pow(2,N/2)%(pow(10,9)+7)))
elif N%2==1:
    for i in range(N):
        if A[i]%2==0 and A[i]/2<=(N-1)/2:
            B[A[i]//2]+=1
        else:
            print(0)
            exit()
    if B[0]!=1:
        print(0)
        exit()
    for i in range(len(B)-1):
        if B[i+1]!=2:
            print(0)
            exit()
    print(int(pow(2,(N-1)/2)%(pow(10,9)+7)))
else:
    print(0)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
IndexCount=0
IndexRe=0
Divider=pow(10,9)+7
ans=1
if N%2==0:
    for i in range(N):
        if A[i]%2==1 and (A[i]+1)/2<=N/2:
            B[(A[i]-1)//2]+=1
        else:
            print(0)
            exit()
    for i in range((N//2+N%2)):
        if B[i]!=2:
            print(0)
            exit()
    IndexCount=int((N/2)//1000)
    IndexRe=int((N/2)%1000)
    for i in range(IndexCount):
        ans=(ans*(pow(2,1000)%Divider))%Divider
    ans=(ans*(pow(2,IndexRe)%Divider))%Divider
    print(ans)
elif N%2==1:
    for i in range(N):
        if A[i]%2==0 and A[i]/2<=(N-1)/2:
            B[A[i]//2]+=1
        else:
            print(0)
            exit()
    if B[0]!=1:
        print(0)
        exit()
    for i in range((N//2+N%2)-1):
        if B[i+1]!=2:
            print(0)
            exit()
    IndexCount=int(((N-1)/2)//1000)
    IndexRe=int(((N-1)/2)%1000)
    for i in range(IndexCount):
        ans=(ans*(pow(2,1000)%Divider))%Divider
    ans=(ans*(pow(2,IndexRe)%Divider))%Divider
    print(ans)
else:
    print(0)
X, Y = map(int, input().split())

ans = 0

def f(n):
    if n == 3:
        tmp = 100000
    elif n == 2:
        tmp = 200000
    elif n == 1:
        tmp= 300000

ans = f(X) + f(Y)

if ans == 600000:
    ans += 400000

print(ans)


### FIXED CODE ###

X, Y = map(int, input().split())

ans = 0

if X == 3:
    ans += 100000
elif X == 2:
    ans += 200000
elif X == 1:
    ans += 300000

if Y == 3:
    ans += 100000
elif Y == 2:
    ans += 200000
elif Y == 1:
    ans += 300000


if ans == 600000:
    ans += 400000

print(ans)
n, m = map(int, input().split())
 
forbidden = []
for i in range(m):
  forbidden.append(int(input()))
forbidden = set(forbidden) 
ans = [0]*n
ans[0] = 1
if 1 not in forbidden:
  ans[1] = 1
for i in range(2,n):
  if i not in forbidden:
    ans[i] += ans[i - 1] + ans[i - 2]
    ans[i] %= 1000000007
print(ans[-1])

### FIXED CODE ###

n, m = map(int, input().split())
 
forbidden = []
for i in range(m):
  forbidden.append(int(input()))
forbidden = set(forbidden) 
ans = [0]*(n+1)
ans[0] = 1
if 1 not in forbidden:
  ans[1] = 1
for i in range(2,n+1):
  if i not in forbidden:
    ans[i] += ans[i - 1] + ans[i - 2]
    ans[i] %= 1000000007
print(ans[-1])
N,K = map(int, input().split())
H = list(map(int, input().split()))

H.sort(reverse=True)

if N <= K:
  print(0)
else:
  for i in range(K):
    H.pop(i)
  print(sum(H))

### FIXED CODE ###

N,K = map(int, input().split())
H = list(map(int, input().split()))
 
H.sort(reverse=True)
 
if N <= K:
  print(0)
else:
  del H[0:K]
  print(sum(H))
for i=1 in range(10):
    for j=1 in range(10):
        if(i > 0 and j > 0):
            print(str(i) + 'x' + str(j) + '=' + str(i*j))

### FIXED CODE ###

for i in range(1, 10):
    for j in range(1,10):
        print(str(i) + 'x' + str(j) + '=' + str(i*j))
def solve(pick, idx):

    if pick == 0: return 0
    if idx >= n: return -float('inf')

    if n-idx+2 < pick*2: return -float('inf')
    total = max(A[idx] + solve(pick-1, idx+2), solve(pick, idx+1))

    dp[(pick, idx)] = total
    return total

n = int(input())
A = list(map(int, input().split()))
dp = {}
pick = n//2

print(solve(pick, 0))

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 9)
def solve(pick, idx):

    if pick == 0: return 0
    if idx >= n: return -float('inf')
    if (pick, idx) in dp: return dp[pick, idx]
    if n-idx+2 < pick*2: return -float('inf')
    total = max(A[idx] + solve(pick-1, idx+2), solve(pick, idx+1))

    dp[(pick, idx)] = total
    return total

n = int(input())
A = list(map(int, input().split()))
dp = {}
pick = n//2

print(solve(pick, 0))
import numpy as np
H,W,M=map(int, input().split())
hl=np.array([0 for i in range(H+1)])
wl=np.array([0 for i in range(W+1)])
ms=[]
for i in range(M):
    h,w=map(int, input().split())
    hl[h]+=1
    wl[w]+=1
    ms.append([h,w])
a=max(hl)
b=max(wl)
hmax= [i for i, x in enumerate(hl) if x ==a]
wmax=[i for i, x in enumerate(wl) if x ==b]
# hmax=np.where(hl == hl.max())[0]
# wmax=np.where(wl == wl.max())[0]
a=max(hl)
b=max(wl)
bl=False
if len(hmax)*len(wmax)>M:
    bl=True
else:
    for x in hmax:
        for y in wmax:
            if [x,y] not in ms:
                bl=True
                break
        if bl:
            break
if bl:
    print(a+b)
else:
    print(a+b-1)

### FIXED CODE ###


H,W,M=map(int, input().split())
hl=[0 for i in range(H+1)]
wl=[0 for i in range(W+1)]
ms=[]
for i in range(M):
    h,w=map(int, input().split())
    hl[h]+=1
    wl[w]+=1
    ms.append([h,w])
a=max(hl)
b=max(wl)
hmax=[]
wmax=[]
s=0
for x in ms:
    if  hl[x[0]]==a and wl[x[1]]==b:
        s+=1
c=hl.count(a)
d=wl.count(b)
if s<c*d:
    print(a+b)
else:
    print(a+b-1)
import sys
sys.setrecursionlimit(10**6)
n,m,k = map(int, input().split())
mod = 998244353
ans = 0
#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
#a/b = a*(b`)となるb`を求める
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod+x%mod)%mod
combi = [0 for i in range(n)]
combi[0] = 1
combi[1] = n-1
for i in range(2,n):
    combi[i] = (combi[i-1]*(n-i)*mod_inv(i,mod)) % mod
for i in range(k+1):
    plus = m * pow(m-1,n-1-i,mod)
    plus *= combi[n-i-1]
    plus %= mod
    ans += plus
    ans %= mod
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
n,m,k = map(int, input().split())
mod = 998244353
ans = 0
#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
#a/b = a*(b`)となるb`を求める
def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod+x%mod)%mod
combi = [0 for i in range(n)]
combi[0] = 1
for i in range(1,n):
    combi[i] = (combi[i-1]*(n-i)*mod_inv(i,mod)) % mod
for i in range(k+1):
    plus = m * pow(m-1,n-1-i,mod)
    plus *= combi[n-i-1]
    plus %= mod
    ans += plus
    ans %= mod
print(ans)
def main():
    # arg = getInput(1)
    arg = getInput(input())
    ans = process(arg)
    print(ans)
    
def process(arg):
    ans = 0
    ensyu = arg[0][0]
    kensu = arg[0][1]
    aida = list()
    for x in range(arg[0][1]):
        mae = arg[1][x-1]
        b = arg[1][x]
        if x == 0:
            w = b + arg[1][kensu-1]
        else:
            w = b - mae
        aida.append(w)

    m = max(aida)
    for y in aida:
        if y != m:
            ans = ans + y
    return ans

def getInput(input):
    # 行数
    n = 2
    # 戻り値
    ret = None
    ret2 = None
    if n == 1:
        pass
        # ret = input
        # ret = list(input)
        # ret = int(input)
        # ret = input.split()
        # ret = list(map(int, input.split()))
        # ret = input.split('T')
    else:
        for x in range(n):
            # 取得したい形式に変換
            ret = list(map(int, input[x].split()))

    return ret

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    input1 = input()
    input2 = input()
    k , n = map(int , input1.split())
    al = list(map(int , input2.split()))
    arg = [[k,n],al]
    ans = process(arg)
    print(ans)
    
def process(arg):
    ans = 0
    ensyu = arg[0][0]
    kensu = arg[0][1]
    aida = list()
    for x in range(arg[0][1]):
        mae = arg[1][x-1]
        b = arg[1][x]
        if x == 0:
            # 1件目は演習
            w = b + ensyu - arg[1][kensu-1]
        else:
            w = b - mae
        aida.append(w)

    m = max(aida)
    flg = False
    for y in aida:
        if flg == True or y != m :
            ans = ans + y
        else:
            flg = True
    return ans

def getInput(input):

    return 

if __name__ == '__main__':
    main()
n,x,t = map(int,input.split())
a = (n//x + 1)*t
print(a)

### FIXED CODE ###

n,x,t = map(int,input().split())
if n%x==0:
    print((n//x)*t)
else:
    print(((n//x)+1)*t)
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
P = [P[i] - 1 for i in range(N)]

loop_list = [] # ([indexes])
loop_score_list = []
loop_index_list = [0]*N
is_included_loop = [0] * N
num_loop = 0

for start in range(N):
    if is_included_loop[start]:
        continue
    now = start
    count = 1
    visited = [-1]*N # count
    visited[now] = 0
    while True:
        now = P[now]
        if visited[now] != -1:
            terminate_count = count
            start_count = visited[now]
            loop_start_idx = now
            break
        visited[now] = count
        count += 1
    
    num_loop += 1
    now = loop_start_idx
    loop_indexes = [now]
    visited = [-1]*N
    visited[now] = 0
    count = 1
    loop_score = 0
    while True:
        now = P[now]
        if visited[now] != -1:
            break
        loop_indexes.append(now)
        visited[now] = count
        loop_index_list[now] = num_loop
        loop_score += C[now]
        is_included_loop[now] = 1
    loop_list.append(loop_indexes)
    loop_score_list.append(loop_score)


scores = []
for start in range(N):
    tmp_score = 0
    rest = K
    now = start
    while not is_included_loop[now] and rest > 0:
        now = P[now]
        rest -= 1
        tmp_score += C[now]
        scores.append(tmp_score)
    
    if rest <= 0:
        scores.append(tmp_score)
        continue
    # loop
    number_of_loop = loop_index_list[now] - 1
    one_cicle_score = loop_score_list[number_of_loop]
    if one_cicle_score < 0:
        continue
    if rest <= len(loop_list[number_of_loop]):
        while rest >= 0:
            now = P[now]
            rest -= 1
            tmp_score += C[now]
            scores.append(tmp_score)
        continue
    else:
        n_l = rest // len(loop_list[number_of_loop])
        tmp_score += n_l * one_cicle_score
        scores.append(tmp_score)
print(max(scores))
        
    

### FIXED CODE ###

R, C,K = map(int, input().split())
dp = [[[0]*(C+1) for k in range(R+1)] for _ in range(4)]
# dp[r][c][j] :=r index c columns already j cnt
dp[0][0][0] = 0
D = [[0 for i in range(C+1)] for j in range(R+1)]
import random
for i in range(K):
    r, c, v = map(int,input().split())
    D[r][c] = v
 
for i in range(R+1):
    for j in range(C+1):
        if D[i][j] > 0:
            v = D[i][j]
            M = max(dp[k][i-1][j] for k in range(4))
            dp[0][i][j] = max(dp[0][i][j-1], M)
            dp[1][i][j] = max(dp[0][i][j-1]+v, dp[1][i][j-1], M+v)
            dp[2][i][j] = max(dp[1][i][j-1]+v, dp[2][i][j-1])
            dp[3][i][j] = max(dp[2][i][j-1]+v, dp[3][i][j-1])
 
        else:
            M = max(dp[k][i-1][j] for k in range(4))
            dp[0][i][j] = max(dp[0][i][j-1], M)
            dp[1][i][j] = dp[1][i][j-1]
            dp[2][i][j] = dp[2][i][j-1]
            dp[3][i][j] = dp[3][i][j-1]
 
ans = 0
for i in range(4):
    ans = max(ans, dp[i][-1][-1])
print(ans)
import math
 
a,b = map(int,input().split())
 
def lcm(x,y):
    return((x*y)/(math.gcd(x,y)))
 
print(int(lcm(a,b)))

### FIXED CODE ###

import fractions

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

def lcm(x,y):
    z = int(x*y/fractions.gcd(x,y))
    return z
    
print(lcm(a,b))
from collections import deque
from typing import List


def main():
    n = int(input())
    v = [input().split("")]
    print(pp(n, v))


def pp(n: int, v: List[str]) -> List[str]:
    x = []
    y = deque([])

    if n % 2 == 0:
        for i in range(n):
            if i % 2 == 0:
                y.append(v[i])
            else:
                x.append(v[i])
    else:
        for i in range(n):
            if i % 2 == 0:
                x.append(v[i])
            else:
                y.append(v[i])

    ret = []
    for i in range(len(x)):
        ret.append(x.pop())

    for i in range(len(y)):
        ret.append(y.popleft())

    return ret


if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque
from typing import List


def main():
    n = int(input())
    v = input().split(" ")
    print(*pp(n, v))


def pp(n: int, v: List[str]) -> List[str]:
    x = []
    y = deque([])

    if n % 2 == 0:
        for i in range(n):
            if i % 2 == 0:
                y.append(v[i])
            else:
                x.append(v[i])
    else:
        for i in range(n):
            if i % 2 == 0:
                x.append(v[i])
            else:
                y.append(v[i])

    ret = []
    for i in range(len(x)):
        ret.append(x.pop())

    for i in range(len(y)):
        ret.append(y.popleft())

    return ret


if __name__ == "__main__":
    main()
abc_s = input()
abc_a = abc_s.split(" ")
abc = [int(x) for x in abc_a]

sorted = False

while sorted == False:
  sorted = True
  if abc[0] > abc[1]:
    sorted == False
    tmp = abc[0]
    abc[0] = abc[1]
    abc[1] = tmp
  if abc[1] > abc[2]:
    sorted == False
    tmp = abc[1]
    abc[1] = abc[2]
    abc[2] = tmp

print("{array[0]} {array[1]} {array[2]}".format(abc))


### FIXED CODE ###

abc_s = input()
abc_a = abc_s.split(" ")
abc = [int(x) for x in abc_a]
 
sorted = False
 
while sorted == False:
  sorted = True
  if abc[0] > abc[1]:
    sorted = False
    tmp = abc[0]
    abc[0] = abc[1]
    abc[1] = tmp
  if abc[1] > abc[2]:
    sorted = False
    tmp = abc[1]
    abc[1] = abc[2]
    abc[2] = tmp
 
print("{0[0]} {0[1]} {0[2]}".format(abc))
# ABC54 D
n,ma,mb = map(int, input().split())
a = []
b = []
c = []
for i in range(N):
    ai,bi,ci = map(int, input().split())
    a.append(ai)
    b.append(bi)
    c.append(ci)
    
max_sum = n * 10
max_cost = 100000000
dp = [[[max_cost for k in range(max_sum+1)] for j in range(max_sum+1)] for i in range(n+1)]

dp[0][0][0] = 0
for i in range(n):
    for ca in range(max_sum+1):
        for cb in range(max_sum+1):
            if(dp[i][ca][cb] == max_cost):
                continue
            dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb])
            dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb]+c[i])

ans = max_cost
for ca in range(1,max_sum+1):
    for cb in range(1,max_sum+1):
        if(ca*mb == cb*ma):
            ans = min(ans, dp[n][ca][cb])

if(ans == max_cost):
    print(-1)
else:
    print(ans)

### FIXED CODE ###

# ABC54 D
n,ma,mb = map(int, input().split())
a = []
b = []
c = []
for i in range(n):
    ai,bi,ci = map(int, input().split())
    a.append(ai)
    b.append(bi)
    c.append(ci)
    
max_sum = n * 10
max_cost = 100000000
dp = [[[max_cost for k in range(max_sum+1)] for j in range(max_sum+1)] for i in range(n+1)]

dp[0][0][0] = 0
for i in range(n):
    for ca in range(max_sum+1):
        for cb in range(max_sum+1):
            if(dp[i][ca][cb] == max_cost):
                continue
            dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb])
            dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb]+c[i])

ans = max_cost
for ca in range(1,max_sum+1):
    for cb in range(1,max_sum+1):
        if(ca*mb == cb*ma):
            ans = min(ans, dp[n][ca][cb])

if(ans == max_cost):
    print(-1)
else:
    print(ans)