Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = float("inf")
for i in range(M):
  x,y,c = map(int,input().split())
  ans = min(a[x-1]+b[y-1]-c,ans)
  
for i in range(A):
  for j in range(B):
    ans = min(ans,a[i]+b[j])
    
print(ans)
    

### FIXED CODE ###

A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = float("inf")
for i in range(M):
  x,y,c = map(int,input().split())
  ans = min(a[x-1]+b[y-1]-c,ans)
  
ans = min(ans,min(a)+min(b))
    
print(ans)
### BUGGY CODE ###

import collections as C
n, q = map(int,input().split())

g = C.Counter([])
p = C.Counter([])
for i in range(n-1):
	a,b = map(int,input().split())
	if a not in g.keys():
		g[a] = [b]
	elif a in g.keys():
		g[a] = g[a] + [b]

for i in range(q):
	a,b = map(int,input().split())
	if a not in p.keys():
		p[a] = b
	elif a in p.keys():
		p[a] = p[a] + b

ans = [0 for _ in range(n)]
que = [0]
i = 1
while i > 0:

	if i in p.keys():
		ans[i-1] += p[i]
	if i in g.keys():
		for j in g[i]:
			ans[j-1] = ans[i-1]
			que.append(j)
	i = que.pop()


for i in ans:
	print(i, end=" ")

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N, Q = map(int ,input().split())
E = [[] for _ in range(N+1)]
for _ in range(N-1):
	at,bt = map(int ,input().split())
	E[at].append(bt)
	E[bt].append(at)
cnt = [0 for _ in range(N+1)]
for _ in range(Q):
	pt,xt = map(int, input().split())
	cnt[pt] += xt

flg = [0 for _ in range(N+1)]
q = [[1,-1]]
while q:
	cp, root = q.pop()
	for np in E[cp]:
		if np == root:
			continue
		cnt[np] += cnt[cp]
		q.append([np,cp])

cnt.pop(0)
for c in cnt:
	print(c, end = " ")
print()
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
r=a[:]
r.extend([i-1 for i in a])
r.extend([i+1 for i in a])
for i in set(r):
  x=0
  for ai in a:
    if ai==i or ai-1==i or ai+1==i:
      x+=1
  ans=max(ans,x)
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
an = [0]*(max(a)+2)
for i in a:
  if i!=0:
    an[i-1]+=1
  an[i+1]+=1
  an[i]+=1
print(max(an))
### BUGGY CODE ###

import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
s = input()

r = []
g = []
b = []
for i in range(n):
    if s[i] == "R":
        r.append(i)
    if s[i] == "G":
        g.append(i)
    if s[i] == "B":
        b.append(i)

ans = len(r)*len(g)*len(b)

for i in range(1,n):
    for j in range(n):
        k = j + 2 * i
        if k < n and s[j] != s[j + i] and s[j] != s[j + 2 * i] and s[j + i] != s[j + 2 * i]:
            ans -= 1

print(ans)

### FIXED CODE ###

import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
s = input()

r = []
g = []
b = []
for i in range(n):
    if s[i] == "R":
        r.append(i)
    if s[i] == "G":
        g.append(i)
    if s[i] == "B":
        b.append(i)

ans = len(r)*len(g)*len(b)

for i in range(1,n):
    for j in range(n):
        k = j + 2 * i
        if k < n and s[j] != s[j + i] and s[j] != s[j + 2 * i] and s[j + i] != s[j + 2 * i]:
            ans -= 1

print(ans)
### BUGGY CODE ###

num = int(input())
i = list(map(int, input().split())) 
#b=min(i)-num
#b=max(i)-1

b=min(i)-num
mini = float('inf')
while(b!=max(i)):
  sum=0
  for j  in range(num):
     sum+=abs(i[j]-(b+j+1))
  mini = min(sum,mini)
  b+=1
  
print(mini)

### FIXED CODE ###

num = int(input())
list_i = list(map(int, input().split())) 
#b=min(i)-num
#b=max(i)-1
for j in range(num):
  list_i[j]=list_i[j]-j-1
list_i.sort()
b=list_i[int(num/2)]
sum=0
for i in range(num):
  sum +=abs(list_i[i]-b)
print(sum)
### BUGGY CODE ###

A,B,N = [int(i) for i in input().split()]
x = N
M = A*N//B
ans = -float("inf")

