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

# -*- coding: utf-8 -*-

# 入力された文字列
string = input()

# 最大処理数。100000以下なら文字列長。
max = min(len(string), 100000)

raw_length = len(string)

# 削除があった場合True
del_flg = True

# 削除文字がなくなるまでループする
while del_flg:
    del_flg = False
    target = ['01', '11']
    before_length = len(string)
    string = string.replace('01', '').replace('10', '')
    after_length = len(string)
    
    if before_length != after_length:
        del_flg = True

print((raw_length - len(string)))

### FIXED CODE ###

# -*- coding: utf-8 -*-

string = input()

red_count  = string.count('0')
blue_count = string.count('1')

print(min(red_count, blue_count) * 2)
### BUGGY CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N = NI()
    dq = [LI() for _ in range(N)]
    p = [0] * N
    ans = 0
    cnt = 0
    while cnt < N*(N-1)//2:
        ud = False
        used = [False] * N
        for i in range(N):
            if used[i] or p[i] >= N-1: continue

            j = dq[i][p[i]]-1
            if dq[j][p[j]]-1 == i and not used[j]:
                used[i] = used[j] = True
                p[i] += 1; p[j] += 1
                cnt += 1
                ud = True
        if ud:
            ans += 1
            continue
        else:
            print(-1)
            return
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N = NI()
    dq = [LI() for _ in range(N)]
    p = [0] * N
    cnt = 0
    c = [0] * N
    while cnt < N*(N-1)//2:
        ud = False
        for i in range(N):

            while p[i] < N-1:
                j = dq[i][p[i]]-1
                if dq[j][p[j]]-1 == i:
                    c[i] = c[j] = max(c[i],c[j]) + 1
                    p[i] += 1; p[j] += 1
                    cnt += 1
                    ud = True
                else:
                    break
        if ud:
            continue
        else:
            print(-1)
            return
    print(max(c))

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

import functools

n=int(input())
a=list(map(int,input().split()))
m=10**9+7
def euclid(a, b):
    while b:
        a, b = b, a%b
    return a

def multiple(a, b):
    return a*b // euclid(a, b)

def lcm(nums):
        return functools.reduce(multiple, nums)

