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

#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools

#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]



def main():
    h,n=map(int,input().split()) #n yen, m types
    ab=[list(map(int,input().split())) for i in range(n)]
    maxa = max(a for a, b in ab)
    dp=[INFI for i in range(h+maxa)]
    dp[0]=0


    def f(h):

        for a,b in ab:
            for j in range(h+maxa):
                dp[j]=min(dp[j],dp[j-a]+b)
        return min(dp[h:])

    print(f(h))


if __name__ == "__main__":
    main()

### FIXED CODE ###

#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
 
import itertools
 
#import bisect
 
import copy
 
 
def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
 
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
 
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
 
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
 
    return result
 
def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta
 
def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default
 
#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]
 
 
 
def main():
    h,n=map(int,input().split()) #n yen, m types
    a=[]
    b=[]
    for i in range(n):
        x,y=map(int,input().split())
        a.append(x)
        b.append(y)
 
    dp=[INFI for i in range(h+1)]
    dp[0]=0
    for i in range(n):
        for j in range(len(dp)):
            if j-a[i]<0:
                dp[j] = min(dp[j], dp[0] + b[i])
            else:
                dp[j]=min(dp[j],dp[j-a[i]]+b[i])
 
    print(dp[h])
 
 
if __name__ == "__main__":
    main()
### BUGGY CODE ###

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

s=""
for i in range(N):
    for j in range(N):
        if A[j]==i+1:
            s+="{} ".format(j+1)
            break
print(s)



### FIXED CODE ###

from operator import itemgetter

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

print(*[t[0] + 1 for t in sorted(enumerate(A), key=itemgetter(1))])
### BUGGY CODE ###

import sys
args = sys.stdin.readlines()
n, m = map(int, args[0].split(' '))
gates = []
for gate in args[1:]:
  l, r = map(int, gate.split(' '))
  gates.append((l, r))
  
ids = range(1, n+1)
for gate in gates:
  l, r = gate
  ids = [x for x in ids if x in range(l, r+1)]
  
print(len(ids))


### FIXED CODE ###

import sys
args = sys.stdin.readlines()
n, m = map(int, args[0].split(' '))
l_1 = 1
r_1 = n

for gate in args[1:]:
  l, r = map(int, gate.split(' '))  
  if l > l_1:
    l_1 = l
  if r < r_1:
    r_1 = r

ids = r_1 - l_1 + 1
if ids < 0:
  print(0)
else:
  print(ids)
### BUGGY CODE ###

import decimal


def main():
    N, K = map(int, input().split())
    ans = 0
    for n in range(1, N + 1):
        s = 0
        s += n
        c = 1
        while K > s:
            s *= 2
            c /= 2
        ans += decimal.Decimal((1 / N) * c)
    print(ans)


main()


### FIXED CODE ###

import decimal
 
 
def main():
    N, K = map(int, input().split())
    ans = 0
    for n in range(1, N + 1):
        s = 0
        s += n
        c = 0
        while K > s:
            s *= 2
            c += 1
        ans += decimal.Decimal((1 / N) * (1 / 2) ** c)
    print(ans)
 
 
main()
### BUGGY CODE ###

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

counter = 0
for i in range(len(lis)):
    counter += 1*(lis[i] <= min(lis[:i+1]))
print(counter )

### FIXED CODE ###

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

counter=0
minimum = 10000000
for i in range(N):
    minimum = min([minimum,lis[i]])
    counter += int(lis[i] <= minimum)
print(counter)
### BUGGY CODE ###

# D - Knapsack Queries on a tree

from sys import stdin
import bisect

readline = stdin.readline

n = int(readline())

v = [0] * n
w = [0] * n
for i in range(n):
    v[i], w[i] = map(int, readline().split())

max_l = 10 ** 5
INF = float('inf')

# dp table (for some amount)
dp = [None] * min(n, 2 ** 14)

# dp[vertex] = list of (weight, value)
dp[0] = [(0, 0), (w[0], v[0])]

