Harryxun/stf_run huggingface dataset:
f = lambda x: 1 if (not x < 2 and not x&1 == 0) and (x == 2 or x == 3 or pow(2,x-1,x) == 1) else 0
print(count += f(int(input())) for _ in range(int(input())))


### FIXED CODE ###

f=lambda x: 1 if x == 2 or x == 3 or (x>3 and x&1==1 and pow(2, x-1, x)==1) else 0
print(sum(f(int(input())) for _ in range(int(input()))))
a, b = map(int, imput().split())
c = a * b
s = 'Even' if c % 2 == 0 else 'Odd'
print(s)


### FIXED CODE ###

a, b = map(int, input().split())
c = a * b
s = "Even" if c % 2 == 0 else "Odd"
print(s)
import sys

N,M = map(int,input().split())
SC=[]

ans=0

for i in range(M):
    S,C = map(int,input().split())
    SC.append((S,C))

if N==1:
    if SC[0][1]==0:
        print(0)
        sys.exit()

for i in range(M):
    for j in range(M):
        if SC[i][0]==SC[j][0]:
            if not SC[i][1]==SC[j][1]:
                print(-1)
                sys.exit()
    if SC[i][0]==1:
        if SC[i][1]==0:
            print(-1)
            sys.exit()
            
SC=tuple(set(SC))
l=len(SC)

for i in range(l):
    a=SC[i][0]
    b=SC[i][1]
    ans=ans+(10**(N-a))*b

print(ans)

### FIXED CODE ###

import sys

N,M = map(int,input().split())
SC=[]

ans=0

for i in range(M):
    S,C = map(int,input().split())
    SC.append((S,C))

for i in range(M):
    for j in range(M):
        if SC[i][0]==SC[j][0]:
            if not SC[i][1]==SC[j][1]:
                print(-1)
                sys.exit()
    if not N==1:
            if SC[i][0]==1:
                if SC[i][1]==0:
                    print(-1)
                    sys.exit()

if M==0:
    if N==1:
        print(0)
        sys.exit()
    else:
        print(10**(N-1))
        sys.exit()

            
SC=tuple(set(SC))
l=len(SC)

for i in range(l):
    a=SC[i][0]
    b=SC[i][1]
    ans=ans+(10**(N-a))*b
if not N==1:
    if ans<10**(N-1):
        ans=ans+10**(N-1)

print(ans)
s = input()
K = int(input())

ans = []
now = ""

for index, i in enumerate(s):
  now = i
  ans.append(i)

  for indexs, k in enumerate(s):
    if indexs <= index:
      continue

    if s[indexs] == now[-1]:
      break

    now += k
    ans.append(now)
    
ans = list(set(ans))
ans.sort()

print(ans[K-1])

### FIXED CODE ###

s = input()
K = int(input())

ans = []

for index, i in enumerate(s):
  ans.append(i)

  count = 1
  now = i
  for indexs, k in enumerate(s):
    if indexs <= index:
      continue
      
    if count >= 5:
      break

    now += k
    ans.append(now)
    count += 1

ans = list(set(ans))
ans.sort()
print(ans[K-1])
N,K=map(int,raw_input().split())
d={}
l=map(int,raw_input().split())
for i in l:
  if not i in d:
    d[i]=1
  else:
    d[i]+=1
c=0
e=sorted(d.items(),key=lambda x:x[1])[len(d.items())-K:]
for i in e:
  c+=i[1]
print(c)


### FIXED CODE ###

N,K=map(int,raw_input().split())
d={}
l=map(int,raw_input().split())
for i in l:
  if not i in d:
    d[i]=1
  else:
    d[i]+=1
c=0
e=sorted(d.items(),key=lambda x:x[1])[:len(d.items())-K]
for i in e:
  c+=i[1]
print(c)
n,m = [int(i) for i in input().split()]
e = [[int(i) for i in input().split()] for i in range(n)]
e.sort()
#print(n,m,e)
#e=dict(e)
#print(n,m,e,e[0][0]*m)

total=0
if m <= e[0][1]:
  total=e[0][0]*m
else:
  tmp=e[0][0]*e[0][1]
  m-=e[0][1]


#print(m)  
flag=0
for i in range(1,n):
  if 0 <= m <e[i][1] and flag==0:
    flag=1
    total=tmp+e[i][0]*m
  tmp+=e[i][0]*e[i][1]
  m-=e[i][1]

print(total)

### FIXED CODE ###