def main():
  x=lcm(a)
  ans=0

  for i in range(n):
    ans+=(x//a[i])%m
    ans%=m

  print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

import functools
MOD=10**9+7
def euclid(a, b):
  if b == 0:
    return a
  else:
    return euclid(b, a%b)

def multiple(a, b):
  return a*b // euclid(a, b)

def lcm(nums):
  return functools.reduce(multiple, nums)
n=int(input())
a=list(map(int,input().split()))
x=lcm(a)
sum=0
for i in range(n):
    sum+=x//a[i]
print(sum%MOD)
### BUGGY CODE ###

#068-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
import numpy as np
n,m=IL()
nm=[[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a,b=IL()
    nm[a-1][b-1]=1
    nm[b-1][a-1]=1
nm=np.array(nm)
nm=nm.dot(nm)
if nm[0][n-1]==0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

### FIXED CODE ###

#068-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()

n,m=IL()
nl=[[] for i in range(n)]
for i in range(m):
    a,b=IL()
    nl[a-1].append(b-1)
for i in nl[0]:
    if n-1 in nl[i]:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")
### BUGGY CODE ###

from sys import stdin
from collections import defaultdict 
# from bisect import *
# from heapq import *
# import math
# mod = 10**9+7

def primes(n):
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1, int(n**0.5)//3+1):
        if sieve[i]:
            k = 3*i+1|1
            sieve[k*k//3::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
            sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2, 3] + [3*i+1|1 for i in range(1, n//3-correction) if sieve[i]]

N = input()
A = list(map(int, input().split()))
dic = defaultdict(lambda : False)
ps = primes(10**6+1)
flg = True
for p in ps:
    for a in A:
        if a % p == 0:
            if dic[p]:
                flg = False
                break
            dic[p] = True
    if not flg:
        break
if flg:
    print("pairwise coprime")
    exit()
gcd = lambda x, y : x if y == 0 else gcd(y, x % y)
x = A[0]
for a in A[1:]:
    x = gcd(x, a)
if x == 1:
    print("setwise coprime")
else:
    print("not coprime")

### FIXED CODE ###

from sys import stdin
from collections import defaultdict 
# from bisect import *
# from heapq import *
# import math
# mod = 10**9+7

N = input()
A = list(map(int, input().split()))
M = 10**6+1
spf = [i for i in range(M)]
for i in range(2, M):
    if spf[i] == i:
        for j in range(i+i, M, i):
            spf[j] = i
cnt = defaultdict(int)
for a in A:
    ps = set()
    while a != 1:
        ps.add(spf[a])
        a = a // spf[a]
    for p in ps:
        cnt[p] += 1
if all([x < 2 for x in cnt.values()]):
    print("pairwise coprime")
    exit()
gcd = lambda x, y : x if y == 0 else gcd(y, x % y)
x = A[0]
for a in A[1:]:
    x = gcd(x, a)
if x == 1:
    print("setwise coprime")
else:
    print("not coprime")
### BUGGY CODE ###

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

x = [0] * M
y = [0] * M
T = [0] * N
for i in range(M):
    x[i], y[i] = map(int, input().split())

for i in range(M):
    MAX=max(A[x[i]-1],A[y[i]-1])
    if MAX==A[x[i]-1]:
        T[x[i]-1]+=1
        T[y[i]-1]=-1
    else:
        T[y[i]-1]+=1
        T[x[i]-1]=-1
    for j in range(M):
            MIN=min(A[x[j]-1],A[y[j]-1])
            if MAX==MIN:
                if MAX==A[x[i]-1]:
                    T[x[i]-1]=-1
                else:
                    T[y[i]-1]=-1

sum=0
for i in range(N):
    if T[i]>=0:
        sum+=1

print(sum)


### FIXED CODE ###

N,M = map(int,input().split())
H = list(map(int,input().split()))
notwinner = []
for i in range(M):
    ab = list(map(int,input().split()))
    if H[ab[0]-1] > H[ab[1]-1]:
        notwinner.append(ab[1])
    elif H[ab[0]-1] < H[ab[1]-1]:
        notwinner.append(ab[0])
    else:
        notwinner.append(ab[0])
        notwinner.append(ab[1])
wtou = N - len(set(notwinner))#set()で重複する要素を含まない要素にしてlenで数える
print(wtou)
### BUGGY CODE ###

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

for i in range(N):
    ans*= A[i]

if ans > 10**18:
    ans = -1



print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit()
ans = 1

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()

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

N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

dp = [[-1]*11 for i in range(N)]
mark = {}
Q = int(input())
col = [0]*(Q+1)
col[-1] = 0
C = []
for i in range(Q):
    v, d, c = map(int, input().split())
    col[i] = c
    C.append((v-1, d))

def dfs(v, d, idx):
    if idx < dp[v][d]:
        return
    dp[v][d] = idx
    if d:
        for w in G[v]:
            dfs(w, d-1, idx)

for i in range(Q-1, -1, -1):
    v, d = C[i]
    dfs(v, d, i)
print(*(col[max(e for e in dp[i])] for i in range(N)), sep='\n')


### FIXED CODE ###

N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

dp = [{-1: -1} for i in range(N)]
mark = {}
Q = int(input())
col = [0]*(Q+1)
col[-1] = 0
C = []
for i in range(Q):
    v, d, c = map(int, input().split())
    col[i] = c
    C.append((v-1, d))

def dfs(v, d, idx):
    if d <= max(dp[v]):
        return
    dp[v][d] = idx
    if d:
        for w in G[v]:
            dfs(w, d-1, idx)

for i in range(Q-1, -1, -1):
    v, d = C[i]
    dfs(v, d, i)
print(*(col[max(e.values())] for e in dp), sep='\n')
### BUGGY CODE ###

def resolve():
    n = int(input())
    s = input()
    for i in range(n//2, 0, -1):
      for j in range(n-i):
        if s[j:j+i] in s[j+i:]:
          print(i)
          return
    print(0)


if __name__ == '__main__':
    resolve()

### FIXED CODE ###

def z_algo(S):
    N = len(S)
    A = [0] * N
    i = 1
    j = 0
    A[0] = l = len(S)
    while i < l:
        while i + j < l and S[j] == S[i + j]:
            j += 1
        if not j:
            i += 1
            continue
        A[i] = j
        k = 1
        while l-i > k < j - A[k]:
            A[i + k] = A[k]
            k += 1
        i += k
        j -= k
    return A


def resolve():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n):
        a = z_algo(s[i:])
        for index, j in enumerate(a):
            if j <= index:
                ans = max(ans, j)
    print(ans)


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

n = int(input())
a = list(int(x) for x in input().split())
x = 0
for i in range(n):
    if a.count(a[0]) != 1:
        print("NO")
        x = 1
        break
    a.pop(0)

if x == 0:
    print("YES")


### FIXED CODE ###

n = int(input())
a = list(int(x) for x in input().split())
x = 0
 
a.sort()
for i in range(n-1):
    if a[-1] - a[-2] == 0:
        print("NO")
        x = 1
        break
    a.pop()
 
if x == 0:
    print("YES")
### BUGGY CODE ###

#ループ回数をansにインクリメントして保管

def main():
  h,w=map(int,input().split()) 
  mp=[list(input()) for _ in range(h)]
  global dist
  dist=[[-1]*w for i in range(h)]
  
  q=[]
  for i in range(h):
    for j in range(w):
      if mp[i][j]=="#":
        dist[i][j]=0
        q.append((i,j))
      else:
        dist[i][j]=-1
  
  ans=0     
  while q:
    qq=[] #new_list qq
    for (x,y) in q:
      for i,j in ((0,1),(0,-1),(1,0),(-1,0)):
        xx,yy=x+i,y+j
        if 0<=xx<h and 0<=yy<w and dist[xx][yy]==-1:
          dist[xx][yy]="done"
          qq.append((xx,yy))
    q=qq #qと置き換え
    ans+=1        
  print(ans-1) #ラスト無駄に一回足してる分｡
  return

main()

### FIXED CODE ###

#copipe
#1次元で格納

def main():
    h,w = map(int,input().split())
    a = []
    for i in range(h):
        a.append(input())

    used = [True]*(h*w)

    p = []
    for i in range(h):
        for j in range(w):
            if a[i][j] == '#':
                p.append(i*w+j)
                used[i*w+j] = False


    
    res = 0
    while p:
        tank = []
        for e in p:
            if e>w-1 and used[e-w]:
                tank.append(e-w)
                used[e-w] = False
            if e%w > 0 and used[e-1]:
                tank.append(e-1)
                used[e-1] = False
            if e<(h-1)*w and used[e+w]:
                tank.append(e+w)
                used[e+w] = False
            if e%w<w-1 and used[e+1]:
                tank.append(e+1)
                used[e+1] =  False
        p = tank
        res += 1
    print(res-1)

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

S = input()
A = list(S)
ans = 1
pr = A[0:1]
del A[0]
while len(A) >= 3:
    if len(pr) == 2:
        pr = A[0:1]
        del A[0]
        ans += 1
        continue
    if pr == A[0:1]:
        pr = A[0:2]
        del A[0:2]
        ans += 1
    else:
        pr = A[0:1]
        del A[0]
        ans += 1
if len(A) == 1:
    ans += 1
else:
    if pr == A[0:1]:
        ans += 1
    elif A[0] == A[1]:
        ans += 1
    else:
        ans += 2
print(ans)

### FIXED CODE ###

S = input()
A = tuple(S)
N = len(A)
ans = 1
ind = 1
pr = A[0:1]
while ind <= N - 3:
    if len(pr) == 2:
        pr = A[ind:ind + 1]
        ans += 1
        ind += 1
        continue
    if pr == A[ind:ind + 1]:
        pr = A[ind:ind + 2]
        ans += 1
        ind += 2
    else:
        pr = A[ind:ind + 1]
        ans += 1
        ind += 1
if N <= 2:

    if N == 1:
        ans = 1
    else:
        if A[0] == A[1]:
            ans = 1
        else:
            ans = 2
elif ind == N - 1:
    ans += 1

else:
    if pr == A[-2:] or pr == A[-2:-1]:
        ans += 1
    elif A[-2] == A[-1]:
        ans += 1
    else:
        ans += 2
print(ans)
### BUGGY CODE ###

def main():
  import sys
  from heapq import heappush, heappop, heapify
  _int = int
  n = _int(input())
  a = [_int(e) for e in input().split()]
  b = [_int(e) for e in input().split()]
  result = 0
  finished = 0
  hq = [(-b[i], i) for i in range(n)]
  heapify(hq)
  while True:
    _, i = heappop(hq)
    if a[i] == b[i]:
      finished += 1
      continue
    if i == 0:
      b[i] -= b[n - 1] + b[1]
    elif i == n - 1:
      b[i] -= b[n - 2] + b[0]
    else:
      b[i] -= b[i - 1] + b[i + 1]
    if a[i] > b[i]:
      print(-1)
      sys.exit()
    result += 1
    if a[i] == b[i]:
      finished += 1
      if finished == n:
        print(result)
        sys.exit()
    else:
      heappush(hq, (-b[i], i))
main()

### FIXED CODE ###

def main():
  import sys
  _int = int
  n = _int(input())
  a = [_int(e) for e in input().split()]
  b = [_int(e) for e in input().split()]
  result = 0
  q = [i for i in range(n) if b[i] != a[i]]
  while len(q) != 0:
    nq = []
    c = 0
    for i in q:
      if i == 0 or i == n - 1:
        j = b[(n + i - 1) % n] + b[(n + i + 1) % n]
      else:
        j = b[i - 1] + b[i + 1]
      if j > b[i] - a[i]:
        nq.append(i)
        continue
      c += 1
      k = (b[i] - a[i]) // j
      result += k
      b[i] -= j * k
      if a[i] != b[i]:
        nq.append(i)
    if c == 0 and len(nq) != 0:
      print(-1)
      sys.exit()
    q = nq
  print(result)
main()
### BUGGY CODE ###

n = int(input())
A = list(map(int,input().split()))
l = []
for i in range(min(A),max(A)+1):
  cnt = 0
  if i in A:
    cnt += A.count(i)
  if i-1 in A:
    cnt += A.count(i-1)
  if i+1 in A:
    cnt += A.count(i+1)
  l.append(cnt)  
print(max(l))
  

### FIXED CODE ###

n = int(input())
cnt = [0] * 100002
a = list(map(int, input().split()))
for v in a:
    cnt[v] += 1
    cnt[v+1] += 1
    cnt[v+2] += 1
    
print(max(cnt))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import deque
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

H,W,K=map(int,input().split())
sy,sx,gy,gx=map(int,input().split())
st=sx+sy*(W+2)
gl=gx+gy*(W+2)
c=['@']*(W+2)
for i in range(H):
    c.extend(['@']+list(input())+['@'])
c.extend(['@']*(W+2))
que=deque()
d=[INF]*(W+2)*(H+2)
direction=[[0]*4 for _ in range((H+2)*(W+2))]
que.append(st)
d[st]=0
di=(-1,1,W+2,-(W+2))
while que:
    v=que.popleft()
    for k in range(4):
        nv=v+di[k]
        if c[nv]=='.':
            if direction[v][k]>0:
                if d[nv]>d[v]:
                    direction[nv]=[0]*4
                    direction[nv][k]=direction[v][k]-1
                    direction[v][k]=0
                    d[nv]=d[v]
                    que.append(nv)
                elif d[nv]==d[v]:
                    direction[v][k]=0
                    direction[nv][k]=direction[v][k]-1
            else:
                if d[nv]>d[v]+1:
                    direction[nv]=[0]*4
                    direction[nv][k]=K-1
                    direction[v][k]=0
                    d[nv]=d[v]+1
                    que.append(nv)
                elif d[nv]==d[v]+1:
                    direction[v][k]=0
                    direction[nv][k]=K-1
print(d[gl] if d[gl]!=INF else -1)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import deque
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

H,W,K=map(int,input().split())
sy,sx,gy,gx=map(int,input().split())
st=sx+sy*(W+2)
gl=gx+gy*(W+2)
c=['@']*(W+2)
for i in range(H):
    c.extend(['@']+list(input())+['@'])
c.extend(['@']*(W+2))
que=deque()
dist=[INF]*(W+2)*(H+2)
que.append(st)
dist[st]=0
d=(-1,1,W+2,-(W+2))
while que:
    v=que.popleft()
    for k in range(4):
        nv=v
        for _ in range(K):
            nv+=+d[k]
            if c[nv]=='.' and dist[nv]>dist[v]:
                if dist[nv]==INF:
                    dist[nv]=dist[v]+1
                    que.append(nv)
            else:
                break
print(dist[gl] if dist[gl]!=INF else -1)
### BUGGY CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = [float('inf')]*N
ans[0] = 0
K = min(N-1,K)
for i in range(1,K+1):
  ans[i] = abs(A[0]-A[i])

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

### FIXED CODE ###

import numpy as np
N,K = map(int,input().split())
A = list(map(int,input().split()))
A = np.array(A)
ans = np.array([float('inf')]*N)
ans[0] = 0
K = min(N-1,K)
for i in range(1,K+1):
  ans[i] = abs(A[0]-A[i])
for i in range(K+1,N):
  ans[i] = min(ans[i],np.min(ans[i-K:i]+np.abs(A[i]-A[i-K:i])))
print(int(ans[N-1]))
### BUGGY CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
M=10**9+7

P,Q=[],[] #P,Q...+,-の要素
Z=0 #Z...0の個数

for a in A:
    if a>0:
        P.append(a)
    elif a<0:
        Q.append(a)
    else:
        Z+=1

P.sort(reverse=True)
X=[1]
for p in P:
    X.append(X[-1]*p)
    
Q.sort()
Y=[1]
for q in Q:
    Y.append(Y[-1]*q)

J=-1
S=len(P)
for m in range(0,len(Q)+1,2):
    if 0<=K-m<=S:
        J=max(J,X[K-m]*Y[m])

if J>0:
    print(J%M)
else:
    if Z==0:
        J=1
        for i in range(K):
            J*=Q[-(i+1)]
        print(J%M)
    else:
        print(0)


### FIXED CODE ###

from collections import deque
import sys

N,K=map(int,input().split())
A=list(map(int,input().split()))
M=10**9+7

if N==K:
    T=1
    for a in A:
        T=(T*a)%M
    print(T)
    sys.exit()
elif max(A)<0 and K%2==1:
    A.sort(reverse=True)
    T=1
    for i in range(K):
         T=(T*A[i])%M
    print(T)
    sys.exit()
    
U=list(map(lambda x:max(x,0),A))
U.sort(reverse=True)
U=deque(U)

V=list(map(lambda x:min(x,0),A))
V.sort()
V=deque(V)

T=1
Y=0
while Y<K:
    x1,x2=U[0],U[1]
    y1,y2=V[0],V[1]

    if Y==K-1 or x1*x2>=y1*y2:
        Y+=1
        T=(T*x1)%M
        _=U.popleft()
        U.append(0)
    else:
        Y+=2
        T=(T*y1*y2)%M
        _=V.popleft()
        _=V.popleft()
        V.append(0)
        V.append(0)
print(T)
### BUGGY CODE ###

def ans(N):
    if N==0:
        return 2
    elif N==1:
        return 1
    else:
        return ans(N-1)+ans(N-2)

N=int(input())
print(ans(N))


### FIXED CODE ###

def memoize(f):
    cache={}
    def helper(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]
    return helper

@memoize
def ans(N):
    if N==0:
        return 2
    elif N==1:
        return 1
    else:
        return ans(N-1)+ans(N-2)

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

from collections import Counter
[N, X, Y] = [int(item) for item in input().split()]
X -= 1
Y -= 1
gyoretu=[]
for i in range(N):
    row=[]
    for j in range(N):
        if i == j:
            row.append(0)
        elif abs(i - j) == 1 or i == X and j == Y or i == Y and j == X:
            row.append(1)
        else:
            row.append(2000)
    gyoretu.append(row)
for k in range(N):
    for i in range(N):
        for j in range(N):
            gyoretu[i][j] = gyoretu[i][j] if gyoretu[i][j]< gyoretu[i][k] + gyoretu[k][j] else gyoretu[i][k] + gyoretu[k][j]
array=[]
for i in range(N):
        array+=gyoretu[i][i:]
c=Counter(array)
for i in range(1, N):
    print(c[i])

### FIXED CODE ###

[N, X, Y] = [int(item) for item in input().split()]
X -= 1
Y -= 1
count=[0 for _ in range(N)]
for i in range(N):
    for j in range(i,N):
        count[min(abs(i-j),abs(i-X)+1+abs(Y-j),abs(i-Y)+1+abs(X-j))]+=1
#print(array)


for i in range(1,N):
        print(count[i])

#print(count)
### BUGGY CODE ###

n = int(input())
o = {""}
for i in range(n):
    a = len(o)
    op, ob = map(str, input().split())
    if op == "find":
        ocp = o.copy()
        ocp.add(ob)
        if len(ocp) > a:
            print("no")
        else:
            print("yes")
    else:
        o.add(ob)


### FIXED CODE ###

n = int(input())
o = {""}
for i in range(n):
    a = len(o)
    op, ob = map(str, input().split())
    if op == "find":
        o.add(ob)
        if len(o) > a:
            print("no")
            o.discard(ob)
        else:
            print("yes")
    else:
        o.add(ob)
### BUGGY CODE ###

import copy

s = input().split()

n = int(s[0])
m = int(s[1])


ll = [set() for j in range(n + 1)]
sl = set()

s1 = {1}
s2 = set()


for i in range(m):
    t = input().split()
    sl.add(int(t[0]))
    sl.add(int(t[1]))
    ll[int(t[0])].add(int(t[1]))
    ll[int(t[1])].add(int(t[0]))


if sum(sl) < int(((n + 1) * n ) / 2):
    print("No")
    #print(sl,int(((n + 1) * n ) / 2))
else:
    count = 0
    goal = [0 for i in range(n)]
    out = 0

    while count < n:
        s2.clear()
        #out += 1
        for i in sl:
            if len(s1 & ll[i]) != 0:
                s3 = list(s1 & ll[i])
                #print(s3)
                goal[i-1] = s3[0]
                s2.add(i)
                count += 1
                #del ll[i]
                #ll[i].clear()
        sl = sl - s2
        s1 = s2.copy()
        #print(s1,s2)

        #if out >= 200:
        #    break
    print("Yes")
    for i in range(1,n):
        print(goal[i])

    #print(count,out)
    #print(goal)


### FIXED CODE ###

import collections

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

coriddorList = [set() for i in range(n+1)]
deepList = [-1 for i in range(n+1)]


for i in range(m):
    a,b = list(map(int,input().split()))
    coriddorList[a].add(b)
    coriddorList[b].add(a)

checkList = [0] * (n + 1)
ansList = [0] * (n + 1)
checkList[1] = 1
q = collections.deque()
q.appendleft(1)

while len(q) > 0:
    value = q.pop()
    for k in coriddorList[value]:
        if checkList[k] == 0:
            checkList[k] = 1
            ansList[k] = value
            q.appendleft(k)

print("Yes")
for i in range(2,n+1):
    print(ansList[i])
### BUGGY CODE ###

from collections import deque

def GCP(a, b):
  if a < b:
    a, b = b, a
  while b > 0:
    a, b = b, a % b
  return a

def LCM(a, b):
  return a * b // GCP(a, b)

def solve():
  MOD = 10**9 + 7

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

  T = deque(A)
  while len(T) > 1:
    T.append(LCM(T.pop(), T.pop()))

  L = T.pop()

  ans = 0
  for i in range(N):
    ans += L // A[i]
    ans %= MOD

  print(ans)

solve()

### FIXED CODE ###

from collections import deque

def GCP(a, b):
  if a < b:
    a, b = b, a
  while b > 0:
    a, b = b, a % b
  return a

def LCM(a, b):
  return a * b // GCP(a, b)

def solve():
  MOD = 10**9 + 7

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

  T = deque(A)
  while len(T) > 1:
    T.append(LCM(T.pop(), T.pop()))

  L = T.pop()

  ans = 0
  for i in range(N):
    ans += L // A[i]

  print(ans % MOD)

solve()