for u in range(1, len(dp)):
    parent = (u - 1) // 2

    dp[u] = dp[parent].copy()
    for ww, vv in dp[parent]:
        dp[u].append((ww + w[u], vv + v[u]))
    dp[u].sort()

    # remove unnecessary entries
    tail = 0
    for i in range(1, len(dp[u])):
        if dp[u][i][0] > max_l:
            break
        if dp[u][tail][0] == dp[u][i][0]:
            dp[u][tail] = dp[u][i]
        elif dp[u][tail][1] < dp[u][i][1]:
            tail += 1
            dp[u][tail] = dp[u][i]
    del dp[u][tail + 1:]

def solve(u, l):
    if u < len(dp):
        x = bisect.bisect_right(dp[u], (l, INF)) - 1
        return dp[u][x][1]

    parent = (u - 1) // 2
    s = solve(parent, l)
    if l >= w[u]:
        s = max(s, v[u] + solve(parent, l - w[u]))
    return s

q = int(readline())
for i in range(q):
    u, l = map(int, readline().split())
    print(solve(u - 1, l))


### FIXED CODE ###

# D - Knapsack Queries on a tree

from sys import stdin
import bisect

readline = stdin.readline
bisect_right = bisect.bisect_right

n = int(readline())

v = [0] * n
w = [0] * n
for i in range(n):
    v[i], w[i] = map(int, readline().split())

max_l = 10 ** 5
vshift = 21
mask = (1 << vshift) - 1

# dp table (for some amount)
dp = [None] * min(n, 2 ** 12)

# dp[vertex] = list of (weight, value)
dp[0] = [(0 << vshift) + 0, (w[0] << vshift) + v[0]]

for u in range(1, len(dp)):
    parent = (u - 1) // 2

    ls = dp[parent][:]
    ls.extend(x + (w[u] << vshift) + v[u] for x in dp[parent]
              if (x >> vshift) + w[u] <= max_l)
    ls.sort()

    # remove unnecessary entries
    tail = 0
    for i in range(1, len(ls)):
        if (ls[tail] >> vshift) == (ls[i] >> vshift):
            ls[tail] = ls[i]
        elif (ls[tail] & mask) < (ls[i] & mask):
            tail += 1
            ls[tail] = ls[i]
    del ls[tail + 1:]
    dp[u] = ls

def solve(u, l):
    if u < len(dp):
        x = bisect_right(dp[u], (l << vshift) + mask) - 1
        return dp[u][x] & mask

    parent = (u - 1) // 2
    s = solve(parent, l)
    if l >= w[u]:
        s = max(s, v[u] + solve(parent, l - w[u]))
    return s

q = int(readline())
for i in range(q):
    u, l = map(int, readline().split())
    print(solve(u - 1, l))
### BUGGY CODE ###

import sys
from collections import deque

input = sys.stdin.readline

def main():
    N = int(input())
    visited = [False] * N
    E = [deque() for i in range(N)]
    nums = [set() for i in range(N)] 
    ans = [None] * (N-1)
    
    for i in range(N-1):
        a, b = map(int, input().split())
        E[a-1].append((b-1, i))
        E[b-1].append((a-1, i))
        
    ans_ = max([len(e) for e in E])
    G = set(i for i in range(ans_))
    
    q = deque([0])
    
    while q:
        v = q.popleft()
        
        if visited[v]: continue
    
        visited[v] = True
        
        use_nums = deque(list(G - nums[v]))
        for u, idx in E[v]:
            if visited[u]: continue
            
            n = use_nums.popleft()
            ans[idx] = str(n+1)
            nums[u].add(n)
            q.append(u)
            
    print(ans_)
    print('\n'.join(ans))

if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*

import sys

input = sys.stdin.readline

def main():
    N = int(input())
    
    G = [[] for i in range(N)]
    ans = [None] * (N-1)
    
    for i in range(N-1):
        a, b = map(int, input().split())
        a, b = a-1, b-1
        
        G[a].append((b, i))
        G[b].append((a, i))
        
    q = [(0, -1)]
    
    visited = [False] * N
    cur = 0
    
    while q and cur < N:
        v, c = q.pop(0)
    
        if visited[v]: continue
        visited[v] = True
        cur += 1
        
        k = 0
        for u, idx in G[v]:
            if visited[u]: continue
            if c == k: k += 1
            
            ans[idx] = k
            q.append((u, k))
            k += 1
            
    print(max(ans)+1)
    for a in ans: print(a+1)
     
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import itertools