n,m = [int(i) for i in input().split()]
e = [[int(i) for i in input().split()] for i in range(n)]
e.sort()
#print(n,m,e)

total=0
for i in range(n):
    if m > 0:
      total+=e[i][0]*min(e[i][1],m)
    m-=e[i][1]
    
print(total)
N=int(input())
A=[0]*N
B=[0]*N
for i in range(N):
  a,b=map(int,input().split())
  A[i]=a
  B[i]=b

ans=0
for i in range(N-1,-1,-1):
  plus=0
  A[i]+=ans
  if B[i]==1:
    plus=0
  elif A[i]<B[i]:
    plus=B[i]%A[i]
  elif A[i]>B[i]:
    plus=B[i]-A[i]%B[i]
  ans+=plus
  
print(ans)

### FIXED CODE ###

n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
  x,y=map(int,input().split())
  a[i]=x
  b[i]=y

cur=0
for j in range(n-1,-1,-1):
  if (a[j]+cur)%b[j]!=0:
    cur+=b[j]-(a[j]+cur)%b[j]

print(cur)
import fractions
import collections
import copy

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

mod = 10**9+7

if n == 1:
    print(1)
    exit()

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

pri_li = []

for i in range(n):
    pri_li.append(collections.Counter(prime_factorize(ai[i])))

com_ab = [0]*(10**3)

for i in range(n):
    tmp = 1
    #print(len(b_li[i]))
    keys = pri_li[i].keys()
    #print(keys)
    for j in keys:
        com_ab[j] = max(com_ab[j],pri_li[i][j])

com_num = 1

for i in range(10**3):
    if com_ab[i] > 0:
        com_num *= pow(i,com_ab[i],mod)

ans = 0

for i in range(n):
    ans += com_num // ai[i]
    ans %= mod
print(ans)
exit()
    
pri_li0 = copy.copy(pri_li[0])

for i in range(n-1):
    pri_li[0] += pri_li[i+1]

b_li = [pri_li[0]-pri_li0]

for i in range(1,n):
    b_li.append(pri_li[0]-pri_li[i])

com = copy.copy(b_li[0])
#print(com)
for i in range(1,n):
    com &= b_li[i]
#print(com)
#exit()
for i in range(n):
    b_li[i] -= com

ans = 0
for i in range(n):
    tmp = 1
    #print(len(b_li[i]))
    keys = b_li[i].keys()
    #print(keys)
    for j in keys:
        #print(b_li[i][j])
        #exit()
        tmp *= pow(j, b_li[i][j],mod)
        tmp %= mod
    ans += tmp
    ans %= mod

print(ans%mod)


### FIXED CODE ###

import collections
import math
n = int(input())
ai = [int(i) for i in input().split()]

mod = 10**9+7

if n == 1:
    print(1)
    exit()
    
    
# 素因数分解、辞書で返すやつ
# mathをimportする
def prime(n):
    factor = {}
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            if not num in factor.keys():
                factor[num] = 1
            else:
                factor[num] += 1
        if num > n:
            break
    if n != 1:
        if not n in factor.keys():
            factor[n] = 1
        else:
            factor[n] += 1
    return factor


dic = {}
for a in ai:
    pr = prime(a)
    for num, count in pr.items():
        if not num in dic.keys():
            dic[num] = count
        else:
            if dic[num] < count:
                dic[num] = count

kari = 1
for num,count in dic.items():
    kari *= pow(num,count,mod)
    kari %= mod

kari_old = kari
ans = 0

for i in range(n):
    kari = kari_old
    #com_ab_new = copy.deepcopy(com_ab)
    #print(com_ab,com_ab_new)
    #kari = 1
    #for j in range(kosu):
    #kari *= pow(sosu_li[j][0],com_ab[sosu_li[j][0]],mod)
    kari *= pow(ai[i],mod-2,mod)
    ans += kari
    ans %= mod
    #print(ans)
    #print(ans)
        
print(ans)
from math import factorial

def conb2(a):
    if a == 1:
        return 0
    else:
        return int(factorial(a) / factorial(2) / factorial(a-2))


if __name__ == "__main__":
    M, N = list(map(int, input().split()))
    print(conb2(M)+conb2(N))

### FIXED CODE ###

from math import factorial

def conb2(a):
    if a == 1:
        return 0
    else:
        return int(a*(a-1)/2)


if __name__ == "__main__":
    M, N = list(map(int, input().split()))
    print(conb2(M)+conb2(N))
import numpy as np


### FIXED CODE ###

