Harryxun/stf_run huggingface dataset:
n,a,b = map(int,input().split())
if a>n:
  print(a)
ans = 0
else:
  temp = N//(a+b)
  ans = temp*a
  temp2 = N- temp
  if temp2 < a:
    print(ans+temp2)
  else:
    print(ans+a)

### FIXED CODE ###

n,a,b = map(int,input().split())
temp = n//(a+b)
ans = temp*a
temp2 = n%(a+b)
print(ans+min(temp2,a))
#Nは頂点数, Mは辺数(2 <= N <= 1000, 1 <= M <= min(N(N-1, 2000)))
#頂点1から頂点Nに移動して、移動スコアを最大にする
#->移動スコアを正負反転させれば最短経路問題
#->負閉路を考慮してベルマンフォード法を利用
INF = 1 << 50

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

#辺を登録
Sides = []
for i in range (M):
    Sides.append(map(int,input().split()))
#コストを反転
    Sides[i][2] = Sides[i][2] * (-1)

#各頂点の最短距離を初期化
Vertexes = [INF]*N+1
Vertexes[1] = [0]

#負閉路のチェック用
negative = [False] * N+1

#ベルマンフォード法による最短距離探索
for count in range(N):
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        cost = Sides[i][2]
        if (Vertexes[to_v] > Vertexes[from_v]+cost):
            if(count==N):
                negative[to_v] = True:
            Vertexes[to_v] = Vertexes[from_v]+cost

#負閉路の確認
for count in range(N-1):
    flag = 0
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        if negative[from_v] and negative[to_v] is False:
            negative[to_v] = True
            flag = 1
    if flag ==0:
        break

if negative[N]:
    print('inf')
else:
    print(Vertexes[N])

### FIXED CODE ###

#Nは頂点数, Mは辺数(2 <= N <= 1000, 1 <= M <= min(N(N-1, 2000)))
#頂点1から頂点Nに移動して、移動スコアを最大にする
#->移動スコアを正負反転させれば最短経路問題
#->負閉路を考慮してベルマンフォード法を利用
INF = 1 << 50

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

#辺を登録
Sides = []
for i in range (M):
    Side = list(map(int,input().split()))
    Sides.append(Side)
#コストを反転
    Sides[i][2] = Sides[i][2] * (-1)

#各頂点の最短距離を初期化
Vertexes = [INF]*(N+1)
Vertexes[1] = 0

#負閉路のチェック用
negative = [False] * (N+1)

#ベルマンフォード法による最短距離探索
for count in range(N):
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        cost = Sides[i][2]
        if (Vertexes[to_v] > Vertexes[from_v]+cost):
            if(count==N-1):
                negative[to_v] = True
            else:
                Vertexes[to_v] = Vertexes[from_v]+cost

#負閉路の確認
for count in range(N-1):
    flag = 0
    for i in range(M):
        from_v = Sides[i][0]
        to_v = Sides[i][1]
        if negative[from_v] :
            negative[to_v] = True
            flag = 1
    #if flag ==0:
     #   break

if negative[N]:
    print('inf')
else:
    print(-Vertexes[N])
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n = i_input()
    t, a = i_map()
    num_list = i_list()

    abs_num = INF
    ans = 0

    for i in range(n):
        tmp = t - num_list[i] * 0.006
        if abs(a-tmp) < abs_num:
            abs_num = abs(a-tmp)
            ans = i + 1

    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys, re
from math import ceil, floor, sqrt, pi, factorial#, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n = i_input()
    t, a = i_map()
    num_list = i_list()

    abs_num = INF
    ans = 0

    for i in range(n):
        tmp = t - num_list[i] * 0.006
        if abs(a-tmp) < abs_num:
            abs_num = abs(a-tmp)
            ans = i + 1

    print(ans)

if __name__ == '__main__':
    main()
a_dict = {chr(a): 0 for a in range(97, 123)}
while True:
    S = input().lower()
    if not S:
        break
    for c in S:
        if c in a_dict:
            a_dict[c] += 1

for k, v in a_dict.items():
    print('{0} : {1}'.format(k, v))



### FIXED CODE ###

import fileinput
a_dict = {chr(c): 0 for c in range(97, 123)}
for line in fileinput.input():
    line = line.lower()
    for c in line:
        if c in a_dict:
            a_dict[c] += 1

for k, v in a_dict.items():
    print('{0} : {1}'.format(k, v))
N=int(input())
s = [int(input()) for i in range(N)]