def main():
    _ = int(input())
    L = list(map(int, input().split()))

    comb = itertools.combinations(L, 3)

    ans = 0
    for v in comb:
        if v[0] < v[1] + v[2] and v[1] < v[2] + v[0] and v[2] < v[0] + v[1]:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import bisect


def main():
    N = int(input())
    L = list(map(int, input().split()))
    L.sort()

    ans = 0
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            index = bisect.bisect_left(L, L[i] + L[j]) - j - 1
            ans += index

    print(ans)


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

import heapq
def A():
    H, W = map(int, input().split())
    maze = []
    for i in range(H):
        maze.append(input())
    if maze[0][0] == '.':
        q = [[0, (0, 0)]]
    else:
        q = [[1, (0, 0)]]
    heapq.heapify(q)
    while q:
        #print(q)
        cost, cur = heapq.heappop(q)
        if cur[0] == H-1 and cur[1] == W-1:
            print(cost)
            return
        for direction in [(0, 1), (1, 0)]:
            new_r, new_c = cur[0]+direction[0], cur[1]+direction[1]
            if new_r >= 0 and new_c >= 0 and new_r < H and new_c < W:
                if maze[new_r][new_c]=='.':
                    heapq.heappush(q, [cost, (new_r, new_c)])
                else:
                    heapq.heappush(q, [cost+1, (new_r, new_c)])

A()

### FIXED CODE ###

import heapq
def A():
    H, W = map(int, input().split())
    maze = []
    for i in range(H):
        maze.append(input())
    # if maze[0][0] == '.':
    #     q = [[0, (0, 0)]]
    # else:
    #     q = [[1, (0, 0)]]
    # heapq.heapify(q)
    # while q:
    #     #print(q)
    #     cost, cur = heapq.heappop(q)
    #     if cur[0] == H-1 and cur[1] == W-1:
    #         print(cost)
    #         return
    #     for direction in [(0, 1), (1, 0)]:
    #         new_r, new_c = cur[0]+direction[0], cur[1]+direction[1]
    #         if new_r >= 0 and new_c >= 0 and new_r < H and new_c < W:
    #             if maze[new_r][new_c]=='.':
    #                 heapq.heappush(q, [cost, (new_r, new_c)])
    #             else:
    #                 heapq.heappush(q, [cost+1, (new_r, new_c)])
    memo = [[float('inf') for i in range(W)] for j in range(H)]
    # if maze[H-1][W-1] == '.':
    #     memo[H-1][W-1] = 0
    # else:
    #     memo[H-1][W-1] = 1
    # def dfs(r, c, prev_flipped):
    #     if memo[r][c] < float('inf'):
    #         return memo[r][c]
    #     cur_flipped = False
    #     if maze[r][c] == '.':
    #         cur_cost = 0
    #     else:
    #         if prev_flipped:
    #             cur_cost = 0
    #         else:
    #             cur_cost = 1
    #         cur_flipped = True
    #     minimum_next = float('inf')
    #     if r+1 < H:
    #         minimum_next = dfs(r+1, c, cur_flipped)
    #     if c+1 < W:
    #         minimum_next = min(minimum_next, dfs(r, c+1, cur_flipped))
    #     res = cur_cost+minimum_next
    #     memo[r][c] = res
    #     return res
    # print(dfs(0, 0, False))
    if maze[0][0] == '.':
        memo[0][0] = 0
    else:
        memo[0][0] = 1
    for i in range(H):
        for j in range(W):
            for r, c in [(i+1, j), (i, j+1)]:
                if r<H and c<W:
                    if maze[i][j] == '.' and maze[r][c] == '#':
                        temp = 1
                    else:
                        temp = 0
                    memo[r][c] = min(memo[r][c], memo[i][j]+temp)
    print(memo[-1][-1])

A()
### BUGGY CODE ###

