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

import itertools
n = int(input())
l = list(map(int,input().split()))
l = sorted(l)
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        #print(l[i],l[j])
        for z in range(j+1,n):
            if l[i]+l[j]>l[z] and l[z]+l[i]>l[j]:
                cnt  += 1
                #print(l[i],l[j],l[z])
print(cnt)

### FIXED CODE ###

from bisect import bisect_left
n = int(input())
l = list(map(int,input().split()))
l = sorted(l)
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        #print(l[i],l[j])
        cnt += bisect_left(l, l[i] + l[j]) - (j + 1)
print(cnt)
### BUGGY CODE ###

LARGE = 10 ** 9 + 7


def solve(x, y):
    if (x + y) % 3 != 0:
        return 0
    z = (x + y) // 3
    if x < z or y < z:
        return 0
    # zC(x-z)
    r = min(x - z, y - z)
    res = 1
    for i in range(r):
        res *= z - i
        res *= pow(i + 1, LARGE - 2, LARGE)
        res %= LARGE
    return res


def main():
    x, y = map(int, input().split())
    res = solve(x, y)
    print(res)


def test():
    assert solve(3, 3) == 2
    assert solve(2, 2) == 0
    assert solve(999999, 999999) == 151840682


if __name__ == "__main__":
    test()
    main()


### FIXED CODE ###

LARGE = 10 ** 9 + 7


def solve(x, y):
    if (x + y) % 3 != 0:
        return 0
    z = (x + y) // 3
    if x < z or y < z:
        return 0
    # zC(x-z)
    r = min(x - z, y - z)
    res = 1
    for i in range(r):
        res *= z - i
        res *= pow(i + 1, LARGE - 2, LARGE)
        res %= LARGE
    return res


def main():
    x, y = map(int, input().split())
    res = solve(x, y)
    print(res)


def test():
    assert solve(3, 3) == 2
    assert solve(2, 2) == 0
    assert solve(999999, 999999) == 151840682


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

N,K=map(int,input().split())
P=list(map(int,input().split()))
S=0
for i in range(N-K+1):
  s=sum(P[i:i+K])
  if s>S:
    S=s
ans=(K+S)/2
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
P=list(map(int,input().split()))
S=0
sumlist=[0 for i in range(N+K-1)]
sumlist[0]=sum(P[:K])
for i in range(1,N-K+1):
  sumlist[i]=sumlist[i-1]+P[K+i-1]-P[i-1]
S=max(sumlist)
ans=(K+S)/2
print(ans)
### BUGGY CODE ###

#TLE
S = input()

def roop_from(position):
    head = []
    visited = set()
    while position not in visited:
        head.append(position)
        visited.add(position)
        #print(position, head, visited)
        if S[position] == "R":
            position += 1
        else:
            position -= 1

    roop = head[head.index(position):]
    return head, roop

def after_big_move(head, roop):
    if len(head) % 2 == 0:
        return roop[0]
    else:
        return roop[1]

Result = [0] * len(S)
for i in range(0, len(S)):
    head, roop = roop_from(i)
    ans = after_big_move(head, roop)
    Result[ans] += 1

print(*Result, sep=" ")

### FIXED CODE ###

from math import ceil
S = input()
Result = [0] * len(S)
S += "R"

num_R = 0
num_L = 0
past_bottom_pointer = 0

for pointer in range(len(S) - 1):
    left = S[pointer]
    right = S[pointer + 1]

    if left == "R" and right == "R":
        #down
        num_R += 1

    elif left == "R" and right == "L":
        #bottom
        num_R += 1
        #print(num_R, num_L)
        Result[pointer] += ceil(num_R / 2)
        Result[pointer + 1] += num_R // 2
        num_R = 0
        past_bottom_pointer = pointer

    elif left == "L" and right == "L":
        #up
        num_L += 1

    elif left == "L" and right == "R":
        #top
        num_L += 1
        #print(num_R, num_L)
        Result[past_bottom_pointer] += num_L // 2
        Result[past_bottom_pointer + 1] += ceil(num_L / 2)
        num_L = 0

    #print(pointer, Result)

print(*Result)
### BUGGY CODE ###

from itertools import product
INF = 10**18

