Harryxun/stf_run huggingface dataset:
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    flag = 0
    for i in range(n):
        a = int(intput())
        flag &= (a%2 == 1)
    if flag:
        print('first')
    else:
        print('second')

    




                
if __name__ == '__main__':
    main()

### FIXED CODE ###


        
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    flag = 0
    for i in range(n):
        a = int(input())
        if a%2 == 1:
            print('first')
            return
    print('second')


    




                
if __name__ == '__main__':
    main()
in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur +1 == len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1

print(len(in_s) - len(lst))

### FIXED CODE ###

in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur+1 >= len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1
 
print(len(in_s) - len(lst))
a,b,c,d=map(str, input().split())
print(a*b*int(a*b>=c*d)+c*d*int(a*b<c*d))

### FIXED CODE ###

a,b,c,d=map(int, input().split())
print(a*b*int(a*b>=c*d)+c*d*int(a*b<c*d))
def cake(s1,s2,s3):
    ans1 = sorted(i+j for i in s1 for j in s2)
    ans2 = sorted(i+j for i in ans1 for j in s3)
    return ans2    
    
a,b,c,d = map(int, input().split())

s1=list(map(int, input().split()))
s2=list(map(int, input().split()))
s3=list(map(int, input().split()))

ans1 = sorted(i+j for i in s1 for j in s2)
ans2 = sorted(i+j for i in ans1 for j in s3)
res = sorted(ans2,reverse=True)
print(*res[:k+1], sep="\n")

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
x, y, z, k = map(int, input().split())
a = sorted(int(i) for i in input().split())
b = sorted(int(i) for i in input().split())
c = sorted(int(i) for i in input().split())
 
#a.sort(reverse=True)
#b.sort(reverse=True)
#c.sort(reverse=True)
 
ab = sorted(i+j for i in a for j in b)[:-k-1:-1]
abc = sorted(i+j for i in ab for j in c)[:-k-1:-1]
 
print(*abc[:k], sep="\n")
def ask(n):
    print(n, flush=True)
    resp = input().rstrip()[0]
    if resp == 'V':
        exit()
    return resp

resp = ask(0)

def condition(L,R,resp_L,resp_R):
    if (R-L)&1:
        return resp_L == resp_R
    else:
        return resp_L != resp_R

L = 0
R = N
resp_L = resp
resp_R = resp
for _ in range(19):
    M = (L + R) // 2
    resp_M = ask(M)
    if condition(L,M,resp_L,resp_M):
        R,resp_R = M,resp_M
    else:
        L,resp_L = M,resp_M

### FIXED CODE ###

x,y = map(int,input().split())
answer = x if x%y else -1
print(answer)
S = input()
for i in len(S):
  print(x, end="")

### FIXED CODE ###

S = input()
for i in range(len(S)):
  print('x', end="")
x, y, a, b, c = list(map(int, input().split(' ')))
pa = list(map(int, input().split(' ')))
qb = list(map(int, input().split(' ')))
rc = list(map(int, input().split(' ')))

pa = sorted(pa)[len(pa) - x:]
qb = sorted(qb)[len(qb) - y:]
rc = sorted(rc, reverse=True)

ai = 0
bi = 0
result = sum(pa) + sum(qb)

for r in rc:
    if bi >= b and ai >= a:
        break
    
    if bi >= b or pa[ai] <= qb[bi]:
        if r > pa[ai]:
            result = result - pa[ai] + r
            ai += 1
    elif ai >= a or pa[ai] >= qb[bi]:
        if r > qb[bi]:
            result = result - qb[bi] + r
            bi += 1
print(result)



### FIXED CODE ###



x, y, a, b, c = list(map(int, input().split(' ')))
pa = list(map(int, input().split(' ')))
qb = list(map(int, input().split(' ')))
rc = list(map(int, input().split(' ')))

pa = sorted(pa)[len(pa) - x:]
qb = sorted(qb)[len(qb) - y:]
rc = sorted(rc, reverse=True)

