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

import collections
from sys import stdin

def counter(num_arr):
    uniq_dict = {}
    for val in num_arr:
        uniq_dict[val] = uniq_dict.get(val, 0) + 1
    return uniq_dict


def get_result(data):
    N = data[0][0]
    A = data[1]
    uniq_cnt = counter(A)
    item_dict = uniq_cnt.items()
    for i in range(N):
        ans = 0
        for key, value in item_dict:
            if key == A[i]:
                value -= 1
            if value == 1:
                continue
            ans += int(value * (value - 1) / 2)
        print(ans)


if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    get_result(data)


### FIXED CODE ###

import collections
from sys import stdin

# # not AC
# def counter(num_arr):
#     uniq_dict = {}
#     for val in num_arr:
#         uniq_dict[val] = uniq_dict.get(val, 0) + 1
#     return uniq_dict


# def get_result(data):
#     N = data[0][0]
#     A = data[1]
#     uniq_cnt = counter(A)
#     ans = {}
#     for key in uniq_cnt.keys():
#         tmp = uniq_cnt.copy()
#         tmp[key] -= 1
#         ans[key] = int(sum([val * (val-1) / 2 for val in tmp.values()]))

#     for i in range(N):
#         print(ans[A[i]])

def get_result(data):
    N = data[0][0]
    A = data[1]
    uniq_cnt = collections.Counter(A)
    all_selection = 0
    for val in uniq_cnt.values():
        all_selection += int(val * (val-1) / 2)

    for i in range(N):
        print(all_selection - uniq_cnt[A[i]] + 1)


if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    get_result(data)
### BUGGY CODE ###

A = [int(a) for a in input().split()]
N = A[0]
K = A[1]

P = [int(p) for p in input().split()]

raw_max = 0
maxnum = 0

for i in range(N-K+1):
    tmp = sum(P[i:i+K])
    if(raw_max < tmp):
        raw_max = tmp
        maxnum = i

ev_max = [(n+1)/2 for n in P[maxnum:maxnum+K]]

print(sum(ev_max))

### FIXED CODE ###

A = [int(a) for a in input().split()]
N = A[0]
K = A[1]

P = [int(p) for p in input().split()]

raw_max = sum(P[0:K])
maxnum = 0
sum_tmp = sum(P[0:K])

for i in range(1, N-K+1):
    sum_tmp = sum_tmp - P[i-1] + P[i+K-1]
    if(raw_max < sum_tmp):
        raw_max = sum_tmp
        maxnum = i

ev_max = [(n+1)/2 for n in P[maxnum:maxnum+K]]

print(sum(ev_max))
### BUGGY CODE ###

N, Q = map(int, input().split())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(Q)]

def main(N, Q, C, S):    
  # Binary Indexed Tree 
  # https://juppy.hatenablog.com/entry/2018/11/17/%E8%9F%BB%E6%9C%AC_python_Binary_Indexed_Tree_%E7%AB%B6%E6%8A%80%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0
  BIT = [0 for _ in range(N+1)]
  def BIT_query(idx): #idxまでの和(1からスタート)
    res_sum = 0
    while idx > 0:
      res_sum += BIT[idx]
      idx -= idx&(-idx) #一番下の位を減らす（例：13=1011 → 1010 → 1000） 
    return res_sum
  def BIT_update(idx,x): #idxをx増やした時
    while idx <= N:
      BIT[idx] += x
      idx += idx&(-idx) #一番下の位を繰り上げる（例：13=1011 → 1100 → 10000 ※N=16のとき） 
    return

  loc = [0 for _ in range(N)] #各種類の玉のうちの最右端の所在地
  S = [[S[i], i] for i in range(Q)] #クエリ
  S.sort(key = lambda a: a[0][1]) #区間の右端でソート

  ans = [0 for _ in range(Q)]
  k = 0
  for j in range(N):
    if loc[C[j]-1] > 0: #玉の更新
      BIT_update(loc[C[j]-1], -1)
    loc[C[j]-1] = j+1
    BIT_update(j+1, 1)  
    
    if S[k][0][1] == j+1:
      t = BIT_query(j+1)
    while k < len(S) and S[k][0][1] == j+1: #クエリへの返答
      ans[S[k][1]] = t - BIT_query(S[k][0][0]-1)
      k += 1
    if k == len(S):
      break

  for a in ans:
    print(a)