def sol():
    N = int(input())
    XYP = [tuple(map(int, input().split())) for _ in range(N)]
    XYP.sort(key=lambda xyp: xyp[2], reverse=True)

    X = [x for x, _, _ in XYP]
    Y = [y for _, y, _ in XYP]

    def calcCost(AP, A):
        ret = [[INF] * N for _ in range(1 << N)]
        for state in range(1 << N):
            useA = [a for i, a in enumerate(A) if (state & (1 << i)) != 0]
            for i, (a, p) in enumerate(AP):
                cost = abs(a)
                for z in useA:
                    cost = min(cost, abs(a - z))
                ret[state][i] = cost * p
        return ret

    costX = calcCost([(x, p) for x, _, p in XYP], X)
    costY = calcCost([(y, p) for _, y, p in XYP], Y)

    ans = [INF] * (N + 1)
    for state in product((0, 1, 2), repeat=N):
        stateX = 0
        stateY = 0
        M = N
        for s in state:
            stateX <<= 1
            stateY <<= 1
            if s == 0: M -= 1
            if s == 1: stateX |= 1
            if s == 2: stateY |= 1

        cx, cy = costX[stateX], costY[stateY]
        cost = 0
        for i in range(N):
            cost += min(cx[i], cy[i])
            if cost >= ans[M]:
                break
        else:
            ans[M] = cost

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

sol()


### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
from numba import njit
import numpy as np
INF = 10**18

@njit('(i8, i8[:,:])')
def solve(N, XYP):
    X = XYP[:, 0]
    Y = XYP[:, 1]

    def calcCost(sign, A):
        ret = np.ones((1 << N, N), dtype=np.int64) * INF
        for state in range(1 << N):
            useA = [a for i, a in enumerate(A) if (state & (1 << i)) != 0]
            for i in range(N):
                xyp = XYP[i]
                cost = abs(xyp[sign])
                for z in useA:
                    cost = min(cost, abs(xyp[sign] - z))
                ret[state][i] = cost * xyp[2]
        return ret

    costX = calcCost(0, X)
    costY = calcCost(1, Y)
    ans = np.ones(N + 1, dtype=np.int64) * INF

    for state in range(pow(3, N)):
        stateX = 0
        stateY = 0
        M = N
        for _ in range(N):
            state, r = divmod(state, 3)
            stateX <<= 1
            stateY <<= 1
            if r == 0: M -= 1
            if r == 1: stateX |= 1
            if r == 2: stateY |= 1

        cx, cy = costX[stateX], costY[stateY]
        cost = 0
        for i in range(N):
            cost += min(cx[i], cy[i])
        ans[M] = min(ans[M], cost)

    for a in ans:
        print(a)

def sol():
    N = int(input())
    XYP = np.asarray([list(map(int, input().split())) for _ in range(N)])
    solve(N, XYP)

sol()
### BUGGY CODE ###

#解説解答
#23:17
h,w,k = map(int,input().split())
x1,y1,x2,y2 = map(int,input().split())
x1 -= 1
y1 -= 1
x2 -= 1
y2 -= 1
a = []
for _ in range(h):
  a.append(input())
