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

n,m=map(int,input().split())
q=[int(input()) for i in range(m)]
mod=10**9+7

for i in range(1,n+1):
  if i==1:
    if i not in q:
      a=1
      b=1
    else:
      a=1
      b=0
  else:
    if i in q:
      a,b=b,0
    else:
      a,b=b,(a+b)%mod
print(b)

### FIXED CODE ###

n,m = map(int,input().split())
broken = [int(input()) for i in range(m)]
broken.sort()
broken += [0] * (n-m)
index = 0
mod = 10**9 + 7
for i in range(1,n+1):
  if i==1:
    if i != broken[index]:
      a=1
      b=1
    else:
      a=1
      b=0
      index += 1
  else:
    if i == broken[index]:
      a,b=b,0
      index += 1
    else:
      a,b=b,(a+b)%mod
print(b)
### BUGGY CODE ###

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = np.array(list(map(int, sr())))
for _ in range(N-1):
    A = np.abs(np.diff(A))

print(A[0])

 

### FIXED CODE ###

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 2回目で0か2しかない場合と1がある場合
# 1がある時は2は0に変換して良い

def lucas(B, r):
    # nCr が奇数ならTrueを返す
    R = bin(r)[2:]
    for x, y in zip(B[::-1], R[::-1]):
        if x == '0' and y == '1':
            return 0
    return 1

N = ir()
A = np.array(list(map(int, sr())))
A = np.abs(np.diff(A))
N -= 1
bl = False
if 1 not in set(A):
    bl = True
    A //= 2

# それぞれの値が答えに何回貢献しているか
result = 0
A = A.tolist()
B = bin(N-1)[2:]
for i, a in enumerate(A):
    result += a * lucas(B, i)
result %= 2

print(result * 2 if bl else result)
### BUGGY CODE ###

N = int(input())
A = [int(x) for x in input().split()]

mod = 10**9 + 7
a = 0
for i in range(N):
    a += sum(A[:i]) * A[i]
print(a % mod)


### FIXED CODE ###

mod = 10**9 + 7

N = int(input())
A = [int(x) for x in input().split()]
S = sum(A) % mod

ans = 0
for i in range(N):
    S -= A[i]
    if S < 0: S += mod

    ans += S * A[i]
    ans %= mod
print(ans)
### BUGGY CODE ###

import bisect
a,b,n = map(int,input().split())

x = list()
for i in range(n):
  y = int(a*(i+1)/b) - a*int((i+1)/b)
  x.insert(bisect.bisect_left(x,y),y)

print(x[-1])

### FIXED CODE ###