print('AC x '+s.count('AC'))
print('WA x '+s.count('WA'))
print('TLE x '+s.count('TLE'))
print('RE x '+s.count('RE'))


### FIXED CODE ###

N=int(input())
s=[]
for i in range(N):
    s.append(input())
a=s.count('AC')
b=s.count('WA')
c=s.count('TLE')
d=s.count('RE')
print('AC x ' +str(a))
print('WA x ' +str(b))
print('TLE x ' +str(c))
print('RE x ' +str(d))
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort()
l = ab[(n+1)//2-1][0]
ab.sort(key=lambda x:x[1], reverse=True)
r = ab[(n+1)//2-1][1]

if n % 2 == 0:
    print(1/0)
print(r-l+1)

### FIXED CODE ###

n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]

if n % 2:

    ab.sort()
    l = ab[(n+1)//2-1][0]

    ab.sort(key=lambda x:x[1], reverse=True)
    r = ab[(n+1)//2-1][1]

    print(r-l+1)

else:

    a = [ai for ai, bi in ab]
    b = [bi for ai, bi in ab]

    a.sort()
    b.sort()

    ll = a[n//2-1]
    lr = b[n//2-1]

    rl = a[n//2]
    rr = b[n//2]


    print((lr+rr) - (ll+rl) + 1)
a = int(input())
b = int(input())
c = int(input())
d = int(input())

if abs(a - b) <= d and abs(b - c) <= d:
    print('Yes')
elif abs(a - c) <= d:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

if abs(a - c) <= d:
    print('Yes')
elif (a < b and b < c) or (a > b and b > c):
    if abs(a - b) <= d and abs(b - c) <= d:
        print('Yes')
    else:
        print('No')
else:
    print('No')
n=int(input())
k=int(input())
ans=0
for _ in map(int,input()):
  a=int(input())
  ans+=min(a,k-a)
print(ans+ans)

### FIXED CODE ###

n=int(input())
k=int(input())
ans=0
for a in map(int,input().split()):
  ans+=min(a,k-a)
print(ans+ans)
#16D8101014F 久留米 竜之介 Python3
#a=[]
while(True):
	i=0
	tmp=0
	a=input().split('"') 
	aL=len(a)
	b=input().split('"')
	bL=len(b)
	if aL != bL:
		print("DIFFELENT")
	else:
		while(True):
			if a[i] != b[i]:
				print("DIFFERENT")
				break
			elif i > aL-2:
				if tmp==1:
					print("CLOSE")
					break
				else:
					print("IDENTICAL")
					break
			elif a[i+1] != b[i+1]:
				if tmp==1:
					print("DIFFERENT")
					break
				else: tmp=1
			i +=2
	


### FIXED CODE ###

#16D8101014F 久留米 竜之介 Python3
#a=[]
while(True):
	i=0
	tmp=0
	a=input().split('"') 
	aL=len(a)
	if a[0] ==".":
		break
	b=input().split('"')
	bL=len(b)
		
	if aL != bL:
		print("DIFFERENT")
	else:
		while(True):
			if a[i] != b[i]:
				print("DIFFERENT")
				break
			elif i > aL-2:
				if tmp==1:
					print("CLOSE")
					break
				else:
					print("IDENTICAL")
					break
			elif a[i+1] != b[i+1]:
				if tmp==1:
					print("DIFFERENT")
					break
				else: tmp=1
			i +=2
s = input()

s = s[::-1]

s = list(s)
#print(s)
count = 0
can = True
jm = []
j = 0
maxcount = 0

for i in s:
    jm.append(s[j])
    j += 1
    count += 1
    if count > 7:
        can = False
#        print(0)
        break
    elif "".join(jm) == "maerd":
        maxcount += count
        count,j = 0,0
#        print(1)
    elif "".join(jm) == "remaerd":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(2)
elif "".join(jm) == "esare":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(jm + 1)
elif "".join(jm) == "rersare":
        maxcount += count
        count,j = 0,0
        jm = []
    else:
        pass


#print("forward bool is" + str(can))

if maxcount == 0:
    can = False

if can:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

s = input()

s = s[::-1]
s = list(s)
#print(s)
count = 0
can = True
jm = []
j = 0
maxcount = 0
for i in s:
    jm.append(i)
    j += 1
    count += 1
    if count > 7:
        can = False
#        print(0)
        break
    elif "".join(jm) == "maerd":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(1)
    elif "".join(jm) == "remaerd":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(2)
    elif "".join(jm) == "esare":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(3)
    elif "".join(jm) == "resare":
        maxcount += count
        count,j = 0,0
        jm = []
#        print(4)
    else:
#        print(5,end = "")
        pass


#print("forward bool is" + str(can))

if maxcount == 0:
    can = False

if can:
    print("YES")
else:
    print("NO")
import math
import sys
args = sys.argv
A = int(args[1])
P = int(args[2])
if 0<=A and P<=100 :
    Pi = math.floor((3*A +P)/2)
    print(Pi)

### FIXED CODE ###

import math

A,P=map(int, input().split())

if 0<=A and P<=100 :
    Pi = math.floor((3*A +P)/2)
    print(Pi)
else :
    print("ERROR")
#include <iostream>

#include <vector>
#include <algorithm>

using namespace std;


int main() {
	    int a,b;
	    cin>>a;vector<string> colour;
	    
	    while(a--){
	        string str;
	        cin>>str;
	        string key=str;
	        	if (!(std::find(colour.begin(), colour.end(), key) != colour.end())){
	        	    colour.push_back(str); 
	        	}
	    }
	    cout<< colour.size()<<endl;
	return 0;
}


### FIXED CODE ###

list1 =[]
number = int(input())
for i in range(0,number):    
    numbers = input()
    list1.append(numbers)
setOfMarks=set(list1)
print(len(setOfMarks))
N = int(input())
A = list(map(int, input().split()))

# N = 5
# A = [1, 1, 2, 1, 2]

Aset = set(A)
lst = {}
for i in Aset:
    lst[i] = 0

# print(lst)
    
for i in range(N):
    lst[A[i]] += 1

# print(lst)
# c = dict(lst) # c = dict(lst)で異なるオブジェクトとして等価なcを定義
              # c = lst だと、同一のオブジェクトとなってしまう？

for i in lst:
#     print('i: {}'.format(i))
    c[i] = 0
    tmp_lst = dict(lst)
#     print('tmp_lst {}'.format(tmp_lst))
#     print('tmp_lst[i]: {}'.format(tmp_lst[i]))
    tmp_lst[i] -= 1
#     print('tmp_lst[i]: {}'.format(tmp_lst[i]))
    for j in tmp_lst:
#         print(tmp_lst[j])
        c[i] += tmp_lst[j]*(tmp_lst[j]-1)//2
#         print('c[i]: {}'.format(c[i]))
        
for i in range(N):
    print(int(c[A[i]]))

### FIXED CODE ###

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

Aset = set(A)
lst = {}
for i in Aset:
    lst[i] = 0
    
for i in range(N):
    lst[A[i]] += 1

llst = dict(lst) # llst は、valueが1のものを消したリスト
for i in lst:
    if lst[i] == 1:
        llst.pop(i)

c = dict(lst) # c は keyの値である場合の組み合わせの数。
              # c = dict(lst)で異なるオブジェクトとして等価なcを定義
              # c = lst だと、同一のオブジェクトとなってしまう？
c_all = 0
for j in llst:
    c_all += llst[j]*(llst[j]-1)//2

# print('c_all:{}'.format(c_all))
for i in lst:
#     print('i:{}'.format(i))
#     print('lst[i]:{}'.format(lst[i]))
    c[i] = c_all
    c[i] = c[i] - lst[i]*(lst[i]-1)//2 + (lst[i]-1)*(lst[i]-2)//2
        
for i in range(N):
    print(c[A[i]])
def check(string):
	N = len(string)
	rev = string[::-1]
	for i in range(N//2+1):
		if(rev[i]!=string[i]):
			break
			return False
	return True


string = input()
n = len(string)
n-=1
str1 = string[0:((n-1)//2)]
str2 = string[((n+3)//2):n]
if check(str1) and check(str2):
	print("Yes")
else:
	print("No")

### FIXED CODE ###

def check(string2):
	N = len(string2)
	rev = string2[::-1]
	for i in range((N//2)+1):
		if(rev[i]!=string2[i]):
			return False
	return True


string = input()
n = len(string)
n-=1
str1 = string[0:int((n)/2)]
# print(str1)
str2 = string[int((n)/2)+1:n+1]
# print(str2)
if check(str1) and check(str2) and check(string):
	print("Yes")
else:
	print("No")
import math

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

dp = [math.inf] * (n + 1)
dp[0] = 0
dp[1] = abs(h[0]-h[1])

for i in range(2, n):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

### FIXED CODE ###

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

dp = [float("inf")] * (n + 1)
dp[0] = 0
dp[1] = abs(h[0]-h[1])

for i in range(2, n):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])
import math

(A,B) = map(int,input().split(" "))
ans = (A * B) // math.gcd(A, B)
print(ans)


### FIXED CODE ###

#最小公倍数を求める

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

m=max(A,B)
n=min(A,B)
while m%n != 0:
    temp = n
    n = m%n
    m = temp


print(A*B // n)
#!usr/bim/python
#! -*- coding: utf-8 -*-


n_m = raw_input()
n,m = n_m.split()

#n = int(n)
m = int(m)

shima_1_list = []
shima_2_list = []

i = 0
while i < m:
    teikibin = raw_input()
    teikibin = teikibin.split()
    if teikibin[0] == "1":
        shima_1_list.append(teikibin[1])
    elif teikibin[1] == n:
        shima_2_list.append(teikibin[0])
    i += 1

status = 0

for shima_1 in shima_1_list:
    if shima_1 in shima_2_list:
        status = 1

if status == 0:
    print "IMPOSSIBLE"
else:
    print "POSSIBLE"


### FIXED CODE ###

#!usr/bim/python
#! -*- coding: utf-8 -*-


num = raw_input()

print "ABC"+num
l=list(map(int, input().split())
print(max(l[0]*l[1],l[2]*l[3])

### FIXED CODE ###

l=list(map(int, input().split()))
print(max(l[0]*l[1],l[2]*l[3]))
#!/usr/bin/env python3

class City:
    def __init__(self, i1, p, y, o=None):
        self.i1 = i1
        self.p = p
        self.y = y
        self.o = o

    def __repr__(self):
        return f"City({self.i1}, {self.p}, {self.y}, {self.o})"

    def get_id(self):
        return f"{self.p:06}{self.o:06}"

def put_ids(n, cities):
    years = {i: [] for i in range(1, n + 1)}
    for c in cities:
        years[c.p].append(c.y)

    year_to_order = {i: {} for i in range(1, n + 1)}
    for i in range(1, n + 1):
        ys = sorted(years[i])
        for j0, y in enumerate(ys):
            year_to_order[i][y] = j0 + 1

    for c in cities:
        c.o = year_to_order[c.p][c.y]

def main():
    n, m = map(int, input().split())
    cities = []
    for i0 in range(m):
        p, y = map(int, input().split())
        city = City(i0, p, y)
        cities.append(city)
    put_ids(n, cities)
    # for c in cities:
    #     print(c.get_id())

main()


### FIXED CODE ###

#!/usr/bin/env python3

class City:
    def __init__(self, i1, p, y, o=None):
        self.i1 = i1
        self.p = p
        self.y = y
        self.o = o

    # def __repr__(self):
    #     return f"City({self.i1}, {self.p}, {self.y}, {self.o})"

    def get_id(self):
        return "%06d%06d" % (self.p, self.o)

def put_ids(n, cities):
    years = {i: [] for i in range(1, n + 1)}
    for c in cities:
        years[c.p].append(c.y)

    year_to_order = {i: {} for i in range(1, n + 1)}
    for i in range(1, n + 1):
        ys = sorted(years[i])
        for j0, y in enumerate(ys):
            year_to_order[i][y] = j0 + 1

    for c in cities:
        c.o = year_to_order[c.p][c.y]

def main():
    n, m = map(int, input().split())
    cities = []
    for i0 in range(m):
        p, y = map(int, input().split())
        city = City(i0, p, y)
        cities.append(city)
    put_ids(n, cities)
    for c in cities:
        print(c.get_id())

main()
n=int(input())
s=list(map(int,input().split()))
d1=dict()
d2=dict()
for i in range(0,n,2):
  if i not in d1:
    d1[i]=1
  else:
    d1[i]+=1
for i in range(1,n,2):
  if i not in d2:
    d2[i]=1
  else:
    d2[i]+=1
dmk,dm,dmmk,dmm=[],0,[],0
for i in d1.keys():
  if dm<d1[i]:
    dmm=dm
    dmmk=dmk
    dm=d1[i]
    dmk=[i]
  elif d1==d1[i]:
    dmk+=[i]
  elif dmm<d1[i]:
    dmm=d1[i]
    dmmk=[i]
  elif dmm=d1[i]:
    dmmk+=[i]
d1=[len(dmk),len(dmmk)]
dmk,dm,dmmk,dmm=[],0,[],0
for i in d2.keys():
  if dm<d2[i]:
    dmm=dm
    dmmk=dmk
    dm=d2[i]
    dmk=[i]
  elif d2==d2[i]:
    dmk+=[i]
  elif dmm<d2[i]:
    dmm=d2[i]
    dmmk=[i]
  elif dmm=d2[i]:
    dmmk+=[i]
d2=[len(dmk),len(dmmk)]
if d1[0]>1 or d2[0]>1:
  print(n-d1[0]-d2[0])
else:
  print(n-max(d1[0]+d2[1],d1[1]+d2[0]))


### FIXED CODE ###

n=int(input())
s=list(map(int,input().split()))
d1=dict()
d2=dict()
for i in range(0,n,2):
  if s[i] not in d1:
    d1[s[i]]=1
  else:
    d1[s[i]]+=1
for i in range(1,n,2):
  if s[i] not in d2:
    d2[s[i]]=1
  else:
    d2[s[i]]+=1
dmk,dm,dmmk,dmm=[],0,[],0
for i in d1.keys():
  if dm<d1[i]:
    dmm=dm
    dmmk=dmk
    dm=d1[i]
    dmk=[i]
  elif d1==d1[i]:
    dmk+=[i]
  elif dmm<d1[i]:
    dmm=d1[i]
    dmmk=[i]
  elif dmm==d1[i]:
    dmmk+=[i]
d1=[dm,dmk,dmm,dmmk]
dmk,dm,dmmk,dmm=[],0,[],0
for i in d2.keys():
  if dm<d2[i]:
    dmm=dm
    dmmk=dmk
    dm=d2[i]
    dmk=[i]
  elif d2==d2[i]:
    dmk+=[i]
  elif dmm<d2[i]:
    dmm=d2[i]
    dmmk=[i]
  elif dmm==d2[i]:
    dmmk+=[i]
d2=[dm,dmk,dmm,dmmk]
if len(d1[1])>1 or len(d2[1])>1 or d1[1]!=d2[1]:
  print(n-d1[0]-d2[0])
else:
  print(n-max(d1[0]+d2[2],d1[2]+d2[0]))
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
a=0
i=0
while d<=x:
    d+=l[i]
    a+=1
    i+=1
print(a)


### FIXED CODE ###

n,x=map(int,input().split())
l=list(map(int,input().split()))
d=0
a=1
for i in range(n):
    d+=l[i]
    #print(d)
    if d<=x:
        a+=1
print(a)
n = int(input())
a = list(map(int, input().split()))
b, idx = zip(*sorted(zip(a, range(1, n))))
if b[-1] < 0:
    print(n - 1)
    # 全て負の数なので後ろから累積和をとる
    for i in range(n - 1):
        print(n - i, n - i - 1)
elif b[0] >= 0:
    print(n - 1)
    for i in range(n - 1):
        print(i + 1, i + 2)
else:
    # max or min を足して全て正の数に直す
    print(2 * n - 2)
    if b[-1] > abs(b[0]):
        # add max
        for i in range(n - 1):
            print(idx[n - 1], i + 1)
        for i in range(n - 1):
            print(i + 1, i + 2)
    else:
        for i in range(n - 1):
            print(idx[0], i + 1)
        for i in range(n - 1):
            print(i + 1, i + 2)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b, idx = zip(*sorted(zip(a, range(1, n + 1))))
if b[-1] < 0:
    print(n - 1)
    # 全て負の数なので後ろから累積和をとる
    for i in range(n - 1):
        print(n - i, n - i - 1)
elif b[0] >= 0:
    print(n - 1)
    for i in range(n - 1):
        print(i + 1, i + 2)
else:
    # max or min を足して全て正の数に直す
    print(2 * n - 2)
    if b[-1] > abs(b[0]):
        # add max
        for i in range(n):
            if i + 1 != idx[-1]:
                print(idx[-1], i + 1)
        for i in range(n - 1):
            print(i + 1, i + 2)
    else:
        for i in range(n):
            if i + 1 != idx[0]:
                print(idx[0], i + 1)
        for i in range(n - 1):
            print(n - i, n - i - 1)
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
M = list(map(int, input().split()))

def exhastive_search(target, head, sum):
    for i in range(head, N):
        sum += A[i]
        print(sum)
        if target == sum:
            return True
        elif target > sum:
            if exhastive_search(target, i+1, sum):
                return True
            sum -= A[i]
        else:
            sum -= A[i]
    return False


for target in M:
    sum = 0
    result = "no"
    for i in range(N):
        if exhastive_search(target, i, sum):
            result = "yes"
            break
    print(result)


### FIXED CODE ###

N = int(input())
A = [input() for i in range(N)]

D = {}
for row in A:
    order, key = row.split()
    if order[0] == "i":
        D[key] = 1
    else:
        if key in D.keys():
            print("yes")
        else:
            print("no")
def solve():
    rec = list(range(1000000))
    odd_rec = rec.copy()
     
    for i in range(2, 181):
        t = i * (i + 1) * (i + 2) // 6
        if t % 2 == 0:
            for i, tpl in enumerate(zip(rec[t:], rec), start=t):
                a, b = tpl
                b += 1
                if b < a:
                    rec[i] = b
        else:
            z_rec = zip(rec[t:], rec, odd_rec[t:], odd_rec)
            for i, tpl in enumerate(z_rec, start=t):
                a, b, c, d = tpl
                b += 1
                if b < a:
                    rec[i] = b
                d += 1
                if d < c:
                    odd_rec[i] = d
     
    n = int(input())
    while n:
        print(rec[n], odd_rec[n])
        n = int(input())
 
solve()


### FIXED CODE ###

def solve():
    rec = [1000000] * 1000000
    rec[0] = 0
    odd_rec = rec.copy()
    
    for i in range(1, 181):
        t = i * (i + 1) * (i + 2) // 6
        for i, tpl in enumerate(zip(rec[t:t*3+1], rec), start=t):
            a, b = tpl
            b += 1
            if b < a:
                rec[i] = b
        if t % 2:
            for i, tpl in enumerate(zip(odd_rec[t:t*34+1], odd_rec), start=t):
                a, b = tpl
                b += 1
                if b < a:
                    odd_rec[i] = b
    
    import sys
    file_input = sys.stdin
    n = int(file_input.readline())
    while n:
        print(rec[n], odd_rec[n])
        n = int(file_input.readline())

solve()
a,b,c,d,e,f = [int(i) for i in input().split()]
print(a,b,c,d,e,f)

nod=0
for i in range(30+1):
  for j in range(30-i+1):
    for k in range(100+1):
      for l in range(100-k+1):
        if 0 < 100*(a*i+b*j)+c*k+d*l <= f and c*k+d*l <= e*(i+j):
          tmp=(c*k+d*l)/(100*(a*i+b*j)+c*k+d*l)
          if nod < tmp:
            nod=tmp
            ans1=100*(a*i+b*j)+c*k+d*l
            ans2=c*k+d*l
                        
print(ans1,ans2)

### FIXED CODE ###

a, b, c, d, e, f= (int(i) for i in input().split()) 

waterlist=[]
for i in range(0,f+100*a,100*a):
  for j in range(0,f+100*b,100*b):
    if i+j <=f:
      waterlist+=[i+j]
waterlist=list(set(waterlist))
#print(x)

sugarlist=[]
for i in range(int(f/c)+1):
  for j in range(int(f/d)+1):
    if c*i+d*j <=f:
      sugarlist+=[c*i+d*j]
sugarlist=list(set(sugarlist))
#print(y)

density=0

for i in range(len(waterlist)):
  for j in range(len(sugarlist)):
    if 0 < waterlist[i]+sugarlist[j] <= f and sugarlist[j]<=waterlist[i]/100*e:
      tmp=sugarlist[j]/(waterlist[i]+sugarlist[j])
      if density <= tmp:
        density = tmp
        ans1=waterlist[i]+sugarlist[j]
        ans2=sugarlist[j]
        
print(ans1,ans2)
a,b,c,d,e=[int(input()) for i in range(4)]
if i == 0:
    print(range(i))


### FIXED CODE ###

a=list(map(int,input().split()))
print(a.index(0)+1)
from math import gcd

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

# check
A.sort(reverse=True)
max_gcd = A[0]
change = False
for a in A:
    ans = gcd(max_gcd, a)
    if ans < max_gcd and change is False:
        change = True
        continue
    max_gcd = ans

print(max_gcd)


### FIXED CODE ###

from fractions import gcd


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

# 累積GCD
left = [0] * (n + 1)
right = [0] * (n + 1)
for i in range(n):
    left[i + 1] = (gcd(left[i], a[i]))
    right[n - i - 1] = (gcd(right[n - i], a[n - 1 - i]))

ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i + 1]))
print(ans)