n, k = map(int, input().split())
nums = list(map(int, input().split()))

sum_max = 0
for i in range(n):
  if i+k <= n:
    sum_max = max(sum_max, sum(nums[i:i+k]))

max_e = (sum_max +k)/2

print(max_e)


### FIXED CODE ###

n, k = map(int, input().split())
nums = list(map(int, input().split()))
 
sum_max = sum(nums[:k])
temp = sum_max
for i in range(k,n):
  temp -= nums[i-k]
  temp += nums[i]
  sum_max = max(temp, sum_max)
print((sum_max +k)/2)
### BUGGY CODE ###

import heapq

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

c = 1
hh = 0
X = []
for i in range(N):
	for j in range(M):
		if A[i] != B[j]:
			heapq.heappush(X, min(A[i], B[j]))
			hh += 1

a = A[0]
for i in range(N - 1):
	if A[i + 1] == a:
		c = 0
		break
	a = A[i + 1]

b = B[0]
for i in range(M - 1):
	if B[i + 1] == b:
		c = 0
		break
	b = B[i + 1]

AA = []
BB = []
CC = []

for i in range(N):
	if A[i] in B:
		CC.append(A[i])
		B.remove(A[i])
	else:
		AA.append(A[i])

BB = B

xB = sorted(BB + CC)
xA = sorted(AA + CC)

for i in range(len(AA)):
	cc = 0
	for j in range(len(xB)):
		if xB[-1 - j] <= AA[i]:
			break
		else:
			cc += 1
	c = c * cc

for i in range(len(BB)):
	cc = 0
	for j in range(len(xA)):
		if xA[-1 - j] <= BB[i]:
			break
		else:
			cc += 1
	c = (c * cc) % 1000000007




if c != 0:
	if X != []:
		x = 0
	m = 0
	cnt = 0
	for i in range(hh):
		zzz = heapq.heappop(X)
		j = "G"
		if AA != []:
			if zzz == AA[0]:
				AA.remove(zzz)
				j = "N"
		if BB != []:
			if zzz == BB[0]:
				BB.remove(zzz)
				j = "N"

		if j == "G":
			if zzz != x:
				m += 1
			c = (c * (zzz - cnt - m)) % 1000000007
			cnt += 1
			x = zzz

print(c)

### FIXED CODE ###

import heapq
from collections import defaultdict

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

D = defaultdict(int)
c = 1
hh = 0
for i in range(N):
	for j in range(M):
		if A[i] != B[j]:
			d = min(A[i], B[j])
			D[d] += 1
			hh += 1

ds = sorted(D.items())
X = []
for i in range(len(ds)):
	X += [ds[i][0]] * ds[i][1]


a = A[0]
for i in range(N - 1):
	if A[i + 1] == a:
		c = 0
		break
	a = A[i + 1]

b = B[0]
for i in range(M - 1):
	if B[i + 1] == b:
		c = 0
		break
	b = B[i + 1]

AA = []
BB = []
CC = []

for i in range(N):
	if A[i] in B:
		CC.append(A[i])
		B.remove(A[i])
	else:
		AA.append(A[i])

BB = B

xB = sorted(BB + CC)
xA = sorted(AA + CC)

for i in range(len(AA)):
	cc = 0
	for j in range(len(xB)):
		if xB[-1 - j] <= AA[i]:
			break
		else:
			cc += 1
	c = c * cc

for i in range(len(BB)):
	cc = 0
	for j in range(len(xA)):
		if xA[-1 - j] <= BB[i]:
			break
		else:
			cc += 1
	c = (c * cc) % 1000000007

if c != 0:
	if X != []:
		x = 0
	m = 0
	cnt = 0
	for i in range(hh):
		zzz = X[i]
		j = "G"
		if AA != []:
			if zzz == AA[0]:
				AA.remove(zzz)
				j = "N"
		if BB != []:
			if zzz == BB[0]:
				BB.remove(zzz)
				j = "N"

		if j == "G":
			if zzz != x:
				m += 1
			c = (c * (zzz - cnt - m)) % 1000000007
			cnt += 1
			x = zzz

