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

N = int(input())
li = list(sorted(input()) for _ in range(N))
ans = 0
for i in range(N):
  tmp = li[i]
  li[i] = 0
  if tmp in li:
    ans += li.count(tmp)
print(ans)

### FIXED CODE ###

N = int(input())
li = list("".join(sorted(input())) for _ in range(N))
dic = {}
ans = 0
for i in range(N):
  if li[i] in dic:
    ans += dic[li[i]]
    dic[li[i]] += 1
  else:
    dic[li[i]] = 1
print(ans)
### BUGGY CODE ###

from collections import Counter


class Combination:
    def __init__(self, n):
        """

        :param n: 使用する最大のn (nCm)
        """
        self.n = n
        self.memo = [None for _ in range(n + 1)]
        self.memo[0] = [1]
        for i in range(1, n + 1):
            self._nCm_pascal(i)

    def _nCm_pascal(self, i):
        """
        パスカルの三角形のn階層目のリストを取得する
        :param i: 作成する階層
        :return:
        """
        if self.n < i:
            return

        pre_row = self.memo[i - 1]
        row = [1] * (i + 1)

        for j in range(1, i):
            row[j] = pre_row[j - 1] + pre_row[j]

        self.memo[i] = row

    def nCm(self, n, m):
        return self.memo[n][m]


N = [int(_) for _ in input().split()][0]
a = [int(_) for _ in input().split()]
s = [0] * (N + 1)

cnt = Counter()
comb = Combination(N)
for i in range(N):
    s[i + 1] = a[i] + s[i]
    cnt[s[i + 1]] += 1

ans = 0
for k, v in cnt.items():
    # print(k,v)
    if v <= 1: continue
    ans += comb.nCm(v, 2)
ans += cnt[0]
print(ans)


### FIXED CODE ###

from collections import Counter

N = [int(_) for _ in input().split()][0]
a = [int(_) for _ in input().split()]

s = [0] * (len(a) + 1)
for i in range(len(a)):
    s[i + 1] = s[i] + a[i]

c = Counter()

for i in range(len(s)):
    c[s[i]] += 1

ans = 0
for cnt in c.values():
    if cnt < 2: continue

    ans += (cnt * (cnt - 1)) // 2
print(ans)
### BUGGY CODE ###

def solve():
    n,k=input().split()
    A=list(map(int,input().split()))
    n=int(n)
    k=int(k)
    M=[]
    for i in range(0,n-k+1):
        s=1
        for j in range(i,i+k):
            s=s*A[j]
        M.append(s)
        # print(M)
    for i in range(1,len(M)):
        if M[i]>M[i-1]:
            print("Yes")
        else:
            print("No")

solve()

### FIXED CODE ###

def solve():
    n,k=input().split()
    A=list(map(int,input().split()))
    n=int(n)
    k=int(k)
    for i in range(n-k):
        if A[i+k]>A[i]:
            print("Yes")
        else:
            print("No")

solve()
### BUGGY CODE ###

x=input()

for _ in range(10**6):
    x=x.replace('ST','')

print(len(x))

### FIXED CODE ###

x=input()
n=len(x)

t=0
cnt=0
for i in range(n-1,-1,-1):
    if x[i]=='T':
        t+=1
    elif t>0 and x[i]=='S':
        cnt+=1
        t-=1

print(n-2*cnt)
### BUGGY CODE ###

from collections import deque
from itertools import combinations

H,W=list(map(int,input().split()))
S=[input() for _ in range(H)]
pts=[[j,i] for i in range(W) for j in range(H)]
d=[[-1,0],[1,0],[0,1],[0,-1]]
ret=0

for s,g in combinations(pts,2):
    if S[s[0]][s[1]]=='#' or S[g[0]][g[1]]=='#':
        continue

    q=deque([s+[0]])
    while len(q)>0:
        h,w,cnt=q.popleft()

        if g[0]==h and g[1]==w:
            ret=max(ret,cnt)
            break

        for dw,dh in d:
            if 0<=w+dw<W and 0<=h+dh<H and S[h+dh][w+dw]=='.':
                q.append([h+dh,w+dw,cnt+1])

print(ret)

### FIXED CODE ###

from collections import deque

H,W=list(map(int,input().split()))
S=[input() for _ in range(H)]