main(N, Q, C, S)


### FIXED CODE ###

from sys import stdin
#import numpy as np

readline = stdin.readline

N, Q = map(int, readline().split()) 
C = list(map(int, readline().split())) 
S = [list(map(int, readline().split())) for _ in range(Q)] 
#print(S)
def main(N, Q, C, S):    
  # Binary Indexed Tree 
  # https://juppy.hatenablog.com/entry/2018/11/17/%E8%9F%BB%E6%9C%AC_python_Binary_Indexed_Tree_%E7%AB%B6%E6%8A%80%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0
  b = [0 for _ in range(N+1)]
  def BIT_query(idx): #idxまでの和(1からスタート)
    res_sum = 0
    while idx > 0:
      res_sum += b[idx]
      idx -= idx&(-idx) #一番下の位を減らす（例：13=1011 → 1010 → 1000） 
    return res_sum
  def BIT_update(idx,x): #idxをx増やした時
    while idx <= N:
      b[idx] += x
      idx += idx&(-idx) #一番下の位を繰り上げる（例：13=1011 → 1100 → 10000 ※N=16のとき） 
    return

  loc = [0 for _ in range(N)] #各種類の玉のうちの最右端の所在地
  S = [(S[i], i) for i in range(Q)] #クエリ
  S.sort(key = lambda s: s[0][1]) #区間の右端でソート
  #S = np.array(S, dtype = np.int64)
  #print(S)
  ans = [0 for _ in range(Q)]
  k = 0
  for j in range(N):
    if loc[C[j]-1] > 0: #玉の更新
      BIT_update(loc[C[j]-1], -1)
    loc[C[j]-1] = j+1
    BIT_update(j+1, 1)  
    
    if S[k][0][1] == j+1:
      t = BIT_query(j+1)
    while k < len(S) and S[k][0][1] == j+1: #クエリへの返答
      ans[S[k][1]] = t - BIT_query(S[k][0][0]-1)
      k += 1
    if k == len(S):
      break
  return ans

ans = main(N, Q, C, S)
print(*ans, sep='\n')
### BUGGY CODE ###

# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
s=list(input())

temp=0
ans=0
next="Z"
while s:
    this=s.pop(0)#正直一個前の値をthatに入れてもよかったと思う
    if this == "A":
        temp+=1
    elif this == "B":
        if len(s)==0:#s.popできるか調べる
            break
        next=s.pop(0)
        if next=="C":
            ans+=temp
            s=["A"]*temp+s
        elif next=="A":#ここ繋ぎがうまく作れんかった
            temp=1
            continue
        temp=0
    elif this == "C":#虚無
        temp=0

print(ans)
    
    



### FIXED CODE ###

# coding: utf-8
# Your code here!
s=list(input().replace("BC","Z"))[::-1]
ans=0

def seisan(list):
    count=0
    N=len(list)-1
    for index,content in enumerate(list):
        if content=="A":
            count+=(N-index)
            N-=1
    return count

temp=[]
while s:
    this=s.pop(-1)
    if this=="B" or this=="C":
        ans+=seisan(temp)
        temp.clear()
    else:
        temp.append(this)

print(ans+seisan(temp))
#ちょくだいさん連投ゆるして
### BUGGY CODE ###

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

S = input().strip()
#-----

S_sum = [0]
tmp_sum = 0

for word in S:
    tmp_sum += int(word)
    S_sum.append(tmp_sum)


cnt = 0
for i in range(1,len(S_sum)):
    for j in range(i+3, len(S_sum)):
        diff = S_sum[j] - S_sum[i-1]
        sub_S = S[(i-1):j]
        
        if diff % 3 == 0  and  int(sub_S) % 673 == 0:
            cnt += 1

print(cnt)


### FIXED CODE ###

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

S = input().strip()
#-----
num = 0
cnt_mod = {0:1}  # type {int: int} , contents {remainder : count}
mod = 2019
base_pow = 1

for i in range(len(S)):
    digit = int( S[len(S)-1-i] )
    
    num += (digit * base_pow) % mod
    num %= mod
    
    base_pow = (base_pow * 10) % mod
    
    cnt_mod.setdefault(num, 0)
    cnt_mod[num] += 1


ans = 0

for r,c in cnt_mod.items():
    # r: remainder
    # c: count
    if c >= 2:
        ans += c*(c-1)//2

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