print(c)
### BUGGY CODE ###

n = input()
n = int(n)

price_list = []

x = input()
x = int(x)

price_list.append(x)

max_profit_candidate = 1 - 10**9

for i in range(n - 1):
    x = input()
    x = int(x)
    diff = x - min(price_list)
    if diff > max_profit_candidate:
        max_profit_candidate = diff
    price_list.append(x)

print(max_profit_candidate)

### FIXED CODE ###

n = input()
n = int(n)

x = input()
x = int(x)

present_min_value = x
max_profit_candidate = 1 - 10**9

for i in range(n - 1):
    a = input()
    a = int(a)
    diff = a - present_min_value
    if diff > max_profit_candidate:
        max_profit_candidate = diff
    if a < present_min_value:
        present_min_value = a

print(max_profit_candidate)
### BUGGY CODE ###

n=int(input())
s=[]

for i in range(n):
    a=str(input())
    if a in s:
        s.remove(a)
    else:
        s.append(a)

print(len(s))



### FIXED CODE ###

n=int(input())
s=set()
for i in range(n):
    a=int(input())
    if a in s:
        s.remove(a)
    else:
        s.add(a)
print(len(s))
### BUGGY CODE ###

c = input()
n = int(input())

for _ in range(n):
  now = list(input().split())
  if now[0] == "1":
    c = c[::-1]
  else:
    if now[1] == "1":
      c = now[2] + c
    else:
      c = c + now[2]
      
print(c)

### FIXED CODE ###

from collections import deque

c = deque(input())
n = int(input())
head = 1

for _ in range(n):
  now = list(input().split())
  if now[0] == "1":
    head *= -1
  else:
    if now[1] == "1":
      if head == 1:
        c.appendleft(now[2])
      else:
        c.append(now[2])
    else:
      if head == 1:
        c.append(now[2])
      else:
        c.appendleft(now[2])
print("".join(c) if head == 1 else "".join([c.pop() for _ in range(len(c))]))
### BUGGY CODE ###

from collections import deque
n,m,k=map(int,input().split())
fr=[[]]
bl=[[]]
for i in range(n-1):
  fr.append([])
  bl.append([])
for i in range(m):
  a,b=map(int,input().split())
  fr[a-1].append(b)
  fr[b-1].append(a)
for i in range(k):
  a,b=map(int,input().split())
  bl[a-1].append(b)
  bl[b-1].append(a)

def bfs(k):
  use=deque()
  use.append(k)
  ans=0
  aldic={}
  for i in range(0,10**100):
    if not bool(use):
      if k!=n:
        print(ans-len(fr[k-1])-1,end=" ")
      else:
        print(ans-len(fr[k-1])-1)
      break
    else:
      check=use.popleft()
      if not check in aldic:
        aldic[check]=1
        for x in fr[check-1]:
            use.append(x)
        if not check in bl[k-1]:
          ans+=1
for i in range(1,n+1):
  bfs(i)

### FIXED CODE ###

from collections import deque
n,m,k=map(int,input().split())
fr=[[]]
for i in range(n-1):
  fr.append([])
for i in range(m):
  a,b=map(int,input().split())
  fr[a-1].append(b)
  fr[b-1].append(a)

belong=[0]*n
anslist=[0]*n
count=0
def bfs(k):
  global count
  if belong[k-1]==0:
    count+=1
    use=deque()
    use.append(k)
    ans=0
    aldic={}
    while use:
      if not bool(use):
        break
      else:
        check=use.popleft()
        if check not in aldic:
          aldic[check]=1
          for x in fr[check-1]:
            use.append(x)
    for x in aldic:
      belong[x-1]=count
      anslist[x-1]=len(aldic)-len(fr[x-1])-1

for i in range(1,n+1):
  bfs(i)
for i in range(k):
  a,b=map(int,input().split())
  if belong[a-1]==belong[b-1]:
    anslist[a-1]-=1
    anslist[b-1]-=1
for i in range(0,len(anslist)):
  if i!=len(anslist)-1:
    print(anslist[i],end=" ")
  else:
    print(anslist[i])
### BUGGY CODE ###