def m():
 e=input
 a=''
 for _ in[0]*int(e()):
  X,z=e(),[]
  for y in e():
   s=i=0
   for k in z:
    t=X.find(y,s)+1
    if t<1:break
    if t<k:z[i]=t
    s=k;i+=1
   else:
    t=X.find(y,s)+1
    if t:z+=[t]
  a+=f'\n{len(z)}'
 print(a[1:])
if'__main__'==__name__:m()
s = int(input())
an = []
an.append(s)
n = s
while an.count(1 or 2 or 4) != 2:
    if n % 2 == 0:
        n /= 2
        an.append(int(n))
    else:
        n = 3 * n + 1
        an.append(int(n))
print(an.index(4) + 4)



### FIXED CODE ###

x, y, z = map(int, input().split())
print(int(x * y / 2))
x,y,z,k = [int(num) for num in input().split()]
#入力して降順ソートしてｋ個分にスライス
a_cake,b_cake,c_cake = [sorted([int(num) for num in input().split()],reverse=True)[:k] for _ in range(3)]

#リストの最初の値(max値)との差分をリスト化
diff_list = list()
for cake in [a_cake,b_cake,c_cake]:
        diff_list.extend(list(map(lambda x:cake[0]-x,cake)))

diff_list.sort()
cake_max = a_cake[0]+b_cake[0]+c_cake[0]
for diff in diff_list[:k]:
    print(cake_max-diff)

    


### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e-a<=k:
    print("Yay!")
else:
    print(":(")
k = input()
x = input()

if k*500 < x:
    print("no")
else:
    print("yes")


### FIXED CODE ###

k,x=(int(x) for x in input().split())

if k*500 < x:
    print("No")
else:
    print("Yes")
ans = A1+A2+A3

if ans >= 22:
     print ("bust")

else:
     print ("win")

### FIXED CODE ###

A1,A2,A3=map(int,input().split())
ans =(A1+A2+A3)

if ans >= 22:
     print ("bust")
else:
     print ("win")
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N,T= map(int,input().split())

c=[]
t=[]

for _ in range(N):
	C,T=map(int,input().split())
	c.append(C)
	t.append(T)
	
for j in range(N):
	if t[j]>T:
		c[j]=1001

if min(c)=1001:
	print("TLE")

else:
	print(min(c))

### FIXED CODE ###

import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N,T= map(int,input().split())

c=[]
t=[]
m=10000
cnt=0
C=[list(map(int,input().split())) for _ in range(N)]

for j in range(N):
	if C[j][1]>T:
		cnt+=1
	else:
		m=min(C[j][0],m)
		

	

if cnt==N:
	print("TLE")
else:
	print(m)
import math

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



def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

### FIXED CODE ###

import math

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a_ = prime_factorize(a)
b_ = prime_factorize(b)

for i in a_:
    if i in b_:
        b_.remove(i)

for j in b_:
    a *= j

print(a)
n,m = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(n)]
lis.sort()
cnt = 0
mon = 0
i = 0
if n >= 2:
    while cnt < m:
        if lis[i][1] + cnt <= m:
            cnt += lis[i][1]
            mon += lis[i][0]*lis[i][1]
            i += 1
        else:
            break
    print(mon + (m-cnt) * lis[i][0])
else:
    print(m*lis[0][0])

### FIXED CODE ###

n,m = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(n)]
lis.sort()
cnt = 0
mon = 0
i = 0
if n >= 2:
    while cnt < m:
        if lis[i][1] + cnt < m:
            cnt += lis[i][1]
            mon += lis[i][0]*lis[i][1]
            i += 1
        else:
            break
    print(mon + (m-cnt) * lis[i][0])
else:
    print(m*lis[0][0])
import sys
input = sys.stdin.readline

n=input()

nn=0
for i in range(len(n)):
    nn+=int(n[i])

if nn%9==0:
    print("Yes")
else:
    print("No")
    

### FIXED CODE ###

n=input()

nn=0
for i in range(len(n)):
    nn+=int(n[i])

if nn%9==0:
    print("Yes")
else:
    print("No")
s = input()
t = input()

s_num = len(s)
t_num = len(t)

ans_list = []

if s_num<t_num:
    ans_list.append('UNRESTORABLE')
else:
    ind_list = []
    for i in range(s_num -t_num + 1):
        flg = True
        for j in range(t_num):
            if s[i+j] == '?':
                pass
            elif s[i+j]==t[j]:
                pass
            else:
                flg=False
                break
        if flg:
            ind_list.append(i)
if len(ind_list) ==0:
    ans_list.append('UNRESTORABLE')