def main():
	N = int(input())
	A = [0]*N
	for i in range(N):
		A[i] = int(input())

	memo = dict()
	def create_triangles(r, g, b, num):
		ans = 0
		if num == N:
			if (abs(b-g)<r and r<b+g) or (abs(b-r)<g and g<b+r) or (abs(r-g)<b and b<r+g):
				return 1
			else:
				return 0
		if not (r+A[num],g,b) in memo:
			tmp = create_triangles(r+A[num], g, b, num+1)
			memo[(r+A[num],g,b)] = tmp
			memo[(r+A[num],b,g)] = tmp
			memo[(b,r+A[num],g)] = tmp
			memo[(b,g,r+A[num])] = tmp
			memo[(g,r+A[num],b)] = tmp
			memo[(g,b,r+A[num])] = tmp
		ans += memo[(r+A[num],g,b)]
		ans %= 998244353

		if not (r,g+A[num],b) in memo:
			tmp = create_triangles(r, g+A[num], b, num+1)
			memo[(r,g+A[num],b)] = tmp
			memo[(r,b,g+A[num])] = tmp
			memo[(b,r,g+A[num])] = tmp
			memo[(b,g+A[num],r)] = tmp
			memo[(g+A[num],r,b)] = tmp
			memo[(g+A[num],b,r)] = tmp
		ans += memo[(r,g+A[num],b)]
		ans %= 998244353

		if not (r,g,b+A[num]) in memo:
			tmp = create_triangles(r, g, b+A[num], num+1)
			memo[(r,g,b+A[num])] = tmp
			memo[(r,b+A[num],g)] = tmp
			memo[(b+A[num],r,g)] = tmp
			memo[(b+A[num],g,r)] = tmp
			memo[(g,r,b+A[num])] = tmp
			memo[(g,b+A[num],r)] = tmp
		ans += memo[(r,g,b+A[num])]
		ans %= 998244353

		return ans

	ans = create_triangles(0,0,0,0)
	print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
	N = int(input())
	A = [0]*N
	MOD = 998244353
	summation = 0

	for i in range(N):
		A[i] = int(input())
		summation += A[i]

	# dp[i][j] represents sum of red is j at i position
	dp = [[0 for _ in range(summation+1)] for _ in range(N)]
	dp[0][0] = 2 # green or blue
	dp[0][A[0]] = 1 # red

	for i in range(1, N):
		for j in range(len(dp[i])):
			dp[i][j] += dp[i-1][j] * 2 % MOD # don't use A[i] for red, i.e. use green or blue
			dp[i][j] += dp[i-1][j-A[i]] % MOD if 0 <= j - A[i] <= len(dp[i]) else 0 # use i red

	# total
	ans = (3 ** N) % MOD
	ceil = summation // 2
	if summation % 2 != 0:
		ceil += 1
	ans -= sum([dp[N-1][r] for r in range(ceil, summation+1)])*3
	ans %= MOD

	if summation %2 == 0:
		# case r = g = S/2
		dp  =[[0 for _ in range(summation//2+1)] for _ in range(N)]
		dp[0][0] = 1 # only blue
		dp[0][A[0]] = 1
		for i in range(1, N):
			for j in range(len(dp[i])):
				dp[i][j] += dp[i-1][j] % MOD
				dp[i][j] += dp[i-1][j-A[i]] % MOD if 0 <= j-A[i] <= len(dp[i]) else 0
		ans += dp[N-1][summation//2]*3
		ans %= MOD

	print(ans)


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

N,K=map(int,input().split())
H=list(map(int,input().split()))
Cost=[1e30 for i in range(N)]
Cost[0]=0
Cost[1]=abs(H[1]-H[0])
for i in range(2,N):
    for k in range(1,min(i,K)+1):
        Cost[i]=min(Cost[i], Cost[i-k] + abs(H[i]-H[i-k]))
print(Cost[N-1])

### FIXED CODE ###

import numpy as np
N,K=map(int,input().split())
h=list(map(int,input().split()))
h=np.array(h)
cost=np.zeros(N+1)
cost[1]=0
cost[2]=abs(h[1]-h[0])
for i in range(3,N+1):
    x=1 if i-K<=1 else i-K
    cost[i]=(cost[x:i]+abs(h[i-1]-h[x-1:i-1])).min()
print(int(cost[N]))
### BUGGY CODE ###

import numpy as np
n,m,q=map(int,input().split())
a=np.zeros((n+2,n+2))
for i in range(m):
  s,e=map(int,input().split())
  a[:s+1,e]+=1
b=a.cumsum(1)
for i in range(q):
  s,e=map(int,input().split())
  print(int(b[s,e]))


### FIXED CODE ###

import numpy as np
n,m,q=map(int,input().split())
a=np.zeros((n+2,n+2))
for i in range(m):
  s,e=map(int,input().split())
  a[s,e]+=1

b=a.cumsum(1)
b=np.flipud(b)
b=b.cumsum(0)
b=np.flipud(b)

for i in range(q):
  s,e=map(int,input().split())
  print(int(b[s,e]))
### BUGGY CODE ###

n = input()
countArray = [0] * 2019
count = 0
countArray[0] += 1
nums=0
for i in range(len(n))[::-1]:
    nums = nums + int(n[len(n)-1-i])*pow(10,i)
    countArray[nums%2019]+=1

for i in countArray:
    count += (i * (i - 1)) / 2
print(int(count))

### FIXED CODE ###

n = input()
countArray = [0] * 2019
count = 0
countArray[0] += 1
nums=0
for i in range(len(n))[::-1]:
    nums = nums + int(n[len(n)-1-i])*pow(10,i,2019)
    countArray[nums%2019]+=1

for i in countArray:
    count += (i * (i - 1)) // 2
print(count)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
e=[[]for _ in range(n)]
for x,y in[map(int,input().split())for _ in[0]*(n-1)]:e[x-1].append(y-1);e[y-1].append(x-1)
def b(r,v):return sum((r!=i)and(a[v]>a[i])and(not(b(v,i)))for i in e[v])
print(*[i+1for i in range(n)if b(n,i)])

### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10000000)
n=int(input())
a=list(map(int,input().split()))
edge=[[]for _ in range(n)]
for x,y in[list(map(int,input().split()))for _ in range(n-1)]:
  edge[x-1].append(y-1)
  edge[y-1].append(x-1)
def bfs(r,v):
  for i in edge[v]:
    if(r!=i)and(a[v]>a[i])and(not(bfs(v,i))):return True
  return False
print(*[i+1 for i in range(n)if bfs(-1,i)])
### BUGGY CODE ###

import sys
mod = 10 ** 9 + 7

n,m = map(int,input().split())
if n in [0,1]:
    print(1)
    sys.exit()
    
if not m == 0:
    lis = [int(input()) for x in range(m)]
else:
    lis = []
stairs = [0 for x in range(n)]
stairs[0] = 1
if 1 in lis:
    stairs[1] = 0
else:
    stairs[1] = 1
#print(stairs)
f = 0
for x in range(2,n):
    if x in lis:
        stairs[x] = 0
    else:
        stairs[x] = (stairs[x-1] + stairs[x-2]) % mod
    
#print(stairs)
print((stairs[n-1] + stairs[n-2]) % mod)

### FIXED CODE ###

import sys
mod = 10 ** 9 + 7

n,m = map(int,input().split())
if n in [0,1]:
    print(1)
    sys.exit()
    
if not m == 0: lis = [int(input()) for x in range(m)]
else: lis = [-1]
val1 = 1
if 1 in lis: val2 = 0
else: val2 = 1

if lis[0] == 1 and len(lis) >= 2:
    flg = lis[1]
    nex = 1
else:
    flg = lis[0]
    nex = 0
#print(lis)
for x in range(2,n):
    if x == flg: #x in lis
        #print(flg)
        nex += 1
        try: flg = lis[nex]
        except:flg = 0
        now = 0
    else:
        now = (val1 + val2) % mod
    val1,val2 = val2,now
    
print((val1 + val2) % mod)
### BUGGY CODE ###

import numpy as np

N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in [0]*N]
dp = np.zeros((N+1,W+1),dtype = int)
for i in range(1,N+1):
    for j in range(1,W+1):
        if j < wv[i-1][0]:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j],dp[i-1][j-wv[i-1][0]]+wv[i-1][1])
print(dp[N][W])

### FIXED CODE ###

import numpy as np
N,W = map(int,input().split())
w,v = [],[]
for i in range(N):
    a,b = map(int,input().split())
    w += [a]
    v += [b]
dp = np.zeros(W+1,dtype = int)
for i in range(N):
    dp[w[i]:] = np.maximum(dp[:-w[i]]+v[i],dp[w[i]:])
print(dp[-1])
### BUGGY CODE ###

[N,L] = [int(x) for x in input().split()]
A = {}
B = [0]*N
ANS = {}
count = 0
for i,x in enumerate(input().split()):
    i = int(i)
    x = int(x)
    B[i] = x
    if x in A : A[x] += [i]
    else : A[x] = [i]
for i in range(10**9) :
    if i in A:
        for j in A[i] :
            for k in range(L) :
                if j + k not in ANS :
                    ANS[j+k] = i
                    count += 1
        if count > N // 2 : break
    else:
        continue

for i in range(L):
    if i not in ANS : ANS[i] = min(B[:i+1])
for i in range(L,N):
    if i not in ANS : ANS[i] = min(B[i+1-L:i+1])
for i in range(L-1,N-1) : print(ANS[i], end=" ")
print(ANS[N-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
### BUGGY CODE ###

class GCD:
    def __init__(self):
        self.numlist = dict()
        self.numlist2 = dict()
    def culc(self, K):
        ret = 0
        for i in range(1,K-1):
            for j in range(i+1, K):
                for k in range(j+1,K+1):
                    ret += self.gcd(i,j,k)*6
        
        for i in range(1,K+1):
            for j in range(1,K+1):
                if i != j:
                    ret += self.gcd(i,i,j) * 3
        for i in range(1, K+1):
            ret += self.gcd(i,i,i)

        return ret

    def gcd(self, a,b,c):
        l = [a,b,c]
        l.sort()
        l = tuple(l)
        if l in self.numlist:
            return self.numlist[l]
        else:
            temp_ = self.gcd_(l[0],l[1])
            temp_ = self.gcd_(temp_, l[2])
            self.numlist[l] = temp_
            return temp_

    def gcd_(self,a,b):
        l = (min(a,b), max(a,b))
        if l in self.numlist2:
            return self.numlist2[l]
        else:
            mod = max(a,b) % min(a,b)
            if mod == 0:
                ret = min(a,b)
                self.numlist2[l] = ret
                return ret
            else:
                ret = self.gcd_(min(a,b), mod)
                self.numlist2[l] = ret
                return ret

K = int(input())
gcd = GCD()
ret = gcd.culc(K)
print(ret)

### FIXED CODE ###

class GCD:
    def __init__(self):
        self.numlist = dict()
    def culc(self, K):
        ret = 0
        
        for i in range(1,K):
            for j in range(i + 1,K+1):
                ret += self.gcd_(i,j) * 6

        for i in range(1,K-1):
            for j in range(i+1, K):
                for k in range(j+1,K+1):
                    ret += self.gcd(i,j,k)*6

        for i in range(1, K+1):
            ret += i

        return ret

    def gcd(self, a,b,c):
        #l = (a,b,c)
        #if l in self.numlist:
        #    return self.numlist[l]
        #else:
        temp_ = self.gcd_(a,b)
        temp_ = self.gcd_(temp_, c)
        
        return temp_

    def gcd_(self,a,b):
        l = (min(a,b), max(a,b))
        if l in self.numlist:
            return self.numlist[l]
        else:
            mod = max(a,b) % min(a,b)
            if mod == 0:
                ret = min(a,b)
                self.numlist[l] = ret
                return ret
            else:
                ret = self.gcd_(min(a,b), mod)
                self.numlist[l] = ret
                return ret

K = int(input())
gcd = GCD()
ret = gcd.culc(K)
print(ret)
### BUGGY CODE ###

import sys
def rec(N,dp,i,j,k):
    if dp[i][j][k]>=0.0:return dp[i][j][k]
    if all([i==0,j==0,k==0]):return 0.0
    res=0.0
    if i>0:res+=rec(N,dp,i-1,j,k)*i
    if j>0:res+=rec(N,dp,i+1,j-1,k)*j
    if k>0:res+=rec(N,dp,i,j+1,k-1)*k
    res=(res+N)/(i+j+k)
    dp[i][j][k]=res
    return dp[i][j][k]
def main():
    N=int(sys.stdin.readline())
    a=tuple(map(int,sys.stdin.readline().split()))
    n1,n2,n3=a.count(1),a.count(2),a.count(3)
    dp=[[[-1.0 for _ in range(n3+1)] for _ in range(n2+n3+1)] for _ in range(n1+n2+n3+1)]
    print(rec(N,dp,n1,n2,n3))
if __name__=='__main__':main()


### FIXED CODE ###

import sys
def rec(N,dp,i,j,k):
    if dp[i][j][k]>=0.0:return dp[i][j][k]
    if all([i==0,j==0,k==0]):return 0.0
    res=0.0
    if i>0:res+=rec(N,dp,i-1,j,k)*i
    if j>0:res+=rec(N,dp,i+1,j-1,k)*j
    if k>0:res+=rec(N,dp,i,j+1,k-1)*k
    res=(res+N)*1.0/(i+j+k)
    dp[i][j][k]=res
    return dp[i][j][k]
def main():
    N=int(sys.stdin.readline())
    a=tuple(map(int,sys.stdin.readline().split()))
    n1,n2,n3=a.count(1),a.count(2),a.count(3)
    dp=[[[-1.0 for _ in range(n3+1)] for _ in range(n2+n3+1)] for _ in range(n1+n2+n3+1)]
    print(rec(N,dp,n1,n2,n3))
if __name__=='__main__':main()
### BUGGY CODE ###

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

def lcm(a,b):
  return (a*b)//gcd(a,b)
 
n = int(input())
arr = [int(x) for x in input().split()] 
mod=1000000007
lc = arr[0]
for i in range(1, len(arr)): 
  	lc = lcm(lc,arr[i])
ans=0
for i in range(n):
    ans=ans+lc//arr[i]
    ans%=mod
print(int(ans))

### FIXED CODE ###

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

def lcm(a,b):
  return (a*b)//gcd(a,b)
 
n = int(input())
arr = [int(x) for x in input().split()] 
mod=1000000007
lc = arr[0]
for i in range(1, len(arr)): 
  	lc = lcm(lc,arr[i])
ans=0
for i in range(n):
    ans=ans+lc//arr[i]
print(int(ans)%mod)
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N, X, Y = MAP()
graph = [[] for _ in range(N)]
 
for i in range(N-1):
    graph[i].append(i+1)
    graph[i+1].append(i)
 
graph[X-1].append(Y-1)
graph[Y-1].append(X-1)
 
dic = defaultdict(int)
for i in range(N):
    q = deque()
    q.append(i)
    dist = [INF]*N
    dist[i] = 0
    while q:
        n = q.popleft()
        for node in graph[n]:
            if dist[node] == INF:
                dist[node] = dist[n] + 1
                q.append(node)
 
    for d in dist:
        dic[d] += 1
 
for k in range(1, N):
    print(dic[k]//2)

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, X, Y = MAP()
graph = [[] for _ in range(N)]

for i in range(N-1):
    graph[i].append(i+1)
    graph[i+1].append(i)

graph[X-1].append(Y-1)
graph[Y-1].append(X-1)

dic = defaultdict(int)
for i in range(N):
    q = deque()
    q.append(i)
    dist = [INF]*N
    dist[i] = 0
    while q:
        n = q.popleft()
        for node in graph[n]:
            if dist[node] == INF:
                dist[node] = dist[n] + 1
                q.append(node)

    for d in dist:
        dic[d] += 1

for k in range(1, N):
    print(dic[k]//2)
### BUGGY CODE ###

n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
f=[0,1]
for i in range(2,n+2):
    if i-1 in a:f.append(0)
    else:f.append(f[i-1]+f[i-2])
print(f[-1]%1000000007) 

### FIXED CODE ###

n,m=map(int,input().split())
a=[1]*(n+1)
for _ in range(m):a[int(input())]=0
p,q=0,1
for i in range(1,n+1):
    p,q=q,a[i]*(p+q)%(10**9+7)
print(q)
### BUGGY CODE ###

import math
from functools import reduce
k = int(input())

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

ans = 0

for i in range(k):
    i += 1
    for j in range(k):
        j += 1
        for l in range(k):
            l += 1
            ans += gcd(i, j, l)

print(ans)


### FIXED CODE ###

from math import gcd
from functools import reduce
k = int(input())

ans = 0

for i in range(k):
    i += 1
    for j in range(k):
        j += 1
        m = gcd(i, j)
        for l in range(k):
            l += 1
            ans += gcd(l, m)

print(ans)