for _ in range(min([10**7,N])):
    s = (A*x)//B - A*(x//B)
    ans = max([ans,s])
    x -= 1

print(ans)

### FIXED CODE ###

A,B,N = [int(i) for i in input().split()]
t = min([N,B-1])
print((A*t//B))
### BUGGY CODE ###

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

As.sort(reverse=True)

minAOK = As[0]+1
sumSubsets = set([0])
for A in As:
    if A >= K:
        minAOK = A
        continue
    for sumSubset in sumSubsets.copy():
        if K - A <= sumSubset:
            minAOK = A
        if sumSubset + A < K:
            sumSubsets.add(sumSubset + A)

ans = len([A for A in As if A < minAOK])
print(ans)


### FIXED CODE ###

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

As.sort(reverse=True)

minAOK = As[0]+1
sumSubsets = set([0])
for A in As:
    if A >= K:
        minAOK = A
        continue
    for sumSubset in sumSubsets.copy():
        if K - A <= sumSubset:
            minAOK = A
        if sumSubset + A < K:
            sumSubsets.add(sumSubset + A)

ans = len([A for A in As if A < minAOK])
print(ans)
### BUGGY CODE ###

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

MOD = 10 ** 9 + 7

def gcd(x, y):
  return x if y == 0 else gcd(y, x % y)

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

tmp = A[0]
for i in range(1, N):
  tmp = lcm(A[i], tmp)
#print(tmp)

answer = 0
for a in A:
  answer = (answer + tmp // a) % MOD
print(answer)


### FIXED CODE ###

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

MOD = 10 ** 9 + 7

def gcd(x, y):
  return x if y == 0 else gcd(y, x % y)

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

tmp = A[0]
for i in range(1, N):
  tmp = lcm(A[i], tmp)
#print(tmp)

answer = 0
for a in A:
  answer += tmp // a
print(answer % MOD)
### BUGGY CODE ###

s = input()
s="0"+s
num="0"
ans=0

for i in range(1,len(s)):
    for j in range(i,len(s)):
        num="0"
        for k in range(i,j+1):
            num+=s[k]
        if int(num)%2019==0:
            ans+=1

print(ans)

### FIXED CODE ###

s = input()

ans=0
s=s[::-1]
t=1
ketame=0
amari10=1
kosuu=[1]+[0]*2020
for i in s:
    ketame=(ketame+(int(i)*amari10)%2019)%2019
    amari10*=10
    amari10%=2019
    kosuu[ketame]+=1

for i in range(len(kosuu)):
    if kosuu[i]>0:
        ans+=kosuu[i]*(kosuu[i]-1)/2
    
print(int(ans))
### BUGGY CODE ###

from collections import defaultdict
import sys
import math

input = sys.stdin.readline


# 素因数分解O(√n)

def primeFactor(n):
    res = defaultdict(lambda: 0)
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            res[i] += 1
            n = n // i
    if n != 1:
        res[n] = 1
    return res


def main():
    N = int(input())
    A = list(map(int, input().split()))
    primes = defaultdict(lambda: 0)
    for i in range(N):
        pf = primeFactor(A[i])
        for k in pf.keys():
            primes[k] += 1
    if all(primes[k] == 1 for k in primes.keys()):
        print('pairwise coprime')
    elif all(primes[k] < N for k in primes.keys()):
        print('setwise coprime')
    else:
        print('not coprime')


if __name__ == '__main__':
    main()


### FIXED CODE ###

from functools import reduce
from collections import defaultdict
import sys
import math

input = sys.stdin.readline

# 素因数分解O(√n)


def primeFactor(n):
    res = defaultdict(lambda: 0)
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            res[i] += 1
            n = n // i
    if n != 1:
        res[n] = 1
    return res


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    primes = defaultdict(lambda: 0)
    setp = True
    pairs = True
    if gcd(*A) != 1:
        setp = False
        pairs = False
    else:
        for i in range(N):
            pf = primeFactor(A[i])
            for k in pf.keys():
                primes[k] += 1
                if primes[k] != 1:
                    pairs = False
            if not pairs:
                break
    if pairs:
        print('pairwise coprime')
    elif setp:
        print('setwise coprime')
    else:
        print('not coprime')


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N, M, K = map(int, input().split())
friends_table = [[] for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    friends_table[a-1] += [b-1]
    friends_table[b-1] += [a-1]

blocks_table = [[] for i in range(N)]
for _ in range(K):
    a, b = map(int, input().split())
    blocks_table[a-1] += [b-1]
    blocks_table[b-1] += [a-1]

group_list = [i for i in range(N)]
friends_candidate = [[] for i in range(N)]

for i in range(N):
    friend = [i]
    # すでにDFS済み
    if i != group_list[i]:
        continue
    next_stack = friends_table[i][:]
    while next_stack:
        next = next_stack.pop()
        # 訪問済み
        if i == group_list[next]:
            continue
        friend += [next]
        group_list[next] = i
        next_stack += friends_table[next]
    for f in friend:
        friends_candidate[f] = friend

for i in range(N):
    print(len(set(friends_candidate[i]).difference(set(friends_table[i] + blocks_table[i])))-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, M, K = map(int, input().split())
friends_table = [[] for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    friends_table[a-1] += [b-1]
    friends_table[b-1] += [a-1]

group_list = [i for i in range(N)]
friends_candidate = [[] for i in range(N)]

for i in range(N):
    # すでにDFS済み
    if i != group_list[i]:
        continue
    next_stack = [i]
    friend = [i]
    while next_stack:
        u = next_stack.pop(-1)
        for v in friends_table[u]:
            # 訪問済み
            if i == group_list[v]:
                continue
            friend += [v]
            group_list[v] = i
            next_stack += [v]
    for f in friend:
        friends_candidate[f] = friend

blocks_table = [[] for i in range(N)]
for _ in range(K):
    a, b = map(int, input().split())
    if group_list[a-1] == group_list[b-1]:
        blocks_table[a-1] += [b-1]
        blocks_table[b-1] += [a-1]

for i in range(N):
    print(len(friends_candidate[i]) - len(friends_table[i]) - len(blocks_table[i])-1)
### BUGGY CODE ###

def dfs(v, p, ad_list, count):
  for u in ad_list[v]:
    if u != p:
      count[u] += count[v]
      dfs(u, v, ad_list, count)

def main():
  n, q = map(int, input().split())
  ab = tuple(tuple((map(lambda x: int(x)-1, input().split())) for _ in range(n-1)))
  px = tuple(tuple(map(int, input().split())) for _ in range(q))

  ad_list = [[] for _ in range(n)]
  for a, b in ab:
    ad_list[a] += [b]
    ad_list[b] += [a]

  count = [0 for _ in range(n)]
  for p, x in px:
    count[p-1] += x

  dfs(0, -1, ad_list, count)

  print(*count)

if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.buffer.readline
def dfs(G,v,p):
    for nv in G[v]:
        if(nv==p):
            continue
        point[nv]+=point[v]
        dfs(G,nv,v)

N,Q=map(int,input().split())
G=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(lambda x:int(x)-1,input().split())
    G[a].append(b)
    G[b].append(a)
point=[0]*N
for i in range(Q):
    p,x=map(int,input().split())
    point[p-1]+=x
dfs(G,0,-1)
print(*point)
### BUGGY CODE ###

from sys import stdin
import itertools

def main():

    input = stdin.readline

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

    mod = (10 ** 9) +7

    ans = 0

    for i,j in itertools.combinations(range(N),2):
        ans = (ans + (A[i] * A[j])) % mod

    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

from sys import stdin
import itertools

def main():

    input = stdin.readline

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

    mod = (10 ** 9) +7

    ans = 0

    total = sum(A)

    for i in range(N):
        total = total - A[i]
        ans = (ans + (A[i] * total)) % mod
        

    print(ans)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

N = int(input())
L = [int(i) for i in input().split()]
L.sort()
 
result = 0
 
for aIndex,a in enumerate(L[:N-2]):
    for bIndex,b in enumerate(L[aIndex+1:N-1]):
        for c in L[aIndex+bIndex+2:]:
            if a<b+c and b<a+c and c<a+b:
                result+=1
            else:
                break
 
print(result)


### FIXED CODE ###

from bisect import bisect_left

N = int(input())
L = list(map(int,input().split()))
L.sort()
 
result = 0

for aIndex,a in enumerate(L[:N-2]):
    for bIndex,b in enumerate(L[aIndex+1:N-1]):
        bIndex = aIndex + bIndex + 1
        ab = a+b
        n = bisect_left(L,ab) - bIndex - 1
        result += n
print(result)
### BUGGY CODE ###

N = int(input())
H = list(map(int, input().split()))
ans = True
for i in range(N):
  if min(H) < H[i]-1:
    ans = False
    break
  else:
    H[i] = 10**10
if ans:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.reverse()
ans = "Yes"
for i in range(N-1):
  if A[i] >= A[i+1]:
    continue
  elif A[i] == A[i+1] - 1:
    A[i+1] = A[i]
  else:
    ans = "No"
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
if A == sorted(A) and len(A) == len(set(A)):
  print(1)
  exit(0)

def check(X):
  idx = [0]
  ltr = [0]
  for a in A:
    if idx[-1] < a:
      idx.append(a)
      ltr.append(0)
    else:
      while True:
        while idx[-1] > a:
          idx.pop()
          ltr.pop()
        if idx[-1] != a:
          idx.append(a)
          ltr.append(0)
        if idx[-1] == 0:
          return False
        ltr[-1] += 1
        if ltr[-1] < X:
          break
        a = idx[-1] - 1
        idx.pop()
        ltr.pop()
  return ltr[0] == 0

t = [1, N]
while t[1] - t[0] > 1:
  mid = (t[0] + t[1]) // 2
  t[check(mid)] = mid
print(t[1])


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
if A == sorted(A) and len(A) == len(set(A)):
  print(1)
  exit(0)

def check(X):
  idx = [0]
  ltr = [0]
  for a in A:
    if idx[-1] < a:
      idx.append(a)
      ltr.append(0)
    else:
      while True:
        while idx[-1] > a:
          idx.pop()
          ltr.pop()
        if idx[-1] != a:
          idx.append(a)
          ltr.append(0)
        if idx[-1] == 0:
          return False
        ltr[-1] += 1
        if ltr[-1] < X:
          break
        a = idx[-1] - 1
        idx.pop()
        ltr.pop()
  return ltr[0] == 0

t = [1, N]
while t[1] - t[0] > 1:
  mid = (t[0] + t[1]) // 2
  t[check(mid)] = mid
print(t[1])
### BUGGY CODE ###

H, W = map(int, input().split())
S = ""
for i in range(H):
    S += input()

vert = [0] * (H*W)
horz = [0] * (H*W)

for i in range(H*W):
    if S[i] == '.':
        if i - W >= 0:
            if S[i - W] == '.':
                vert[i] = vert[i - W]
                continue
        j = i
        L = 0
        while S[j] == '.':
            L += 1
            j += W
            if j >= H * W:
                break
        vert[i] = L

for i in range(H*W):
    if S[i] == '.':
        if i % W > 0:
            if S[i - 1] == '.':
                horz[i] = horz[i - 1]
                continue
        j = i
        L = 0
        while S[j] == '.':
            L += 1
            j += 1
            if j % W == 0:
                break
        horz[i] = L

light = [0] * (H*W)
for i in range(H * W):
    light[i] = horz[i] + vert[i]
print(max(light) - 1)


### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline

    H, W = map(int, input().split())
    grid = []
    for _ in range(H):
        grid.append(input().rstrip('\n'))

    L = [[0] * W for _ in range(H)]
    R = [[0] * W for _ in range(H)]
    U = [[0] * W for _ in range(H)]
    D = [[0] * W for _ in range(H)]
    for h in range(H):
        for w in range(1, W):
            if grid[h][w-1] == '.' and grid[h][w] == '.':
                L[h][w] = L[h][w-1] + 1
    for h in range(H):
        for w in range(W-2, -1, -1):
            if grid[h][w] == '.' and grid[h][w+1] == '.':
                R[h][w] = R[h][w+1] + 1
    for w in range(W):
        for h in range(1, H):
            if grid[h][w] == '.' and grid[h-1][w] == '.':
                U[h][w] = U[h-1][w] + 1
    for w in range(W):
        for h in range(H-2, -1, -1):
            if grid[h][w] == '.' and grid[h+1][w] == '.':
                D[h][w] = D[h+1][w] + 1

    ans = 1
    for h in range(H):
        for w in range(W):
            ans = max(ans, L[h][w] + R[h][w] + U[h][w] + D[h][w] + 1)
    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import string

alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])

while True:
	try:
		sentence = raw_input()
		while 'the' not in sentence or 'that' not in sentence or 'this' not in sentence:
			sentence = sentence.translate(tbl)
		print sentence
	except:
		break

### FIXED CODE ###

import string, sys

alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])

for s in sys.stdin:
	while not('the' in s or 'that' in s or 'this' in s):
		s = s.translate(tbl)
	print s[:-1]
### BUGGY CODE ###

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

if d_l[0] != 0 or d_l.count(0) != 1:
    ans = 0
else:
    ans = 1

n_tmp = n-1
count_l = [1,]

for i in range(1,n):
    count_l.append(d_l.count(i))
    ans = ans*(count_l[i-1]**count_l[i])%998244353
    n_tmp -= count_l[i]
    if n_tmp == 0 or ans == 0:
        break

print(ans)

### FIXED CODE ###

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

count_dict = {}
for i in range(n):
    count_dict[i] = 0
for val in d_l:
    count_dict[val] += 1

if d_l[0] != 0 or count_dict[0] != 1:
    ans = 0
else:
    ans = 1

for i in range(1,n):
    ans = (ans*(count_dict[i-1]**count_dict[i])) %998244353
    if ans == 0:
        break

print(ans)
### BUGGY CODE ###

import sys

H, W = map(int, input().split())
s = []
nb = 0
for _ in range(H):
    s.append(list(input()))
    nb += s[-1].count("#")

nw = H * W - nb

sy, sx = 0, 0
gy, gx = H - 1, W - 1

# たどりつけない場合
if s[gy - 1][gx] == "#" and s[gy][gx - 1] == "#":
    print(-1)
    sys.exit()

q = [[sy, sx]]
visited = [[int(1e10)]*W for _ in range(H)]
visited[sy][sx] = 0
while True:
    nq = []
    for ty, tx in q:
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            ny, nx = ty + dy, tx + dx
            if 0 <= ny < H and 0 <= nx < W and s[ny][nx] == "." and visited[ny][nx] > visited[ty][tx] + 1:
                visited[ny][nx] = visited[ty][tx] + 1
                nq.append([ny, nx])
    q = nq
    if [gy, gx] in q:
        temp = visited[gy][gx]
        break

print(nw - temp - 1)

### FIXED CODE ###

H, W = map(int, input().split())
s = []
nb = 0
for _ in range(H):
    s.append(list(input()))
    nb += s[-1].count("#")

nw = H * W - nb

sy, sx = 0, 0
gy, gx = H - 1, W - 1

q = [[sy, sx]]
visited = [[int(1e10)]*W for _ in range(H)]
visited[sy][sx] = 0
while q:
    ty, tx = q.pop(0)
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        ny, nx = ty + dy, tx + dx
        if 0 <= ny < H and 0 <= nx < W and s[ny][nx] != "#":
            if visited[ny][nx] > visited[ty][tx] + 1:
                visited[ny][nx] = visited[ty][tx] + 1
                q.append([ny, nx])
    if [gy, gx] in q:
        temp = visited[gy][gx]
        break
if visited[gy][gx] == int(1e10):
    print(-1)
else: print(nw - temp - 1)
### BUGGY CODE ###

from numba import njit
import numpy as np


@njit("i8(i8)")
def solve(n):
    ans = 1
    res = np.ones(n + 1, dtype=np.int64)
    for i in range(2, n + 1):
        res[i::i] += 1
        res[i] *= i
        ans += res[i]
    return ans


N = int(input())
print(solve(N))


### FIXED CODE ###

from numba import njit
import numpy as np


@njit("i8(i8)")
def solve(n):
    ans = 1
    res = np.ones(n + 1, dtype=np.int64)
    for i in range(2, n + 1):
        for j in range(i, n + 1, i):
            res[j] += 1
        ans += i * res[i]
    return ans


N = int(input())
print(solve(N))
### BUGGY CODE ###

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= pow(P, 1/N)+1:
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

### FIXED CODE ###

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= round(pow(P, 1/N)):
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)
### BUGGY CODE ###

n = int(input())
word = [input() for i in range(n)]
test = list([x,0] for x in set(word))
sen = []

for i, num in enumerate(test):
  test[i][1] = word.count(num[0])

num_max = int(max(test, key=lambda x: x[1])[1])

for i, num in enumerate(test):
  if(int(num[1]) == num_max):
    sen.append(num[0])

print('\n'.join(sorted(sen)))


### FIXED CODE ###

from collections import Counter
n = int(input())
word = Counter([input() for i in range(n)]).most_common()
print('\n'.join(sorted([num[0] for num in word if int(num[1]) == word[0][1]])))