inf = 10**10
dijk = [[[inf for _ in range(w)] for _ in range(h)] for _ in range(4)]
import heapq
now = [[0,0,x1,y1]]
# 0up 1down 2right 3left
while now:
  pt,dr,x,y = heapq.heappop(now)
  if x == x2 and y == y2:
    print((pt-1)//k+1)
    break
  if pt > dijk[dr][x][y]:
    continue
    
  for dr2 in range(4):
    if dijk[dr2][x][y] > (pt-1)//k*k+k:
      dijk[dr2][x][y] = (pt-1)//k*k+k
      heapq.heappush(now,[(pt-1)//k*k+k,dr2,x,y])
  
  if dr == 0 and x != 0:
    if a[x-1][y] == '.' and dijk[dr][x-1][y] > pt+1:
      dijk[dr][x-1][y] = pt+1
      heapq.heappush(now,[pt+1,dr,x-1,y])
        
  if dr == 1 and x != h-1:
    if a[x+1][y] == '.' and dijk[dr][x+1][y] > pt+1:
      dijk[dr][x+1][y] = pt+1
      heapq.heappush(now,[pt+1,dr,x+1,y])
        
  if dr == 2 and y != 0:
    if a[x][y-1] == '.' and dijk[dr][x][y-1] > pt+1:
      dijk[dr][x][y-1] = pt+1
      heapq.heappush(now,[pt+1,dr,x,y-1])
  
  if dr == 3 and y != w-1:
    if a[x][y+1] == '.' and dijk[dr][x][y+1] > pt+1:
      dijk[dr][x][y+1] = pt+1
      heapq.heappush(now,[pt+1,dr,x,y+1])
  
  #print(now)
else:
  print(-1)
'''
for x in dijk:
  print('##')
  for y in x:
    print(y)
'''

### FIXED CODE ###

#16:41
h,w,k = map(int,input().split())
x1,y1,x2,y2 = map(lambda x:int(x)-1, input().split())
raw = []
for _ in range(h):
  raw.append(input())
inf = 10**6
seen = [[inf for _ in range(w)] for _ in range(h)]
seen[x1][y1] = 0
from heapq import heappush as push
from heapq import heappop as pop
now = [[0,x1,y1]]

while now:
  s,x,y = pop(now)
  if x == x2 and y == y2:
    print(s)
    exit()
  for i in range(1,k+1):
    if x-i == -1 or raw[x-i][y] == '@' or seen[x-i][y] < s+1:
      break
    if seen[x-i][y] != s+1:
      seen[x-i][y] = s+1
      push(now,[s+1,x-i,y])
  for i in range(1,k+1):
    if y-i == -1 or raw[x][y-i] == '@' or seen[x][y-i] < s+1:
      break
    if seen[x][y-i] != s+1:
      seen[x][y-i] = s+1
      push(now,[s+1,x,y-i])
  for i in range(1,k+1):
    if x+i == h or raw[x+i][y] == '@' or seen[x+i][y] < s+1:
      break
    if seen[x+i][y] != s+1:
      seen[x+i][y] = s+1
      push(now,[s+1,x+i,y])
  for i in range(1,k+1):
    if y+i == w or raw[x][y+i] == '@' or seen[x][y+i] < s+1:
      break
    if seen[x][y+i] != s+1:
      seen[x][y+i] = s+1
      push(now,[s+1,x,y+i])
print(-1)
### BUGGY CODE ###

from collections import Counter

N = int(input())

s_dict = {}
for _ in range(N):
  s = input()
  if s in s_dict:
    s_dict[s] += 1
  else:
    s_dict[s] = 1

max_keys = [k for k, v in s_dict.items() if v == max(s_dict.values())]
max_keys.sort()
for k in max_keys:
  print(k)

### FIXED CODE ###

from collections import Counter

N = int(input())

d = {}
for _ in range(N):
    S = input()
    if S in d:
        d[S] += 1
    else:
        d[S] = 1

m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
    print(s)
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from itertools import product

n, m, q = map(int, readline().split())
abcd = [list(map(int, readline().split())) for _ in range(q)]
ans = 0
for bit in product([1, 0], repeat=q):
    cnt = 0
    aaa = []
    aaaa = []
    for i, (a, b, c, d) in enumerate(abcd):
        if bit[i] == 1:
            aaa.append([a, b, c])
            cnt += d
    if ans < cnt:
        for a, b, c in aaa[::-1]:
            for aa, bb, cc in aaa:
                if aa == a and b < bb:
                    aaaa.append([b, bb, cc - c])
                elif aa == a and b > bb:
                    aaaa.append([bb, b, c - cc])
                if b == bb and aa > a:
                    aaaa.append([a, aa, cc - c])
                elif b == bb and aa < a:
                    aaaa.append([aa, a, c - cc])
        aaa += aaaa
        flag = True
        for i, (a, b, c, d) in enumerate(abcd):
            if bit[i] == 1:
                for aa, bb, cc in aaa:
                    if (aa <= a < b <= bb and c > cc) or (a <= aa < bb <= b and c < cc):
                        if aa == a and bb == b and c == cc:
                            continue
                        else:
                            flag = False
                            break
                if not flag:
                    cnt = 0
                    break
        if ans < cnt:
            ans = cnt
print(ans)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from itertools import combinations_with_replacement

n, m, q = map(int, readline().split())
abcd = [list(map(int, readline().split())) for _ in range(q)]
ans = 0
for seq in combinations_with_replacement(range(m), n):
    cnt = 0
    for a, b, c, d in abcd:
        if seq[b - 1] - seq[a - 1] == c:
            cnt += d
    ans = max(ans, cnt)
print(ans)
### BUGGY CODE ###

s = input()
n = len(s)
s_cu = [] 
counter = [0] * 2019

counter[0] += 1
temp=""
for i in range(1, n+1):
    temp = s[n-i] + (temp if i != 1 else "")
    s_cu.append(temp)
    counter[int(temp) % 2019] += 1

ans = 0
for i in counter:
    ans += (i * (i - 1)) // 2

print(ans)

### FIXED CODE ###

#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    S=input()
    n=len(S)
    
    S2=[0]*n
    digit=0
    for i in range(n-1,-1,-1):
        s=int(S[i])
        S2[i]=(s*pow(10,digit,2019))%2019
        digit+=1
    #print(S2)

    S3=[0]*n;subsum=0
    for j,s2 in enumerate(S2):
        subsum+=s2;subsum%=2019;S3[j]=subsum
    S3.append(0)
    #print(S3)

    from collections import Counter
    c=Counter(S3).values()
    ans=0
    for k in c:
        if k>1:
            ans+=(k*(k-1))//2
    print(ans)
#%%submit!
resolve()
### BUGGY CODE ###

H, W = map(int, input().split())
C = [input() for i in range(H)]

import sys
sys.setrecursionlimit(500000)


def search(x, y, z):
    if y >= H or x >= W or x < 0 or y <  0:
        return
    elif C[y][x] == z:
        return
    elif itta[y][x] == 1:
        return
    else:
        itta[y][x] = 1 # appendすると遅くなる
        prez = C[y][x]
        if C[y][x] == '.':
            itta_white[y][x] = 1
    
    search(x+1, y, prez)
    search(x-1, y, prez)
    search(x, y+1, prez)
    search(x, y-1, prez) 
ans = 0
# #を探しに行く
for y in range(H):
    for x in range(W):
        if C[y][x] != '#':
            pass
        else:
            itta = [[0] * W for i in range(H)]
            itta_white = [[0] * W for i in range(H)]
            search(x, y, '.')
            ans += sum(map(sum, itta_white)) 
            # 入れ子リスト（２次元配列）の合計値
            # https://maku77.github.io/python/numstr/sum.html

print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
C = [input() for i in range(H)]

import sys
sys.setrecursionlimit(500000)

itta = [[0] * W for i in range(H)]

def search(x, y, z):
    if y >= H or x >= W or x < 0 or y <  0:
        return
    elif C[y][x] == z:
        return
    elif itta[y][x] == 1:
        return
    elif C[y][x] == z:
        return
    else:
        itta[y][x] = 1
        
        if C[y][x] == '.':
            bw_count[0] += 1
        else:
            bw_count[1] += 1
        
        prez = C[y][x]
        
    search(x+1, y, prez)
    search(x-1, y, prez)
    search(x, y+1, prez)
    search(x, y-1, prez) 

ans = 0

for y in range(H):
    for x in range(W):
        if itta[y][x] ==1:
            pass
        else:
            bw_count = [0, 0]
            search(x, y, '-')
            
            ans += bw_count[0] * bw_count[1]  

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

N, K = map(int, input().split())
MOD = 1000000007

def f(n, k, i):
  if i == 1:
    return n - k + 1
  if i == 2:
    return (n - k + 1) * (n - k) // 2 * (k - 1)
  
  ret = 0
  for j in range(1, k - i + 2):
    for l in range(j + 1, n - k + j + 1):
      ret += f(n - l, k - j, i - 1)
  return ret

for i in range(1, K + 1):
  print(f(N, K, i) % MOD)

### FIXED CODE ###

N, K = map(int, input().split())
MOD = 1000000007

fact = [1]
for i in range(1, N):
  fact.append(fact[-1] * i)

def comb(n, k):
  return (fact[n] // (fact[n - k] * fact[k])) % MOD

def f2(n, k):
  return comb(n + k - 1, k - 1)

def f(n, k):
  if n < k:
    return 0
  if n == 0 and k == 0:
    return 1
  if k < 1:
    return 0
  return f2(n - k, k)

for i in range(1, K + 1):
  blue = f(K, i)
  red = (f(N - K, i - 1) + 2 * f(N - K, i) + f(N - K, i + 1)) % MOD
  ans = blue * red
  print(ans % MOD)
### BUGGY CODE ###

n=int(input())
ans=[[] for _ in range(n+10)]
for i in range(1,n+1):
    for j in range(1,n+1):
        if i*j>=n+2:
            break
        ans[i*j].append(i)
a=0
for i in range(n+1):
    a+=i*len(ans[i])
print(a)

### FIXED CODE ###

n,a=int(input()),0
for x in range(1,n+1):
    y=n//x
    a+=y*(y+1)*x//2
print(a)
### BUGGY CODE ###

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 6       # N は必要分だけ用意する
fact = [1, 1]     # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]      # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

n,a,b = map(int, input().split())
ans = 2**n -1 -cmb(n,a,p) -cmb(n,b,p)
print(ans)

### FIXED CODE ###

def comb(n, r, p):
    numer = 1
    denom = 1
 
    for i in range(n-r+1, n+1):
        numer = numer * i % p
    for i in range(1, r+1):
        denom = denom * i % p
    return numer * pow(denom, p-2, p) % p
 
p = pow(10, 9) + 7
n, a, b = map(int, input().split())
print(((pow(2, n, p) - comb(n, a, p) - comb(n, b, p) - 1)) % p)
### BUGGY CODE ###

#Knapsack1
N, W = map(int, input().split())
weight = []
value = []
# N,W =3, 8
# wv_lst = [list(map(int, input().split())) for _ in range(N)]
for i in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    value.append(v)
# weight = [3, 4, 5]
# value = [30, 50, 60]

dp = [[0] * (W+1) for _ in range(N+1)]

for n in range(1, N+1):
    weigh = weight[n-1]
    val = value[n-1]
    for w in range(W+1):
        if w < weigh:
            dp[n][w] = dp[n-1][w]
        else:
            dp[n][w] = max(dp[n-1][w], 
                        dp[n-1][w-weigh] + val)
        
# print([dp[i] for i in range(N+1)])
print(dp[-1][-1])
        



### FIXED CODE ###

#Knapsack1
N, W = map(int, input().split())
weight = []
value = []
# N,W =3, 8
# wv_lst = [list(map(int, input().split())) for _ in range(N)]
for i in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    value.append(v)
# weight = [3, 4, 5]
# value = [30, 50, 60]

dp = [[0] * (W+1) for _ in range(N+1)]

for n in range(1, N+1):
    weigh = weight[n-1]
    val = value[n-1]
    for w in range(W+1):
        if w < weigh:
            dp[n][w] = dp[n-1][w]
        else:
            dp[n][w] = max(dp[n-1][w], 
                        dp[n-1][w-weigh] + val)
        
# print([dp[i] for i in range(N+1)])
print(dp[-1][-1])
### BUGGY CODE ###

from bisect import bisect
import numpy as np
a,b,q = map(int, input().split())
s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]

for _ in range(q):
    x = int(input())
    # print('x', x)
    ss = bisect(s, x)
    tt = bisect(t, x)
    tmp = []
    if ss > 0 and tt > 0:
        i = abs(s[ss-1] - x)
        j = abs(t[tt-1] - x)
        if sorted([s[ss-1], x, t[tt-1]]).index(x) == 1:
            # print(i+j+min(i,j), s[ss-1], t[tt-1])
            tmp.append(np.sum([i,j,min(i,j)]))
        else:
            # print((i-j), s[ss-1], t[tt-1])
            tmp.append(max(i,j))
    if 0 < ss and tt < b:
        i = abs(s[ss-1] - x)
        j = abs(t[tt] - x)
        if sorted([s[ss-1], x, t[tt]]).index(x) == 1:
            tmp.append(np.sum([i,j,min(i,j)]))
        else:
            tmp.append(max(i,j))
    if ss < a and tt > 0:
        i = abs(s[ss] - x)
        j = abs(t[tt-1] - x)
        if sorted([s[ss], x, t[tt-1]]).index(x) == 1:
            # print(i+j+min(i,j), s[ss], t[tt-1])
            tmp.append(np.sum([i,j,min(i,j)]))
        else:
            # print(i-j, s[ss], t[tt-1])
            tmp.append(max(i,j))
    if ss < a and tt < b:
        i = abs(s[ss] - x)
        j = abs(t[tt] - x)
        if sorted([s[ss], x, t[tt]]).index(x) == 1:
            # print(i+j+min(i,j), s[ss], t[tt])
            tmp.append(np.sum([i,j,min(i,j)]))
        else:
            # print(i-j, s[ss], t[tt])
            tmp.append(max(i,j))
    # print(tmp, ss, tt)
    print(min(tmp))



### FIXED CODE ###

from bisect import bisect
a,b,q = map(int, input().split())
s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]

inf = float('INF')
for _ in range(q):
    x = int(input())
    # print('x', x)
    ss = bisect(s, x)
    tt = bisect(t, x)
    ans = inf
    for i in range(max(ss-1,0),min(ss+1,a)):
        for j in range(max(tt-1,0),min(tt+1,b)):
            ii,jj = abs(s[i] - x) + abs(s[i] - t[j]), abs(t[j] - x) + abs(s[i] - t[j])
            tmp = min(ii,jj)
            if ans > tmp:
                ans = tmp
    print(ans)
### BUGGY CODE ###

s = input()
mod = 10**9+7

init = [0 for i in range(13)]
if s[0] == '?':
  dp = [1] * 10 + [0] * 3
else:
  dp = [0 for i in range(13)]
  dp[int(s[0])] = 1

for c in s[1:]:
  d = init.copy()
  if c == '?':
    for i in range(13):
      for j in range(10):
        idx = (i * 10 + j) % 13
        d[idx] = (dp[i] + d[idx]) % mod 
  else :
    for i in range(13):
      idx = (i * 10 + int(c)) % 13
      d[idx] = (dp[i] + d[idx]) % mod
  dp = d.copy()
print(dp[5])


### FIXED CODE ###

def main():
    M=10**9+7
    r=tuple(tuple((j-k)*9%13for j in range(10))for k in range(13))
    d=[1]+[0]*12
    for c in input():
        if c > '9':
            d = [sum(d[j] for j in k)%M for k in r] 
        else:
            d = [d[(int(c)-k)*9%13] for k in range(13)]
    print(d[5])
main()
### BUGGY CODE ###

from sys import stdin
from collections import defaultdict

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]

mod = 10 ** 9 + 7
g = defaultdict(int)
ans = 0

for i in range(N):
    tmp = 1
    a = A[i]
    g_tmp = defaultdict(int)
    while tmp <= A[i] ** 0.5:
        while tmp > 1 and a % tmp == 0:
            a //= tmp
            if tmp not in g_tmp:
                g_tmp[tmp] = 1
            else:
                g_tmp[tmp] += 1
        tmp += 1
    if a > 1:
        if a not in g_tmp:
            g_tmp[a] = 1
        else:
            g_tmp[a] += 1

    for j in g_tmp:
        if j not in g:
            g[j] = g_tmp[j]
        else:
            g[j] = max(g[j], g_tmp[j])

l = 1
ans = 0
for i in g:
    l *= pow(i, g[i], mod)
for a in A:
    ans += l * pow(a, mod - 2, mod)
    ans %= mod

print(ans)

### FIXED CODE ###

from sys import stdin
from collections import defaultdict

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]