ai = 0
bi = 0
result = sum(pa) + sum(qb)

for r in rc:
    if bi >= len(qb) and ai >= len(pa):
        break
    
    elif bi >= len(qb) or pa[ai] <= qb[bi]:
        if r > pa[ai]:
            result = result - pa[ai] + r
            ai += 1
            
    elif ai >= len(pa) or pa[ai] >= qb[bi]:
        if r > qb[bi]:
            result = result - qb[bi] + r
            bi += 1
print(result)
a = int(input("a:"))
b = int(input("b:"))

AB = a*b
if AB%2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

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

if (a*b)%2 == 0:
    print("Even")
else:
    print("Odd")
np=[]
mp=[]
for i in xrange(0, n):
  np.append(raw_input())
for i in xrange(0, m):
  mp.append(raw_input())

for i in xrange(0,n-m):
  for j in xrange(0, n-m):
    flag = True
    for l in xrange(0, m):
      for m in xrange(0, n):
        if mp[l][m] != np[i][j]:
          flag = False
          break
      if !flag:
        break

if flag:
  print "Yes"
else:
  print "No"

### FIXED CODE ###

n,m = map(int, raw_input().split())
np=[]
mp=[]
for i in xrange(0, n):
  np.append(raw_input())
for i in xrange(0, m):
  mp.append(raw_input())
 
for i in xrange(0,n-m+1):
  for j in xrange(0, n-m+1):
    flag = True
    for x in xrange(0, m):
      for y in xrange(0, m):
        if mp[x][y] != np[i+x][j+y]:
          flag = False
          break
      if flag == False:
        break
    if flag:
      print "Yes"
      break
  if flag: break
if flag==False: print "No"
n, m = map(int, input().split())
a = [0] * m
dp = [1, 1]

for i in range(m):
    a[i] = int(input())

for i in range(len(a)-1):
    if a[i+1] - a[i] == 1:
        print(0)
        exit(0)

x = 0
for i in range(1, n+1):
    if i != a[x]:
        dp.append((dp[-1] + dp[-2]) % 1000000007)
    else:
        dp.append(0)
        if x < len(a)-1:
            x += 1
# print(dp)
print(dp[-1])


### FIXED CODE ###

n, m = map(int, input().split())
a = [0] * 100100
dp = [1, 1]
x = 0
for i in range(m):
    a[i] = int(input())
if a[0] == 1:
    dp[1] = 0
    x = 1

for i in range(len(a)-1):
    if a[i+1] - a[i] == 1:
        print(0)
        exit(0)


for i in range(2, n+1):
    if i != a[x]:
        dp.append((dp[-1] + dp[-2]) % 1000000007)
    else:
        dp.append(0)
        if x < len(a)-1:
            x += 1
# print(dp)
print(dp[-1])
import sys
N = int(input())
A = [[(int(x),True) for x in input().split()] for _ in range(N)]

ans = 0
for k in range(N):
    for i in range(N):
        if i == k: continue
        for j in range(i+1,N):
            if j == k: continue
            Aikj = A[i][k][0] + A[k][j][0]
            if A[i][j][0] > Aikj:
                ans = -1
            if A[i][j][0] == Aikj:
                A[i][j][1] = False

if ans != -1:
    for i in range(N):
        for j in range(i+1,N):
            if A[i][j][1]:
                ans += A[i][j][0]
print(ans)

### FIXED CODE ###

def main():
    inf=float("inf")
    n=int(input())
    alst=[list(map(int,input().split())) for _ in range(n)]
 
    for i in range(n):
        alst[i][i]=inf
 
    sm=0
    token=0
 
    for i in range(n):
        for j in range(i+1,n):
            for k in range(n):
                if alst[i][k]+alst[k][j]>alst[i][j]:
                    continue
                elif alst[i][k]+alst[k][j]==alst[i][j]:
                    break
                else:
                    token=1
                    break
            else :
                sm+=alst[i][j]
    
    if token : sm=-1
 
    print(sm)
 