else:
    for i in ind_list:
        ans = ''
        j=0
        while j <s_num:
            if j==i:
               ans = ans+t
               j = j + t_num
            elif s[j] == '?':
                ans = ans + 'a'
                j = j + 1
            else:
                ans = ans + s[j]
                j = j + 1
        ans_list.append(ans)

print(min(ans_list))

### FIXED CODE ###

s = input()
t = input()

s_num = len(s)
t_num = len(t)

ans_list = []
ind_list = []

if s_num<t_num:
    ans_list.append('UNRESTORABLE')
else:
    for i in range(s_num -t_num + 1):
        flg = True
        for j in range(t_num):
            if s[i+j] == '?':
                pass
            elif s[i+j]==t[j]:
                pass
            else:
                flg=False
                break
        if flg:
            ind_list.append(i)
if len(ind_list) ==0:
    ans_list.append('UNRESTORABLE')
else:
    for i in ind_list:
        ans = ''
        j=0
        while j <s_num:
            if j==i:
               ans = ans+t
               j = j + t_num
            elif s[j] == '?':
                ans = ans + 'a'
                j = j + 1
            else:
                ans = ans + s[j]
                j = j + 1
        ans_list.append(ans)

print(min(ans_list))
a, b, c = map (int, input().split())
if a < b < c:
	print("Yes")
else:
	print("No")
	

### FIXED CODE ###

a, b, c = map (int, input().split())
if a < b < c:
	print("Yes")
else:
	print("No")
n=input()

if int(n[-1]) in [2,4,5,7,9]:
    print('hon')
elif int(n[-1]) in [0,1,6,8]:
    print('pon')
else:
    print('bon')

### FIXED CODE ###

s = input()
t = input()

if s == t[:-1]:
    print('Yes')
else:
    print('No')
S, T = input().split()
 
n = len(S) - len(T) + 1
moji = len(T)
 
for a in range(n):
  count = 0 
  for b in range(len(T)):
    if S[a+b] != T[b]:
      count += 1
  if count < moji:
    moji = count
    
print(moji)

### FIXED CODE ###

x = [input() for i in range(2)]
S = x[0]
T = x[1]
moji = len(T)

for a in range(len(S) - len(T) + 1):
  count = 0
  for b in range(len(T)):
    
    if S[a+b] != T[b]:
      count += 1
  if count < moji:
    moji = count

print(moji)
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


T = input()

ans = list()
for i, c in enumerate(T):
    if c == '?':
        if i == len(T) - 1:
            ans.append('D')
        elif ans[-1] == 'D':
            ans.append('P')
        else:
            ans.append('D')
    else:
        ans.append(c)
print(''.join(ans))

### FIXED CODE ###

import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


T = input()

ans = list()
for i, c in enumerate(T):
    if c == '?':
        if len(ans) > 0 and ans[-1] == 'D' and i < len(T) - 1 and T[i + 1] in '?D':
            ans.append('P')
        else:
            ans.append('D')
    else:
        ans.append(c)
print(''.join(ans))
N, M = map(int, input().split())
X = [0] * M
Y = [0] * M
Z = [0] * M 
for i in range(M):
  X[i], Y[i], Z[i] = map(int, input().split())

G = [[] for _ in range(N)]

for i in range(M) :
    G[Y[i]-1].append(X[i])
    G[X[i]-1].append(Y[i])

c = [False for _ in range(N)]
 
def DFS(G,s):
    c[s-1] = True
    for i in G[s-1]:
        if not c[i-1]:         
            DFS(G,i)
ans = 0
for i in range(N):
    if not c[i]:
        DFS(G,i+1)
        ans += 1

print(ans)


### FIXED CODE ###

l = list(map(int,input().split()))
N = l[0]
K = l[1] 
S = input()
list_S = list(S)
if list_S[K-1] == 'A':
    list_S[K-1] = 'a'
elif list_S[K-1] == 'B':
    list_S[K-1] = 'b'
if list_S[K-1] == 'C':
    list_S[K-1] = 'c'
L = ''.join(list_S)
print(L)
K, A, B = map(int, input().split())
bis = 0
C = int(B/A)
D = int(K/A)
if C >= 2 and K>A:
  if K >= A*D+D:
    K -= A*D+D
    print(K+B*D)
  else:
    K -= A*(D-1)+D-1
    print(K+B*(D-1))
else:
  print(K+1)

### FIXED CODE ###

N, K = map(int, input().split())
if (N+1)/K >= 2:
  print("YES")