def prime_factorization(m: int) -> dict:
    """
    素因数分解
    """
    if m == 1:
        return {1: 1}

    pf = {}
    if m % 2 == 0:
        while m % 2 == 0:
            m //= 2
            pf[2] = pf.get(2, 0) + 1
    p = 3
    while p * p <= m:
        if m % p == 0:
            m //= p
            pf[p] = pf.get(p, 0) + 1
        else:
            p += 2
    if m != 1:
        pf[m] = pf.get(m, 0) + 1
        
    return pf

def get_all_cd(m: int) -> list:    
    """
    全ての約数を探す
    """ 
    def find_cd(m, i, pf_lst, cd_lst):
        """
        割れるかどうかの確認
        """
        if m % i != 0:
            return
        else:
            m //= i
            if m in cd_lst:
                return
            else:
                cd_lst.append(m)
                for i in pf_lst:
                    find_cd(m, i, pf_lst, cd_lst)

    pf = prime_factorization(m)
    cd_lst = [m]
    for i in pf.keys():        
        find_cd(m, i, pf.keys(), cd_lst)    

    return sorted(cd_lst)

A, B = [int(i) for i in input().split()]

s_lst = set(get_all_cd(A)) & set(get_all_cd(B))
ans_lst = [1]
for i in s_lst:
    if i == 1:
        continue
    p = get_all_cd(i)
    if len(p) == 2:
        ans_lst.append(p[1])
        
print(len(ans_lst))

### FIXED CODE ###

from fractions import gcd

A, B = [int(i) for i in input().split()]

m = gcd(A, B)
pf = []
for i in range(2, m+1):
    if i ** 2 > m:
        break
    if m % i == 0:
        pf.append(i)
    while m % i == 0:
        m //= i
if m != 1:
    pf.append(m)
    
print(len(pf) + 1)
### BUGGY CODE ###

n, k ,q = list(map(int, input().split()))
li = [input() for i in range(q)]
list = []
for j in range(1,n+1):
    if li.count(str(j)) > q - k:
        list.append('Yes')
    else:
        list.append('No')
[print(x) for x in list]


### FIXED CODE ###

n, k ,q = list(map(int, input().split()))
listAns = [input() for i in range(q)]
score = [0] * n
count = 0
for j in listAns:
    score[int(j) - 1] += 1
for h in score:
    if h > q - k:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
mod = 10**9+7
DP = [0] * (N + 2)
DP[0] = 1
for i in range(0, N):
  if i in A:
    continue
  if not i + 1 in A:
    DP[i + 1] += DP[i]
  if not i + 2 in A:
    DP[i + 2] += DP[i]

print(DP[N]%mod)

### FIXED CODE ###

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

ans = [0 for i in range(N + 1)]
ans[0] = 1

ok = sorted(set(i for i in range(1, N + 1)) - set(A))

for i in ok:
  if i == 1:
    ans[i] = 1
  else:
    ans[i] = ans[i - 2] + ans[i - 1]
print(ans[-1]%(10**9+7))
### BUGGY CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
    b = a.index(max(a))
    a[b] = a[b] // 2
print(sum(a))


### FIXED CODE ###

import heapq

n, m = map(int, input().split())
a = [-int(i) for i in input().split()]
heapq.heapify(a)
for i in range(m):
    b = heapq.heappop(a)//(-2)
    heapq.heappush(a,-b)
print(-sum(a))
### BUGGY CODE ###


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

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a


def lcm(a,b):
    return a*b//gcd(a,b)

MOD = 10**9+7
ans = 0
t = 1
for i in l:
    t = lcm(t,i)

for i in l:
    ans +=t//i
    ans %=MOD
print(ans)

### FIXED CODE ###

def main():
    from fractions import gcd
    a = int(input())
    l = list(map(int,input().split()))



    def lcm(a,b):
        return a*b//gcd(a,b)
    A= 1
    MOD = 10**9+7
    ans = 0
    t = 1
    for i in l:
        t = t* i //gcd(t,i)
    for i in l:
        ans +=t//i
    ans %=MOD
    print(ans)
main()