main()
# 当初理解が及ばずできなかったが、後日リベンジできた！
# B問題とは思えない！

def dis(d, x, y): #d次元、2点間の距離の関数
    a = 0
    for i in range(d):
        a += (x[i] - y[i])**2
    return a**0.5
    
n, d = map(int,input().split())

l=[] # n個の座標を2次元リストで取得
for j in range(n):
    b,c=[int(j) for j in input().split()]
    l.append([b,c])

z = []
for e in range(n):
    for f in range(e,n): #重複（逆の組み合わせ）無し
        g = dis(d, l[e], l[f]) #各座標間の距離を関数で取得
        if g == int(g) and g != 0: #距離が整数かつゼロでないか確認
            z.append(g) # 上の条件をpassした値をリスト'z'へappend
            
print(len(z))


### FIXED CODE ###

def dis(d, x, y):
    a = 0
    for i in range(d):
        a += (x[i] - y[i])**2
    return a**0.5
    
n, d = map(int,input().split())
#print(n,d)

l = []
for j in range(n):
    l.append(input().split())

c=[]
for j in l:
    b=[]
    for k in j:
        b.append(int(k))
    c.append(b)
#print(c)

z = []
for e in range(n):
    for f in range(e,n):
        g = dis(d, c[e], c[f])
        if g == int(g) and g != 0:
            z.append(g)
print(len(z))
import math
 
a,b,c = map(int,input().split())

if(a*a + b*b + c*c > 2*(a*b + a*c + b*c && c-(a+b) > 0)):
  print('Yes')
else:
  print('No')

print(a*a + b*b + c*c)
print(2*(a*b + a*c + b*c))

### FIXED CODE ###

import math
 
a,b,c = map(int,input().split())
 
if( a*a + b*b + c*c > 2*(a*b + a*c + b*c) and c-(a+b) > 0 ):
  print('Yes')
else:
  print('No')
N = int(input())
if N % 111 == 0:
  print(N)
for i in range(10):
  if N // 111 = i:
    print(111 * (i + 1) )

### FIXED CODE ###

N = int(input())
if N % 111 == 0:
  print(N)
for i in range(10):
  if N % 111 != 0 and N // 111 == i:
    print(111 * (i + 1) )
N,M = map(int,input().split())
values = []
for i in range(N):
    values.append([])
for i in range(M):
    s,c = map(int,input().split())
    values[s-1].append(c)
for i in range(3):
    if values[i] == list():
        values[i].append(0)
for i in range(1000):
    i = [int(j) for j in list(str(i))]
    if len(i) != N:
        continue
    if N==3:
        if i[0] in values[0] and i[1] in values[1] and i[2] in values[2]:
            print("".join([str(j) for j in i]))
            exit()
    elif N==2:
        if i[0] in values[0] and i[1] in values[1]:
            print("".join([str(j) for j in i]))
            exit()
    else:
        if i[0] in values[0]:
            print("".join([str(j) for j in i]))
            exit()
print(-1)



### FIXED CODE ###

N,M = map(int,input().split())
values = []
for i in range(N):
    values.append([])
for i in range(M):
    s,c = map(int,input().split())
    values[s-1].append(c)

#同じ桁に2つ以上候補があるなら-1
for i in values:
    if len(set(i)) >= 2:
        print(-1)
        exit()

#最上位桁に候補がないときは1を補う
if values[0] == list():
    if N != 1:
        values[0].append(1)

#候補がない桁は0を補う
for i in range(N):
    if len(values[i]) == 0:
        values[i].append(0)