else:
  print("NO")
A, B, C = map(int, input().split())
if A == B:
    print(C)
elif B == C:
    print(A)
else:
    print(B)

### FIXED CODE ###

N = input()

if (N[0] == N[1] and N[1] == N[2]) or (N[1] == N[2] and N[1] == N[3]):
    print('Yes')
else:
    print('No')
import math
n = int(input())
a = sorted(list(map(int,input().split())))[::-1]
ans = 0
conb = [0]*a[0]
conb[0] = a[0]
for j in range(1,a[0]):
    conb[j] = conb[j-1]*(a[0]-j)

for i in range(1,n):
    b = conb[a[i]-1] / math.factorial(a[i])
    if b >= ans:
        ans1 = a[i]
        ans = b
print(a[0],ans1)

### FIXED CODE ###

import math
n = int(input())
a = sorted(list(map(int,input().split())))
b = (a[-1]+1)//2
d = float("inf")
for i in a:
    if abs(b-i) < d:
        d = abs(b-i)
        ans = i
print(a[-1],ans)
import sys
h,w=map(int,input().split())
dr=[input()+'.' for _ in range(h)]
dr.append('.'*h)

print(dr)

if h==1 and w==1:
  print('Yes')
  sys.exit()

if dr[0][0]=='#':
  if dr[1][0]!='#' and dr[0][1]!='#':
    print('No')
    sys.exit()
for j in range(1,w-1):
  if dr[0][j]=='#':
    if dr[0][j+1]!='#' and dr[1][j]!='#' and dr[0][j-1]!='#':
      print('No')
      sys.exit()
if dr[0][w-1]=='#':
  if dr[1][w-1]!='#' and dr[0][w-2]!='#':
    print('No')
    sys.exit()
for i in range(1,h-2):
  if dr[i][0]=='#':
    if dr[i+1][0]!='#' and dr[i][1]!='#' and dr[i-1][0]!='#':
      print('No')
      sys.exit()
  for i in range(1,w-1):
    if dr[i][j]=='#':
      if dr[i][j+1]!='#' and dr[i+1][j]!='#' and dr[i-1][j]!='#' and dr[i][j-1]!='#':
        print('No')
        sys.exit()
  if dr[i][w-1]=='#':
    if dr[i+1][w-1]!='#' and dr[i-1][w-1]!='#' and dr[i][w-2]!='#':
      print('N0')
      sys.exit()
if dr[h-1][0]=='#':
  if dr[h-1][1]!='#' and dr[h-2][0]!='#':
    print('N0')
    sys.exit()
for j in range(1,w-1):
  if dr[h-1][j]=='#':
    if dr[h-1][j+1]!='#' and dr[h-1][j-1]!='#' and dr[h-2][j]!='#':
      print('No')
      sys.exit()
if dr[h-1][w-1]=='#':
  if dr[h-1][w-2]!='#' and dr[h-2][w-1]!='#':
    print('N0')
    sys.exit()
print('Yes')

### FIXED CODE ###

h,w=map(int,input().split())
a=['.'*(w+2)]+['.'+input()+'.' for _ in range(h)]+['.'*(w+2)]
for i in range(h):
  for j in range(w):
    if a[i][j]=='#':
      if not(a[i+1][j]=='#' or a[i-1][j]=='#' or a[i][j+1]=='#' or a[i][j-1]=='#'):
        print('No')
        exit()
print('Yes')
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
dp=[10**9]*n
dp[0]=0
dp[1]=abs(a[1]-a[0])
for i in range(2,n):
    for j in range(max(0,i-k),i):
        dp[i]=min(dp[j]+abs(a[i]-a[j]),dp[i])
print(dp[-1])


### FIXED CODE ###

n=int(input())
h=[int(i) for i in input().split()]
dp=[0]*n
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[-1])
def solveZ(X, Y, Z, x, y):
	if x < len(X) and y < len(Y):
		ans = [solveZ(X, Y, Z, x, y+1)]
		Z.append(Y[y])
		for j in range(x, len(X)):
			if Y[y] == X[j]:
				ans.append(solveZ(X, Y, Z, j+1, y+1))
		return max(ans)
	else:
		return len(Z)

q = int(input())
for i in range(q):
	X = input()
	Y = input()
	ans[i] = solveZ(X, Y, [], 0, 0)

for i in range(q):
	print(ans[i])

### FIXED CODE ###