start=[[j,i] for i in range(W) for j in range(H)]
res=0

for pt in start:
    v=[[0]*W for _ in range(H)]
    if S[pt[0]][pt[1]]=='#':
        continue
    q=deque([pt+[0]])
    dist=0

    while len(q)>0:
        h,w,cnt=q.popleft()
        
        if v[h][w]==1:
            continue
        else:
            v[h][w]=1

        dist=max(dist,cnt)

        for dh,dw in [[1,0],[-1,0],[0,1],[0,-1]]:
            nh=h+dh
            nw=w+dw
            if 0>nh or nh>=H or 0>nw or nw>=W or S[nh][nw]=='#':
                continue
            q.append([nh,nw,cnt+1])
    
    res=max(res,dist)

print(res)
### BUGGY CODE ###

mod = 10 ** 9 + 7
N = 2 * 10 ** 6 + 10

fac = [0] * N
finv = [0] * N
inv = [0] * N

fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, N):
    fac[i] = fac[i - 1] * i % mod
    # mod pにおける1, 2, ..., nの逆元
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def com(n, k):
    global fac, finv, mod
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod

def g(r, c):
    return (com(r + c + 2, r + 1) - 1) % mod

r1, c1, r2, c2 = map(int, input().split())

answer = g(r2, c2) - g(r2, c1 - 1) - g(r1 - 1, c2) + g(r1 - 1, c1 - 1)
answer %= mod
print(answer)


### FIXED CODE ###

mod = 10 ** 9 + 7
N = 2 * 10 ** 6 + 10

fac = [0] * N
finv = [0] * N
inv = [0] * N

fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, N):
    fac[i] = fac[i - 1] * i % mod
    # mod pにおける1, 2, ..., nの逆元
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def com(n, k):
    global fac, finv, mod
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod

def g(r, c):
    return (com(r + c + 2, r + 1) - 1) % mod

r1, c1, r2, c2 = map(int, input().split())

answer = g(r2, c2) - g(r2, c1 - 1) - g(r1 - 1, c2) + g(r1 - 1, c1 - 1)
answer %= mod
print(answer)
### BUGGY CODE ###

from itertools import product
from collections import deque
import numpy as np
class Grid():
    def __init__(self, grid, w=0, h=0, function=lambda x: x):
        self.w = w = w if w else len(grid[0])
        self.h = h = h if h else len(grid)
        dtype = type(function(grid[0][0]))
        self.grid = np.empty((h, w), dtype=dtype)
        for i, row in zip(range(h), grid):
            for j, val in zip(range(w), row):
                self.grid[i][j] = function(val)
    
    def is_valid_x(self, x):
        return 0 <= x < self.w
    def is_valid_y(self, y):
        return 0 <= y < self.h
    def is_valid_xy(self, x, y):
        return self.is_valid_x(x) and self.is_valid_y(y) 
    
    def __iter__(self):
        return iter(self.grid)
    def __repr__(self):
        return '\n'.join([' '.join(map(str, row)) for row in self.grid])
    def __getitem__(self, x):
        return self.grid[x]
    def __setitem__(self, x, val):
        self.grid[x] = val

X = iter(open(0).readlines())
h, w = map(int, next(X).split())
ch, cw = map(int, next(X).split())
dh, dw = map(int, next(X).split())
dp = Grid([x.strip() for x in X], function=lambda x: 10**6 if x == '.' else -1)

def bfs(root):
    x, y, d = root
    dp[y, x] = 0
    queue = deque([root])
    while queue:
        x, y, d = queue.popleft()
        for dx, dy in zip([1, 0, -1, 0], [0, 1, 0, -1]):
            nx, ny = x+dx, y+dy
            if dp.is_valid_xy(nx, ny) and dp[ny, nx] > d:
                if dp[ny, nx] > d:
                    dp[ny, nx] = d
                    queue.appendleft((nx, ny, d))
        for dx, dy in product(range(-2, 3), repeat=2):
            if abs(dx) + abs(dy) < 2:
                continue
            nx, ny = x+dx, y+dy                
            if dp.is_valid_xy(nx, ny) and dp[ny, nx] > d+1:
                if dp[ny, nx] > d+1:
                    dp[ny, nx] = d+1
                    queue.append((nx, ny, d+1))