a,b,n=map(int,input().split())
x=min(b-1,n)
print((a*x)//b-a*(x//b))
### BUGGY CODE ###

ans = 0
n = int(input())
l = [int(input()) for _ in range(n)]
s = set(l)
for i in s:
  if l.count(i)%2 != 0:
    ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
l = [int(input()) for _ in range(n)]
l.sort()
c = 1
ans = 0
for i in range(1, n):
  if l[i-1] == l[i]:
    c += 1
  else:
    ans += c%2
    c = 1
if c != 1:
  ans += c%2
else:
  ans += 1
print(ans)
### BUGGY CODE ###

import bisect
n, k, c = map(int, input().split())
s = input()
a = []
for i in range(n):
    if s[i] == 'o':
        a.append(i+1)

ans = []
for i in range(len(a)):
    cur = 10 ** 10
    flg = False
    for j in range(k):
        idx = bisect.bisect_left(a, cur - c) - 1
        if idx == i:
            idx -= 1
        if idx < 0:
            flg = True
            break
        cur = a[idx]


    if flg:
        ans.append(a[i])

print(*ans, sep='\n')

### FIXED CODE ###

import bisect
n, k, c = map(int, input().split())
s = input()
a = []
for i in range(n):
    if s[i] == 'o':
        a.append(i+1)

m = len(a)
l = [0 for _ in range(m)]
r = [0 for _ in range(m)]

cur = 0
l[0] = a[0]
while True:
    to = bisect.bisect_left(a, a[cur] + c + 1)
    if to == m:
        break
    l[to] = l[cur] + 1
    cur = to

for i in range(m-1):
    if l[i] > l[i+1]:
        l[i+1] = l[i]

#print(l)

r[m-1] = 1
cur = m-1
while True:
    to = bisect.bisect_left(a, a[cur] - c) - 1
    if to == -1:
        break
    r[to] = r[cur] + 1
    cur = to

for i in range(m-1):
    x = m - 2 - i
    if r[x] < r[x+1]:
        r[x] = r[x+1]

#print(r)
l = [0] + l
r = [r[0]] + r + [0]

for i in range(1, m+1):
    if l[i-1] + r[i+1] < k:
        print(a[i-1])
### BUGGY CODE ###

k = input()
s = raw_input()

if k==0:
    print s
    exit(0)


l = len(s) / (k+1)
r = (len(s)+k) / (k+1)
left = min(int(s[i:i+l]) for i in xrange(len(s)-l))/10
right = max(int(s[i:i+r]) for i in xrange(len(s)-r))*10
while 1:
    mid = (left + right) / 2
    cnt = 0
    now = ""
    mid_c = str(mid)
    cp = idx = 0
    for c in s:
        now += c
        if not cp and idx < len(mid_c) and c != mid_c[idx]:
            cp = 1 if c > mid_c[idx] else -1
        idx += 1
        if (idx == len(mid_c) and cp == 1) or idx > len(mid_c):
            cnt += 1
            idx = 1; cp = 0
            if int(c) > mid:
                cnt = 100003
                break
            now = c
            if c != mid_c[0]:
                cp = 1 if c > mid_c[0] else -1
    if cnt > k:
        if left == mid:
            break
        left = mid
    else:
        if right == mid:
            break
        right = mid
print left+1


### FIXED CODE ###

k = input()
s = raw_input()

if k==0:
    print s
    exit(0)
if len(s) % (k+1) == 0:
    p = len(s) / (k+1)
    print max(int(s[i:i+p]) for i in xrange(0,len(s),p))
    exit(0)

l = len(s) / (k+1)
r = (len(s)+k) / (k+1)
left = 10**(l-1)
right = 10**r
while 1:
    mid = (left + right) / 2
    cnt = 0
    now = ""
    mid_c = str(mid)
    cp = idx = 0
    for c in s:
        now += c
        if not cp and idx < len(mid_c) and c != mid_c[idx]:
            cp = 1 if c > mid_c[idx] else -1
        idx += 1
        if (idx == len(mid_c) and cp == 1) or idx > len(mid_c):
            cnt += 1
            idx = 1; cp = 0
            if int(c) > mid:
                cnt = 100003
                break
            now = c
            if c != mid_c[0]:
                cp = 1 if c > mid_c[0] else -1
    if cnt > k:
        if left == mid:
            break
        left = mid
    else:
        if right == mid:
            break
        right = mid
print left+1
### BUGGY CODE ###

from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)
MOD = 10**9 + 7

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    S = list(input()[:-1])[::-1]
    # print(S)
    L = len(S)
    modsum = 0
    # はじめ長さ、つぎは余り
    memo = [[ 0 for __ in range(13)] for _ in range(L)]

    # 0だけ別に
    if S[0].isnumeric():
        memo[0][int(S[0])] = 1
    else:
        for n in range(10):
            memo[0][n] = 1
    p = 1
    for i in range(1, L):
        # 数字なら以前までの余りにたす
        p *= 10
        if S[i].isnumeric():
            mod = (int(S[i])*p)%13
            for m in range(13):
                # 0でない余りを次に持ち越し
                if memo[max(0,i-1)][m] > 0:
                    memo[i][(m+mod)%13] += memo[max(0,i-1)][m]
        # ?なら1~10の余りのケース全てをためす
        else:
            for n in range(10):
                mod = (n*p)%13
                for m in range(13):
                    # その前の数があるなら足す
                    if memo[max(0,i-1)][m] > 0:
                        cur = (m+mod)%13
                        memo[i][cur] += memo[max(0,i-1)][m]
                        memo[i][cur] %= MOD
    print(memo[L-1][5])
    # print(memo)








if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import exit, stderr, stdin
input = stdin.readline