def solve_L():
    X = input()
    Y = input()
  
    a = len(X)
    b = len(Y)
    c1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = X[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == Y[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
  
n = int(input())
ans = [[] for i in range(n)]
for i in range(n):
    ans[i] = solve_L()
for i in range(n):
  print(ans[i])
import math

def main():
    x, y = map(int, input().split())
    print(x*y // math.gcd(x,y))

if __name__ == '__main__':
    main()

### FIXED CODE ###

import fractions as math

def main():
    x, y = map(int, input().split())
    print(x*y // math.gcd(x,y))

if __name__ == '__main__':
    main()
import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
N = li()
A = list(li())

def gcd(A, B):
    if B == 1 or A == 1:
        return 1
    if A > B:
        return gcd(B, A - B)
    elif A < B:
        return gcd(A, B - A)
    else:
        return A

A.sort()
res = A[0]
for a in A:
    res = gcd(a, res)
    if res == 1:
        break
print(res)


### FIXED CODE ###

import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
N = li()
A = list(li())

def gcd(A, B):

    # normal gcd logic
    while B not in (1, 0):
        A, B = (A, B) if A > B else (B, A)
        _, mod = divmod(A, B)
        A, B = B, mod
    if B == 0:
        return A
    elif B == 1:
        return 1

A = list(filter(lambda x:x>0, A))
A.sort()
if len(A) == 0:
    print(0)
else:
    res = A[0]
    for a in A:
        res = gcd(a, res)
        if res == 1:
            break

    print(res)
W, H, x, y = map(float, input().split())
jufuku = 0
if W % x == 0 and H % y == 0:
    kiri = W * H / 2
    jufuku = 1
else:
    # 縦
    tate = min((W - x) * H, x * H)
    # 横
    yoko = min(W * (H - y), W * y)
    if tate == yoko:
        jufuku = 1
    else:
        kiri = max(tate, yoko)
print(kiri, jufuku)

### FIXED CODE ###

W, H, x, y = map(int, input().split())
jufuku = 0
if W / 2 == x and H / 2 == y:
    jufuku = 1
print(W * H / 2, jufuku)
N = int(input())
num = list(map(int, input().split()))
count = 0
for i in range(N):
  n = int(num[i])
  if n == min(num[:i]):
    count += 1
print(count)    

### FIXED CODE ###

N = int(input())
num = list(map(int, input().split()))
count = 0
min_num = num[0]
for i in range(N):
  n = num[i]
  if n <= min_num:
    count += 1
    min_num = n
    
print(count)
n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [add2, add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])

print(list)

name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort(key=int, reverse=True)
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort(key=int, reverse=True)
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1


### FIXED CODE ###

n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [int(add2), add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])


name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort()
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort()
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1
a, b = int(input()).split()

print(a*b)

### FIXED CODE ###

a, b = input().split()

print(int(a)*int(b))
import sys
 
H,W,M = list(map(int, input().split()))

hw = [[0] * (W+1) for _ in range(H+1)]
 
w = [0] * (W+1)
h = [0] * (H+1)
mxw = []
mxw_v = 0
mxh = []
mxh_v = 0
 
 
for i in range(M):
    h_i, w_j = list(map(int, input().split()))
    hw[h_i][w_j] = 1
    h[h_i] += 1
    w[w_j] += 1
    if mxw_v < w[w_j]:
        mxw_v = w[w_j]
        mxw = [w_j]
    elif mxw_v == w[w_j]:
        mxw.append(w_j)
 
    if mxh_v < h[h_i]:
        mxh_v = h[h_i]
        mxh = [h_i]
    elif mxh_v == h[h_i]:
        mxh.append(h_i)
a = 0
d = 0
for i in mxh:
    for j in mxw:
        d = hw[i][j]
        a = max(a, mxh_v + mxw_v - d)
    if d == 0:
        break
print(a)

### FIXED CODE ###

H,W,M = list(map(int, input().split()))

hw = set()
w = [0] * 3*10**5
h = [0] * 3*10**5

for i in range(M):
    h_i, w_j = map(int, input().split())
    hw.add((h_i-1) + (w_j-1)*3*10**6)
    h[h_i-1] += 1
    w[w_j-1] += 1

a = 0
d = 1
mxh_v = max(h)
mxw_v = max(w)

x = [i for i,j in enumerate(h) if j == mxh_v]
y = [i for i,j in enumerate(w) if j == mxw_v]

for i in x:
    for j in y:
        if not(i + j*3*10**6 in hw):
            print(mxh_v+mxw_v)
            exit()
print(mxh_v+mxw_v-d)