bfs((cw-1, ch-1, 0))
if dp[dh-1, dw-1] == 10**6:
    print(-1)
else:
    print(dp[dh-1, dw-1])

### FIXED CODE ###

from collections import deque
from itertools import product
h, w = list(map(int,input().split()))
sy, sx = list(map(int,input().split()))
gy, gx = list(map(int,input().split()))
sx, sy, gx, gy = sx-1, sy-1, gx-1, gy-1
 
G = [list(input()) for _ in range(h)]
D = [[10**6]*w for _ in range(h)]
D[sy][sx] = 0
Q = deque([(sy, sx)])
while Q:
    y, x = Q.pop()
    for dy, dx in product(range(-2, 3), repeat=2):
        ny, nx = y+dy, x+dx
        if dx==dy==0:
            G[y][x] = '#'
            continue
        elif ny<0 or h<=ny or nx<0 or w<=nx:
            continue
        elif G[ny][nx] == '#':
            continue
        elif abs(dy)+abs(dx)<=1:
            G[ny][nx] = '#'
            D[ny][nx] = D[y][x]
            Q.append((ny, nx))
        elif D[ny][nx] == 10**6:
            D[ny][nx] = D[y][x]+1
            Q.appendleft((ny, nx))
            
if D[gy][gx] == 10**6:
    print(-1)
else:
    print(D[gy][gx])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input())