def main():
    MOD = 10**9 + 7
    S = input()[:-1]
    L = len(S)
    # 余り
    memo = [0 for _ in range(13)]
    memo[0] = 1

    for i in range(L):
        memo_prev = [x for x in memo]
        memo = [0 for _ in range(13)]
        # 数字なら以前までの余りにたす
        if S[i].isnumeric():
            n = int(S[i])
            for m in range(13):
                cur = (10*m+n)%13
                memo[cur] += memo_prev[m]
        # ?なら1~10の余りのケース全てをためす
        else:
            for n in range(10):
                for m in range(13):
                    cur = (10*m+n)%13
                    memo[cur] += memo_prev[m]
            for m in range(13):
                memo[m] %= MOD
    print(memo[5])


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

import numpy as np
n, k = map(int, input().split())
s = input()
s = s.replace('LR', 'L,R')
s = s.replace('RL', 'R,L')
s = s.split(',')
s = list(map(len, s))
l = 2*k+1
ans = -1

if l >= len(s):
    ans = sum(s)-1
else:
    for i in range(len(s)-l+1):
        cnt = 0
        cnt += sum(list(np.array(s[:i])-1))
        cnt += sum(s[i:l+i])-1
        cnt += sum(list(np.array(s[l+i:])-1))
        ans = max(ans, cnt)   
print(ans)

### FIXED CODE ###

n, k = map(int,input().split())
s = input()
ans=0
for i in range(n-1):
    if s[i] == s[i+1]:
        ans += 1

ans += k*2
if ans > n-1:
    ans = n-1
    
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=1
for i in a:
    ans=ans*i
if ans>10**18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=sorted(a,reverse=True)

ans=1
if b[-1]==0:
    print(0) 
else:
    for i in a:
        ans=ans*i
        if ans>10**18:
            print(-1)
            break
    else:
        print(ans)
### BUGGY CODE ###

s = input()
t = input()

def func(a, b):
    t = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            t += 1
    return t

t_max = 10000
for i in range(len(s) - len(t) + 1):
    for j in range(len(t)):
        tmp = func(s[i:i+len(t)], t)
        if tmp < t_max:
            t_max = tmp
print(t_max)


### FIXED CODE ###

s = input()
t = input()