#探索
for i in range(1000):
    i = [int(j) for j in list(str(i))]
    if len(i) != N:
        continue
    if N==3:
        if i[0] in values[0] and i[1] in values[1] and i[2] in values[2]:
            print("".join([str(j) for j in i]))
            exit()
    elif N==2:
        if i[0] in values[0] and i[1] in values[1]:
            print("".join([str(j) for j in i]))
            exit()
    else:
        if i[0] in values[0]:
            print("".join([str(j) for j in i]))
            exit()
print(-1)
def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt
    else :
        cnt += 1
        ans += a[cnt][1]
    return list_pos(cnt,a,b,ans)

N,K = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(N)]


p = list_pos(-1,para,K,0)
print("{}".format(para[p][0]))

### FIXED CODE ###


def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt-1
    else :

        ans += a[cnt][1]
        cnt += 1
        return list_pos(cnt,a,b,ans)
import sys
sys.setrecursionlimit(100000)
N,K = map(int,input().split())
para = {}
for i in range(N):
    a,b  = map(int,input().split())
    if not a in para.keys():
        para[a] = b
    else : para[a] += b

para = sorted(para.items(),key =lambda x:x[0])

p = list_pos(0,para,K,0)
print("{}".format(para[p][0]))
A = list(map(int, input().split()))
S = A[1]
S += (A[0] // 2) * 2
T = S
  if A[4] > 0 and A[5] > 0 and A[0] % 2 == 1:
    S += (A[4] // 2) * 2 + (A[5] // 2) * 2
    A[4] -= 1
    A[5] -= 1
    T += 3
  T += (A[4] // 2) * 2 + (A[5] // 2) * 2
print(max(S, T))


### FIXED CODE ###

A = list(map(int, input().split()))
S = A[1]
S += (A[0] // 2) * 2 + (A[3] // 2) * 2 + (A[4] // 2) * 2
if A[3] % 2 == 1 and A[4] % 2 == 1 and A[0] % 2 == 1:
  S += 3
elif A[3] % 2 == 1 and A[4] % 2 == 1 and A[0] % 2 == 0 and A[0] != 0:
  S += 1
elif A[3] % 2 == 0 and A[4] % 2 == 1 and A[0] % 2 == 1 and A[3] != 0:
  S += 1
elif A[3] % 2 == 1 and A[4] % 2 == 0 and A[0] % 2 == 1 and A[4] != 0:
  S += 1
print(S)
A,B = map(input().split(" "))
if A <= 9 and B <= 9:
  print(A*B)
else:
  print(-1)


### FIXED CODE ###

A,B = map(int, input().split(" "))
if A <= 9 and B <= 9:
  print(A*B)
else:
  print(-1)
a = list(map(int, input().split()))
res = 0
for i in range(len(a)):
  	if a[i] == i:
      	res = i + 1
print(res)

### FIXED CODE ###

a = list(map(int, input().split()))
res = 0
for i in range(len(a)):
    if a[i] == 0:
        res = i + 1
        break
print(res)
n, k = [ int(v) for v in input().split() ]
s = list(map(int,list(input())))
binary_list = [0]
b = 0
for i in range(n):
	if s[i] == 1:
		b += 1
	else:
		b -= 1
	if i < n-1 and s[i] != s[i+1]:
		binary_list.append(b)
		b = 0
binary_list.append(b)
binary_list.append(0)

k = 2 * k + 1
ans = 0
for i in range(len(binary_list)-k+1):
	sumpart = collect(binary_list[i:i+k])
	ans = max(ans,sumpart)

print(ans)


### FIXED CODE ###

n, k = [ int(v) for v in input().split() ]
s = input()

a_list = []
b_list = []

if s[0] == "0":
    a_list.append(0)
p = 0
for i in s:
    if i == "1" and p < 0:
        b_list.append(-p)
        p = 1
    elif  i == "1" and p >= 0:
        p += 1
    elif  i == "0" and p > 0:
        a_list.append(p)
        p = -1
    elif  i == "0" and p <= 0:
        p -= 1
if p < 0:
    b_list.append(-p)
    a_list.append(0)
else:
    a_list.append(p)


if len(b_list) <= k:
    ans = n
else:
    m = len(b_list) - k
    sequence = sum(a_list[:k+1]) + sum(b_list[:k])
    ans = sequence
    for i in range(m):
        sequence += a_list[i+k+1] - a_list[i]
        sequence += b_list[i+k] - b_list[i]
        ans = max(sequence, ans)
print(ans)
n = int(input())
for i in range(n):
  S[i]=input()

ac =0
wa =0
tle =0
re =0


for i in range(n):
  if S[i]=='AC':
    ac +=1
  elif S[i]=='WA':
    wa +=1
  elif S[i]=='TLE':
    tle +=1
  elif S[i]=='RE':
    re +=1

print('AC x ',ac)
print('WA x ',wa)
print('TLE x ',tle)
print('RE x ',re)

### FIXED CODE ###

n = int(input())
S=[0]*n
for i in range(n):
  S[i]=input()

ac =0
wa =0
tle =0
re =0


for i in range(n):
  if S[i]=='AC':
    ac +=1
  elif S[i]=='WA':
    wa +=1
  elif S[i]=='TLE':
    tle +=1
  elif S[i]=='RE':
    re +=1

print('AC x ',ac)
print('WA x ',wa)
print('TLE x ',tle)
print('RE x ',re)
n,a,b=map(int,input().split())
s = ('b' * a + 'r' * b) * n
print(s[0:n].count('b'))

### FIXED CODE ###

n,a,b=map(int,input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans+=min(a,rem)
print(ans)
import math
r=int(input())
print('{} {}'.format(r*r*math.pi, 2*r*math.pi))

### FIXED CODE ###

import math
r=float(input())
print('{} {}'.format(r*r*math.pi, 2*r*math.pi))
N,M =map(int,input().split())
if M>0:
    a = [0]*M
    for i in range(M):
        a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0] = a[0]-1
if M!=0:
    A[M] = N - a[M-1]-1
for i in range(M-1):
    A[i+1] = a[i+1] - a[i]- 2
    if A[i+1]==-1:
        ans = 0


SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
if N>2:
    for i in range(N - 2):
        SA[i + 2] = SA[i + 1] + SA[i]
        SA[i + 2] = SA[i + 2] % 1000000007

for i in range(M+1):
    if A[i]>=0:
        ans *= SA[A[i]]
        ans = ans%1000000007


print(ans)


### FIXED CODE ###

def examC():
    N, M = LI()
    A = [I() for _ in range(M)]
    A.append(N+1)
    fib = [1]*(N+2)
    for i in range(1,N):
        fib[i+2] = fib[i+1] + fib[i]
    fib[0] = 0
#    print(fib)
    ans = fib[A[0]]%mod
    for i in range(M):
        ans *= fib[A[i+1]-A[i]-1]
        ans %=mod
    print(ans)
    return

def examD():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examC()
a,b,c,d = map(int, input().split())
if b <= c or d <= a:
    print(0)
else:
    if
    print(min(b,d)-max(a,c))

### FIXED CODE ###

a,b,c,d = map(int, input().split())
if b <= c or d <= a:
    print(0)
else:
    print(min(b,d)-max(a,c))
X,A=map(int, input().split())
if X<A:
  print(0)
 else:
  print(10)

### FIXED CODE ###

X,A=map(int, input().split())
if X<A:
  print(0)
else:
  print(10)
H = int(input())
A = []
A.append((A, 1))
ans = 0
while len(A) > 0:
  h, c = A[0]
  A.pop(0)
  ans += c
  A.append((h//2, c*2))
print(ans)

### FIXED CODE ###

H = int(input())
A = []
A.append((H, 1))
ans = 0
while len(A) > 0:
    h, c = A[0]
    A.pop(0)
    ans += c
    if h != 1:
        A.append((h//2, c*2))
print(ans)
n = 50001
c = [1 for i in range(n)]
c[0] = 0
i = 2
while i**2 <= n:
    j = i*2
    while j <= n:
        c[j - 1] = 0
        j += i
    i += 1

while True:
    n = int(input())
    if n == 0:
        break
    elif n%2 == 1:
        print(0)
        continue
    cnt = 0
    for i in range(n/2):
        if c[i] == 1 and c[n-i] == 1:
            cnt +=1
    print(cnt)



### FIXED CODE ###

n = 50001
is_prime = [i for i in range(n)]
is_prime[0] = is_prime[1] = 0
i = 2
while i**2 <= n:
    j = i*2
    while j < n:
        is_prime[j] = 0
        j += i
    i += 1

prime_set  = set(is_prime)
prime_set.remove(0)
prime_list = sorted(list(prime_set))

while True:
    cnt = 0
    n = int(input())
    if n == 0:
        break
    for i in prime_list:
        if i > n//2:
            break
        if n - i in prime_set:
            cnt += 1
    print(cnt)
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline

    def gcd(a, b):
        if b == 0:
            return a
        return gcd(b, a % b)
    
    N, M = [int(x) for x in input().strip().split()]
    S = input().strip()
    T = input().strip()
    L = (N * M) // gcd(N, M)
    ans = ['0'] * L
    for n in range(N):
        ans[L//N*n] = S[n]
    for m in range(M):
        if ans[(L//M)*m] == '0':
            ans[(L//M)*m] = T[m]
        elif ans[(L//M)*m] == T[m]:
            continue
        else:
            print('-1')
            return
    print(L)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    from collections import defaultdict
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline

    def gcd(a, b):
        if b == 0:
            return a
        return gcd(b, a % b)
    
    N, M = [int(x) for x in input().strip().split()]
    S = input().strip()
    T = input().strip()
    L = (N * M) // gcd(N, M)
    d = defaultdict(int)
    for n in range(N):
        d[L//N*n] = S[n]
    for m in range(M):
        if d[L//M*m] == 0 or d[L//M*m] == T[m]:
            continue
        else:
            print(-1)
            return
    print(L)

if __name__ == '__main__':
    main()
N = int(input())

ans = 0

now = 1

while now ** 2 <= N:

    if N % now == 0 and N // (N // now - 1) == N % (N // now - 1):

        ans += N // now - 1

    now += 1

print (ans)


### FIXED CODE ###

N = int(input())

ans = 0

now = 1

while now ** 2 <= N:

    if N % now == 0 and (N // now - 1) > 0 and N // (N // now - 1) == N % (N // now - 1):

        ans += N // now - 1

    now += 1

print (ans)
import math
n, p = map(int ,input().split())
#引数　n, 返り値nまでの素数をリストで返す
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    #根号
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
ff = primes(int(math.sqrt(p) + 1))
ans = 1
factorized = dict(zip(ff, [0 for i in range(len(ff))]))
div = 2
if n == 1:
    print(1)
    exit()
while p != 1:
    while p % div == 0:
        p /= div
        factorized[div] += 1
    div += 1
for i in factorized.keys():
    if factorized[i] >= n :
        ans *= i*(factorized[i] // n)
print(ans)


### FIXED CODE ###

import math
n, p = map(int ,input().split())
#引数　n, 返り値nまでの素数をリストで返す
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    #根号
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
ff = primes(int(math.sqrt(p) + 1))
ans = 1
factorized = dict(zip(ff, [0 for i in range(len(ff))]))
if n == 1:
    print(p)
    exit()
for i in factorized.keys():
    while p % i == 0:
        p /= i
        factorized[i] += 1
    
for i in factorized.keys():
    if factorized[i] >= n :
        ans *= i**(factorized[i] // n)
print(ans)
import collections

n = int(raw_input())
p = map(int,raw_input().split(' '))
q = map(int,raw_input().split(' '))

factorial = {}
factorial[0] = 1
for i in range(9):
	cumul *= i
	factorial[i] = cumul


def f(p):
	if len(p) == 1: return 0
	sp = sorted(p)
	for i,e in enumerate(sp):
		if e == p[0]:
			hm = i
			break 

	return i * factorial[len(p) -1] + f(p[1:])


print abs(f(p) - f(q))

### FIXED CODE ###

import collections

n = int(raw_input())
p = map(int,raw_input().split(' '))
q = map(int,raw_input().split(' '))

def factorial(n): return (n * factorial(n-1)) if n>0 else 1


def f(p,n):

	if len(p) == 1:
		return 0
	sp = sorted(p)
	for i,e in enumerate(sp):
		if e == p[0]:
			hm = i
			break 

	return i * factorial(len(p) -1) + f(p[1:],n)


print abs(f(p,n) - f(q,n))
s = input()
ans = []
cnt = 0
for i in range(len(s)):
    if s[i] == "R":
        cnt += 1
    else: 
        ans.append(cnt)
        cnt = 0
print(max(ans))

### FIXED CODE ###

s = input()
ans = 0
if "RRR" in s:
    ans = 3
elif "RR" in s:
    ans = 2
elif "R" in s:
    ans = 1
print(ans)
def main():
    l, r = list(map(int, input().split(" ")))

    m = 3000
    for i in range(l, r):
        for j in range(i+1, r+1):
            r = (i*j) % 2019
            if r == 0:
                print(0)
                return
            else:
                m = min(m, r)
    print(m)


main()


### FIXED CODE ###


def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))

    sorted_a = sorted(a, reverse=True)
    one = sorted_a[0]
    two = sorted_a[1]

    for i in range(n):
        if one == a[i]:
            print(two)
        else:
            print(one)

main()
N=int(input())
S=input()
b=0
w=S.count(".")
ans=b+w
for s in S:
  if s=="#":
    b+=1
  else:
    w-=1
  ans=min(ans, b+w)
print(ans)

### FIXED CODE ###

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

if a < b:
    if a < c and c < b:
        print('Yes')
    else:
        print('No')
else:
    if b < c and c < a:
        print('Yes')
    else:
        print('No')
n,m = map(int,input().split())
sc = [[int(i) for i in input().split()] for j in range(m)]

ans = [10 for i in range(3)]

sc.sort()

ini_pos = sc[0][0]
ini_val = sc[0][1]
ans[ini_pos-1] = ini_val

for i in range(m-1):
    if sc[i+1][0] == ini_pos:
        if sc[i+1][1] != ini_val:
            print(-1)
            exit()
    else:
        ini_pos = sc[i+1][0]
        ini_val = sc[i+1][1]
        ans[ini_pos-1] = ini_val

if ans[0] == 0:
    print(-1)
    exit()

value = 0

for i in range(3):
    if ans[i] != 10:
        value += ans[i] * 10 ** (2-i)

print(value)

### FIXED CODE ###

n,m = map(int,input().split())
sc = [[int(i) for i in input().split()] for j in range(m)]

if m == 0:
    if n == 3:
        print(100)
        exit()
    elif n == 2:
        print(10)
        exit()
    elif n== 1:
        print(0)
        exit()

ans = [10 for i in range(n)]

sc.sort()

ini_pos = sc[0][0]
ini_val = sc[0][1]
ans[ini_pos-1] = ini_val

for i in range(m-1):
    if sc[i+1][0] == ini_pos:
        if sc[i+1][1] != ini_val:
            print(-1)
            exit()
    else:
        ini_pos = sc[i+1][0]
        ini_val = sc[i+1][1]
        ans[ini_pos-1] = ini_val

if ans[0] == 0:
    if n == 1:
        print(0)
        exit()
    else:
        print(-1)
        exit()

value = 0

for i in range(n):
    if i == 0:
        if ans[i] == 10:
            value += 10 ** (n-i-1)
            continue
    if ans[i] != 10:
        value += ans[i] * 10 ** (n-i-1)

print(value)