f = [1] * (N+1)
for i in range(2, N+1):
    for j in range(N//i + 1):
        f[i*j] += 1
ans = 0
for i, fk in enumerate(f):
    ans += i*fk
print(ans)


### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1, N+1):
    til = N//i
    divsum = int(til*(til+1)/2)
    ans += divsum*i
print(ans)
### BUGGY CODE ###

class DLL:
    class Node:
        def __init__(self, x, y, z):
            self.v = x
            self.prv = y
            self.nxt = z

    def __init__(self):
        init = DLL.Node(None, None, None)
        init.prv = init
        init.nxt = init
        #self.size = 0
        self.init = init

    def insert(self, x):
        i = self.init
        j = i.nxt
        k = DLL.Node(x, i, j)
        i.nxt = k
        j.prv = k
       # self.size += 1

    def deleteFirst(self):
        #if self.size != 0:
        i = self.init
        k = i.nxt
        j = k.nxt
        i.nxt = j
        j.prv = i
       # self.size -= 1

    def deleteLast(self):
        #if self.size != 0:
        i = self.init
        k = i.prv
        j = k.prv
        i.prv = j
        j.nxt = i
        #self.size -= 1

    def delete(self, x):
        #if self.size != 0:
        i = self.init
        k = i.nxt
        while 1:
            if k.v == x:
                i = k.prv
                j = k.nxt
                i.nxt = j
                j.prv = i
                #self.size -= 1
                break
            else:
                if k.nxt == i:
                    break
                else:
                    k = k.nxt

    def getlist(self):
        f = self.init
        s = f.nxt
        l = f.prv
        lt = []
        while 1:
            if s != l:
                lt.append(s.v)
                s = s.nxt
            else:
                lt.append(l.v)
                break

        return lt


n = int(input())
L = DLL()

for i in range(n):
    """
    com = input()
    if com[0] == "deleteFirst":
        L.deleteFirst()
    elif com == "deleteLast":
        L.deleteLast()
    else:
        C = com.split()
        if C[0] == "insert":
            L.insert(int(C[1]))
        elif C[0] == "delete":
            L.delete(int(C[1]))
    #L.prt()
    """

    com = input()
    if com[0] == "i":
        C = com.split()
        L.insert(int(C[1]))
    else:
        if com[6] == "F":
            L.deleteFirst()
        elif com[6] == "L":
            L.deleteLast()
        else:
            C = com.split()
            L.delete(int(C[1]))

print(*L.getlist())



### FIXED CODE ###

from collections import deque

n = int(input())
L = deque()

for i in range(n):
    com = input()
    if com[0] == 'i':
        C = com.split()
        L.appendleft(int(C[1]))
    else:
        if com[6] == 'F':
            L.popleft()
        elif com[6] == 'L':
            L.pop()
        else:
            C = com.split()
            x = int(C[1])
            try:
                L.remove(x)
            except:
                pass

print(*L)
### BUGGY CODE ###

M=10**9+7
s=input()
dp=[[0 for i in range(13)] for j in range(len(s)+1)]
dp[0][0]=1
for i in range(1,len(s)+1):
  r=[0 for _ in range(13)]
  if s[-i]=='?':
    for j in range(10):
      t=j*(10**(i-1))
      r[t%13]=1
    for k in range(13):
      for l in range(13):
        dp[i][(k+l)%13]+=dp[i-1][k]*r[l]
  else:
    t=int(s[-i])*(10**(i-1))
    r[t%13]=1
    for k in range(13):
      for l in range(13):
        dp[i][(k+l)%13]+=dp[i-1][k]*r[l]
 
print(dp[-1][5]%M)

### FIXED CODE ###

mod=10**9+7
s=input()
dp=[[0]*13 for _ in range(len(s)+1)]
dp[0][0]=1
r=[i%13 for i in range(130)]

for i in range(len(s)):
  if s[i]=='?':
    for j in range(13):
      for k in range(10):
        dp[i+1][r[j*10+k]]+=dp[i][j]
  else:
    t = int(s[i])
    for j in range(13):
      dp[i+1][r[j*10+t]] += dp[i][j]

  for k in range(13):
    dp[i+1][k] %= mod

print(dp[len(s)][5])
### BUGGY CODE ###

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

for i in range(m):
    b, c = map(int, input().split())
    A += [c]*b

A.sort(reverse=True)
A = A[0:n]

print(sum(A))

### FIXED CODE ###

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

bc = [list(map(int, input().split())) for i in range(m)]
bc = sorted(bc, key=lambda x: x[1], reverse=True)
count = 0

for i in range(m):
  b, c = bc[i][0], bc[i][1]
  l += [c]*b
  count += b
  if count >= n:
    break

l.sort(reverse=True)
print(sum(l[:n]))
### BUGGY CODE ###

import sys
import math
import numpy as np
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    N ,W = I2()
    w = [0]*N
    v = [0]*W
    dp = np.zeros([N+1,W+1],dtype = "int64")
    for i in range(N):
        a,b = I2()
        w[i] = a
        v[i] = b
    for i in range(N):
        for j in range(0,W+1):
            if(j >= w[i]):
                dp[i+1][j] = max(dp[i+1][j],dp[i][j-w[i]] + v[i])
            dp[i+1][j] = max(dp[i+1][j],dp[i][j])
            #print(dp)
    print(dp[N][W])

### FIXED CODE ###

import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    N ,W = I2()
    w = [0]*N
    v = [0]*W
    dp = [[0]*(W+1)for _ in range(N+1)]
    for i in range(N):
        a,b = I2()
        w[i] = a
        v[i] = b
    for i in range(N):
        for j in range(0,W+1):
            if(j >= w[i]):
                dp[i+1][j] = max(dp[i+1][j],dp[i][j-w[i]] + v[i])
            dp[i+1][j] = max(dp[i+1][j],dp[i][j])
            #print(dp)
    print(dp[N][W])
### BUGGY CODE ###

n = int(input())
ans = 0

for i in range(1, n+1):
    if n%i == 0:
        num = n//i
        ans = max(len(str(num)), len(str(i)))
        if num <= i:
            break
print(ans)


### FIXED CODE ###

n = int(input())
i, ans = 1, 0

while i**2 <= n:
    if n%i == 0:
        num = n//i
        ans = max(len(str(num)), len(str(i)))
    i += 1
print(ans)
### BUGGY CODE ###

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

ans = 0
for i in range(N-K+1):
    ans = max(ans, sum(plist[i:i+K]))

print((ans + K)/2)


### FIXED CODE ###

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

pre = sum(plist[:K])
ans = pre
for i in range(0, N-K):
    pre = pre - plist[i] + plist[i+K]
    ans = max(ans, pre)

print((ans + K)/2)
### BUGGY CODE ###

import itertools
import sys
from functools import reduce
from operator import mul

sys.setrecursionlimit(10000)
INF = float('inf')


def comb(n, r):
    """
    scipy.misc.comb または scipy.special.comb と同じ
    組み合わせの数 nCr
    :param int n:
    :param int r:
    :rtype: int
    """
    assert n >= r
    r = min(n - r, r)
    if r == 0:
        return 1
    return reduce(mul, range(n, n - r, -1)) // reduce(mul, range(r, 0, -1))


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

def pyramid(n):
    return n * (n + 1) * (n + 2) // 6


# K ==2 の場合
# print(pyramid(N - 1) * M ** 2 + pyramid(M - 1) * N ** 2)
a = comb(N * M-2, K-2)
b = pyramid(N - 1) * M ** 2 + pyramid(M - 1) * N ** 2
print(a*b% (10**9+7))


### FIXED CODE ###

import math
import sys

sys.setrecursionlimit(10000)
INF = float('inf')


def inv(x):
    return pow(x, MOD - 2, MOD)


def comb(n, r, mod):
    # https://fushime2.hatenablog.com/entry/2016/11/12/155543
    return (math.factorial(n) * inv(math.factorial(n - r)) * inv(math.factorial(r))) % mod


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


def pyramid(n):
    return n * (n + 1) * (n + 2) // 6


MOD = 10 ** 9 + 7

# K ==2 の場合
# print(pyramid(N - 1) * M ** 2 + pyramid(M - 1) * N ** 2)
k2 = (pyramid(N - 1) * M ** 2 + pyramid(M - 1) * N ** 2) % MOD
# k2 を何回使うか
c = comb(N * M - 2, K - 2, mod=MOD)
print(k2 * c % MOD)
### BUGGY CODE ###

x = int(input())
while x > 0:
  for i in range(2, x):
    if x % i == 0:
      print(x)
      break
  else:
    x += 1

### FIXED CODE ###

import math

x = int(input())
while x > 0:
  for i in range(2, math.floor(x**(1/2))):
    if x % i == 0:
      x += 1
      break
  else:
    print(x)
    break
### BUGGY CODE ###

import numpy as np

def calculate(h, w, arr):
    L = np.zeros([h, w])
    U = np.zeros([h, w])
    D = np.zeros([h, w])
    R = np.zeros([h, w])

    for ih in range(h):
        for iw in range(w):
            if arr[ih][iw] == ".":
                if ih == 0:
                    U[ih][iw] = 1
                else:
                    U[ih][iw] = U[ih - 1][iw] + 1


    for ih in range(h):
        for iw in range(w):
            if arr[ih][iw] == ".":
                if iw == 0:
                    L[ih][iw] = 1
                else:
                    L[ih][iw] = L[ih][iw-1] + 1


    for ih in range(h):
        for iw in range(w):
            rih = h - 1 - ih
            riw = w - 1 - iw
            if arr[rih][riw] == ".":
                if rih == h - 1:
                    D[rih][riw] = 1
                else:
                    D[rih][riw] = D[rih + 1][riw] + 1



    for ih in range(h):
        for iw in range(w):
            rih = h - 1 - ih
            riw = w - 1 - iw
            if arr[rih][riw] == ".":
                if riw == w - 1:
                    R[rih][riw] = 1
                else:
                    R[rih][riw] = R[rih][riw + 1] + 1

    max = 0
    for ih in range(h):
        for iw in range(w):
            if arr[ih][iw] == "#":
                continue
            value = L[ih][iw] + R[ih][iw] + U[ih][iw] + D[ih][iw] - 3
            if value > max:
                max = value
    print(int(max))


S = input().split(" ")
H = int(S[0])
W = int(S[1])

arr = []
for i in range(H):
    arr.append(input())

calculate(H, W, arr)


### FIXED CODE ###

def calculate(h, w, arr):
    L = [[0]*w for i in range(h)]
    U = [[0]*w for i in range(h)]
    D = [[0]*w for i in range(h)]
    R = [[0]*w for i in range(h)]

    for ih in range(h):
        for iw in range(w):
            if ih == 0:
                U[ih][iw] = 1
            if iw == 0:
                L[ih][iw] = 1

            if arr[ih][iw] == 1:
                L[ih][iw] = 0
                U[ih][iw] = 0

            else:
                if iw > 0:
                    L[ih][iw] = L[ih][iw - 1] + 1
                if ih > 0:
                    U[ih][iw] = U[ih - 1][iw] + 1

            rih = h - 1 - ih
            riw = w - 1 - iw

            if rih == h - 1:
                D[rih][riw] = 1
            if riw == w - 1:
                R[rih][riw] = 1

            if arr[rih][riw] == 1:
                D[rih][riw] = 0
                R[rih][riw] = 0
            else:
                if riw < w - 1:
                    R[rih][riw] = R[rih][riw + 1] + 1
                if rih < h - 1:
                    D[rih][riw] = D[rih + 1][riw] + 1

    max = 0
    for ih in range(h):
        for iw in range(w):
            value = L[ih][iw] + R[ih][iw] + U[ih][iw] + D[ih][iw] - 3
            if value > max:
                max = value
    print(int(max))


S = input().split(" ")
H = int(S[0])
W = int(S[1])

arr = []
for i in range(H):
    q = input()
    tmp = []
    for qs in q:
        if qs == "#":
            tmp.append(1)
        if qs == ".":
            tmp.append(0)
    arr.append(tmp)

calculate(H, W, arr)
### BUGGY CODE ###

N=int(input())
a=list(map(int,input().split()))
fl=0
def absX(n):
	ab=abs(X-n)
	if ab==0:
		ab=1
	return ab
for i in range(min(a),max(a)+1):
	X=i
	fl_=list(map(absX,a)).count(1)
	if fl_>fl:
		fl=fl_
print(fl)

### FIXED CODE ###

from collections import*
import sys
input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
a=Counter(a)
cnt=1
for i in range(min(a),max(a)+1):
	cnt_=a[i-1]+a[i]+a[i+1]
	if cnt_>cnt:cnt=cnt_
print(cnt)
### BUGGY CODE ###

from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
lcm_val=a[0]
for i in range(n-1):
  lcm_val=lcm(lcm_val,a[i+1])
# print(lcm_val)
b=[]
for aa in a:
  b.append(lcm_val//aa)

ans=0
for bb in b:
  ans+=bb
print(ans%mod)

### FIXED CODE ###

from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
lcm_val=a[0]
for i in range(n-1):
  lcm_val=lcm(lcm_val,a[i+1])
# print(lcm_val)
b=[]
ans=0
for aa in a:
  ans+=lcm_val//aa

print(ans%mod)
### BUGGY CODE ###

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

ans = 0
for x in range(B):
  A_x = A * x
  left_ = int(A_x / B)
  right_ = A * int(x / B)
  fnc_ = left_ - right_
  if x <= N:
    ans = max(ans, fnc_)
    # print("入れ替わりans", ans)

  # print("     x", x)
  # print(" left_", left_)
  # print("right_", right_)
  # print("  fnc_", left_ - right_)


print(ans)



### FIXED CODE ###

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

ans = 0

x = min(N, B-1)

A_x = A * x
left_ = int(A_x / B)
right_ = A * int(x / B)
fnc_ = left_ - right_
if x <= N:
  ans = max(ans, fnc_)
  # print("入れ替わりans", ans)

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

P = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449,
     457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]


def prime_factors(N):
    ret = []
    for p in P:
        while N % p == 0:
            ret.append(p)
            N //= p
    if N > 1:
        ret.append(N)
    return ret


N = 10 ** 6  # int(input())
A = [10 ** 6] * N  # list(map(int, input().split()))
S = []
for p in P:
    S.append(sum([1 for a in A if a % p == 0]))
print(S)


### FIXED CODE ###

import math


def primes(N):
    p = [False, False] + [True] * (N - 1)
    for i in range(2, int(N ** 0.5) + 1):
        if p[i]:
            for j in range(i * 2, N + 1, i):
                p[j] = False
    return [i for i in range(N + 1) if p[i]]


N = int(input())
A = list(map(int, input().split()))
maxA = max(A) + 1
g, Ac = A[0], [0] * maxA
P = primes(maxA)

for a in A:
    Ac[a] += 1

ans = "pairwise"
for p in P:
    if sum(Ac[p:maxA:p]) > 1:
        ans = "setwise"
for a in A:
    g = math.gcd(g, a)
print(ans if g == 1 else "not", "coprime")
### 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:
    print(-1)
    quit()

print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
import sys
limit = 10 ** 18
if 0 in a:
    print(0)
    sys.exit()
else:
    ans = 1
    for i in range(n):
        ans *= a[i]
        if ans > limit:
            print(-1)
            sys.exit()
    print(ans)