def func(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

t_max = 10000
for i in range(len(s) - len(t) + 1):
    tmp = func(s[i:i+len(t)], t)
    if tmp < t_max:
        t_max = tmp
print(t_max)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
H, W, D = map(int, input().split())

A = []
for _ in range(H):
    a = list(map(int, input().split()))
    A.append(a)

Q = int(input())
LR = []
for _ in range(Q):
    l, r = map(int, input().split())
    LR.append((l, r))
    
# H*Wのマスをマスの数値をkeyにした辞書にする
A_dict = {}
for i, sub_a in enumerate(A):
    for j, a in enumerate(sub_a):
        A_dict[a] = (i+1, j+1)
#print(A_dict)

N = H*W+1
edges = []
graph = [[float("inf") for i in range(N)] for i in range(N)] 
for i in range(1, N):
    s = i
    g = i+D
    if g >= N:
        break
    cost = abs(A_dict[s][0]-A_dict[g][0])+abs(A_dict[s][1]-A_dict[g][1])
    edges.append((s,g,cost))
for x,y,z in edges:
    graph[x][y] = z
for i in range(N):
    graph[i][i] = 0 #自身のところに行くコストは０
    
from collections import defaultdict
dist = defaultdict(lambda: {})

for i in range(1, N):
    dist[i][i] = 0
    d = 0
    s = i
    g = i+D
    while g < N:
        dist[i][g] = dist[i][s]+graph[s][g]
        s = g
        g = s+D
#print(dist)
for l, r in LR:
    print(dist[l][r])
        




### FIXED CODE ###

import sys
input = sys.stdin.readline
H, W, D = map(int, input().split())

A = []
for _ in range(H):
    a = list(map(int, input().split()))
    A.append(a)

Q = int(input())
LR = []
for _ in range(Q):
    l, r = map(int, input().split())
    LR.append((l, r))
# H*Wのマスをマスの数値をkeyにした辞書にする
A_dict = {}
for i, sub_a in enumerate(A):
    for j, a in enumerate(sub_a):
        A_dict[a] = (i+1, j+1)

# costの辞書化
from collections import defaultdict
cost_dict = defaultdict(lambda: {})
N = H*W+1
for i in range(1, N):
    s = i
    g = i+D
    if g >= N:
        break
    cost = abs(A_dict[s][0]-A_dict[g][0])+abs(A_dict[s][1]-A_dict[g][1])
    cost_dict[s][g] = cost
    

dist = defaultdict(lambda: {})
for i in range(1, D+1):
    dist[i][i] = 0
    s = i
    g = i+D
    while g < N:
        dist[i][g] = dist[i][s] + cost_dict[s][g]
        s = g
        g = s + D

    
#print(dist)
for l, r in LR:
    idx = r%D
    if idx == 0:
        idx = D
    print(dist[idx][r]-dist[idx][l])
### BUGGY CODE ###

n = int(input())
s = list(input())

r = 0
g = 0
b = 0
for i in range(n):
    if s[i] == "R":
        r += 1
    elif s[i] == "G":
        g += 1
    else:
        b += 1

ans = r * g * b
if ans == 0:
    print("0")
else:
    for i in range(n - 2):
        for j in range(i + 1, n - 1):
            sub = j - i
            sub2 = (n - 1) - j
            if sub <= sub2:
                if s[i] != s[j] and s[j] != s[j + sub] and s[i] != s[j + sub]:
                    ans -= 1
    print(ans)

### FIXED CODE ###

n = int(input())
s = list(input())

r = 0
g = 0
b = 0
for i in range(n):
    if s[i] == "R":
        r += 1
    elif s[i] == "G":
        g += 1
    else:
        b += 1

ans = r * g * b
if ans == 0:
    print("0")
else:
    for i in range(n - 2):
        for j in range(i + 1, n - 1):
            sub = j - i
            sub2 = (n - 1) - j
            if sub <= sub2:
                if s[i] != s[j] and s[j] != s[j + sub] and s[i] != s[j + sub]:
                    ans -= 1
    print(ans)
### BUGGY CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

from scipy import sparse

import numpy as np
S = str(input())
N = len(S)
A = np.matrix([[0]*N for _ in range(N)])
for i in range(N):
  if S[i]=='R':
    A[i,i+1] = 1
  else:
    A[i,i-1] = 1

x = sparse.lil_matrix(np.array([1]*N)) * sparse.lil_matrix(np.linalg.matrix_power(A,10**5))
x = x.toarray()
a = []
for i in range(N):
  a.append(x[0,i])
print(*a)

### FIXED CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

S = str(input())
n = len(S)
ans = [0]*n

left = 0
while left<=n-1:
  R_pos = n-1
  for i in range(left,n):
    if S[i]=='L':
      R_pos = i-1
      L_pos = i
      break
  if R_pos == n-1:
    ans[R_pos] += R_pos-left + 1
    break
  right = n-1
  for j in range(i+1,n):
    if S[j] == 'R':
      right = j-1
      break
  ans[R_pos] += (R_pos-left)//2 + (right-R_pos)//2 + 1
  ans[L_pos] += (L_pos-left)//2 + (right-L_pos)//2 + 1
  if right == n-1:
    break
  left = j

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

n,m = map(int,input().split())
import numpy as np
l,r = map(int,input().split())
li = np.arange(l,r+1)
for i in range(m-1):
    l,r = map(int,input().split())
    li = set(li)& set(np.arange(l,r+1))
print(len(li))


### FIXED CODE ###

n,m = map(int,input().split())
l,r = map(int,input().split())

for i in range(m-1):
    
    nl,nr = map(int,input().split())
    if l<nl :
        l = nl
    if r > nr:
        r = nr
print(max(r-l + 1, 0))
### BUGGY CODE ###

def gcd(a, b, c):
  import fractions
  lis = [a, b, c]
  gc = lis[0]
  for i in range(0, 3):
      gc = fractions.gcd(gc, lis[i])
  return gc
def main():
  K = int(input())
  ans = 0
  for p in range(1, K+1):
    for s in range(p, K+1):
      for k in range(s, K+1):
        if p == s == k:
          ans += p
        elif p == s or s == k or p == k:
          ans += 3 * gcd(p, s, k)
        else:
          ans += 6 * gcd(p, s, k)
  print(ans)

if __name__=='__main__':
    main()

### FIXED CODE ###

def gcd(a, b, c):
  x = gcd2(a, b)
  y = gcd2(b, c)
  return gcd2(x, y)

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

def main():
  K = int(input())
  ans = 0
  for p in range(1, K+1):
    for s in range(p, K+1):
      for k in range(s, K+1):
        if p == s == k:
          ans += p
        elif p == s or s == k or p == k:
          ans += 3 * gcd(p, s, k)
        else:
          ans += 6 * gcd(p, s, k)
  print(ans)

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

N,K=map(int,input().split())
h=list(map(int,input().split()))
DP=[0]*N
DP[0]=0
for i in range(1,N):
  #j=1
  #while j<=K and j<=i:
  #  DP[i]=min(DP[i],abs(h[i]-h[i-j])+DP[i-j])
  #for j in range(max(0, i-K),i):
    #DP[i]=min(DP[i],abs(h[i]-h[j])+DP[j])
  r=max(0, i-K)
  DP[i]=min([abs(h[i]-h[j])+DP[j] for j in range(r,i)])
print(DP[-1])


### FIXED CODE ###

def main():
  #import sys
  #input = sys.stdin.readline
  N,K=map(int,input().split())
  h=list(map(int,input().split()))
  DP=[0]*N
  DP[0]=0
  for i in range(1,N):
  #j=1
  #while j<=K and j<=i:
  #  DP[i]=min(DP[i],abs(h[i]-h[i-j])+DP[i-j])
  #for j in range(max(0, i-K),i):
    #DP[i]=min(DP[i],abs(h[i]-h[j])+DP[j])
    r=max(0, i-K)
    DP[i]=min([abs(h[i]-h[j])+DP[j] for j in range(r,i)])
  print(DP[-1])
if __name__ == '__main__':
  main()
### BUGGY CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
for i in range(N):
    print(max(A[:i] + A[i+1:]))

### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
AMax = max(A)
x = A.index(AMax)
Aelse = A[:x]+A[x+1:]
AelseMax = max(Aelse)
if AMax == AelseMax:
    for i in range(N):
        print(AMax)
else:
    for i in range(N):
        if x == i:
            print(AelseMax)
        else:
            print(AMax)
### BUGGY CODE ###

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

def calculate(n, arr):
    mod = 1000000000 + 7
    result = 0

    for i in range(n):
        for j in range(i + 1, n):
            result += (arr[i] * arr[j]) % mod

    print(result % mod)


calculate(N, ARR)


### FIXED CODE ###

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

def calculate(n, arr):
    mod = 1000000000 + 7
    result = 0

    rightTotal = sum(arr)
    for i in range(n-1):
        rightTotal -= arr[i]
        result += (arr[i] * rightTotal) % mod

    print(result % mod)




calculate(N, ARR)
### BUGGY CODE ###

import numpy as np


def solve():
    N, K = map(int, input().split())
    a_l = np.array(input().split(), int)
    b_l = np.array(input().split(), int)
    a_l.sort()
    b_l.sort()
    b_l = b_l[::-1]

    sum_a = sum(a_l)
    left, right = -1, 10**12
    while left + 1 < right:
        mid = (left + right) // 2
        if sum_a - sum(np.minimum(a_l, mid//b_l)) <= K:
            right = mid
        else:
            left = mid

    print(right)


if __name__ == '__main__':
    solve()

### FIXED CODE ###

import numpy as np


def solve():
    N, K = map(int, input().split())
    a_l = np.array(input().split(), int)
    b_l = np.array(input().split(), int)
    a_l.sort()
    b_l.sort()
    b_l = b_l[::-1]

    sum_a = a_l.sum()
    left, right = -1, 10**13
    while left + 1 < right:
        mid = (left + right) // 2
        if sum_a - np.minimum(a_l, mid // b_l).sum() <= K:
            right = mid
        else:
            left = mid

    print(right)


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

N,M=map(int,input().split())
x=[]
y=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x.append(b)
    if b==N:
        y.append(a)
x.sort()
y.sort()
for i in x:
    if i in y:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")
### BUGGY CODE ###

import math
from queue import Queue
from collections import defaultdict

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


root = [defaultdict(int) for _ in range(n+1)]


for i in range(m):
    a, b = [int(i) for i in input().split()]
    root[a][b] = 1
    root[b][a] = 1

check = [0 for _ in range(n + 1)]
check[1] = 1

q = Queue()
q.put(1)

while (not q.empty()):
    now = q.get()
    for i in range(1, n + 1):
        if (root[now][i] == 1 and check[i] == 0):
            check[i] = now
            q.put(i)

flag = 1
for i in range(2, n + 1):
    if (check[i] == 0):
        flag = 0

if (flag == 1):
    print("Yes")
    for j in range(2, n + 1):
        print(check[j])
else:
    print("No")

### FIXED CODE ###

import math
from queue import Queue

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

root = [[] for _ in range(n+1)]

for i in range(m):
    a, b = [int(i) for i in input().split()]
    root[a].append(b)
    root[b].append(a)

check = [0 for _ in range(n + 1)]
check[1] = 1

q = Queue()
q.put(1)

while (not q.empty()):
    now = q.get()
    for i in root[now]:
        if (check[i] == 0):
            check[i] = now
            q.put(i)

flag = 1
for i in range(2, n + 1):
    if (check[i] == 0):
        flag = 0

if (flag == 1):
    print("Yes")
    for j in range(2, n + 1):
        print(check[j])
else:
    print("No")
### BUGGY CODE ###

N=int(input())
a = list(map(int, input().split()))
import fractions
ansp = a[0]
ans = 1
for i in range(1, N):
  ansn = ansp * a[i] // fractions.gcd(ansp, a[i])
  ans = (ans * (ansn // ansp))%(10**9+7) + (ansn // a[i])%(10**9+7)
  ans = ans %(10**9+7)
  ansp = ansn
print(ans)


### FIXED CODE ###

from fractions import gcd
N=int(input())
a = list(map(int, input().split()))
lcm = 1
for i in a:
    lcm = lcm * i // gcd(lcm, i)
ans = 0
for i in a:
    ans += (lcm//i)#%(10**9+7)
print(ans%(10**9+7))
### BUGGY CODE ###

def ans_xyz(x, y, z):
    return ((x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x))

N = int(input())
for n in range(1 , N + 1):
    ans = 0
    for x in range(1, 101):
        xxx = ans_xyz(x, x, x)
        if xxx > n:
            break
        elif xxx == n:
            ans += 1
        for y in range(x + 1, 101):
            xxy = ans_xyz(x, x, y)
            if xxy > n:
                break
            elif xxy == n:
                ans += 3
            for z in range(y + 1, 101):
                if ans_xyz(x, y, z) > n:
                    break
                elif ans_xyz(x, y, z) == n:
                    ans += 6
            xyy = ans_xyz(x, y, y)
            if xyy > n:
                break
            elif xyy == n:
                ans += 3
    print(ans)



### FIXED CODE ###

def ans_xyz(x, y, z):
    return ((x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x))

N = int(input())
ans = [0] * (10 ** 5)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            ans[ans_xyz(x, y, z)] += 1
print(*ans[1:N + 1], sep='\n')
### BUGGY CODE ###

from collections import Counter

input_line=int(input())
count=0
input_list=[]
while count < input_line:
  input_list.append(input())
  count+=1
ans={}
max_appeard=0
ans_list=[]
list_set=set(input_list)
for item in list_set:
    appeard=Counter(input_list)[item]
    if appeard >= max_appeard:
        max_appeard=appeard
        ans[item]=appeard
for key,value in ans.items():
    if value==max_appeard:
        ans_list.append(key)
ans_list.sort()
for item in ans_list:
  print (item)

### FIXED CODE ###

from collections import defaultdict

H=int(input())
d = defaultdict(int)
for _ in range(H):
    d[input()] += 1
max_appeard=max(d.items(), key=lambda x: x[1])[1]
ans=[k for k,v in d.items() if v == max_appeard]
ans.sort()
for item in ans:
  print (item)