mod = 10 ** 9 + 7
g = defaultdict(int)

for i in range(N):
    tmp = 1
    a = A[i]
    while tmp <= A[i] ** 0.5:
        cnt = 0
        while tmp > 1 and a % tmp == 0:
            a //= tmp
            cnt += 1
        if cnt > 0:
            g[tmp] = max(g[tmp], cnt)
        tmp += 1
    if a > 1:
        if a not in g:
            g[a] = 1

l = 1
ans = 0
for i in g:
    l *= pow(i, g[i], mod)
    l %= mod
for a in A:
    ans += l * pow(a, mod - 2, mod)
    ans %= mod

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

from collections import Counter, defaultdict, deque

N, X, Y = [int(x) for x in input().split()]


def bfs(source):
    q = deque([source])
    dist = {source: 0}
    while q:
        i = q.popleft()
        d = dist[i]
        nbr = []
        if i - 1 >= 1:
            nbr.append(i - 1)
        if i + 1 <= N:
            nbr.append(i + 1)
        if i == X:
            nbr.append(Y)
        if i == Y:
            nbr.append(X)
        for j in nbr:
            if j not in dist:
                q.append(j)
                dist[j] = d + 1
    return dist


count = Counter()
for i in range(1, N + 1):
    dist = bfs(i)
    assert len(dist) == N
    for j, d in dist.items():
        if i < j:
            count[d] += 1

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


### FIXED CODE ###

import sys

from collections import Counter, defaultdict, deque

input = sys.stdin.readline

N, X, Y = [int(x) for x in input().split()]


def bfs(source):
    q = deque([source])
    dist = {source: 0}
    while q:
        i = q.popleft()
        d = dist[i]
        nbr = []
        if i - 1 >= 1:
            nbr.append(i - 1)
        if i + 1 <= N:
            nbr.append(i + 1)
        if i == X:
            nbr.append(Y)
        if i == Y:
            nbr.append(X)
        for j in nbr:
            if j not in dist:
                q.append(j)
                dist[j] = d + 1
    return dist


count = Counter()
for i in range(1, N + 1):
    dist = bfs(i)
    assert len(dist) == N
    for j, d in dist.items():
        if i < j:
            count[d] += 1

ans = []
for k in range(1, N):
    ans.append(str(count[k]))
print('\n'.join(ans))