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

N = int(input())
a_s = input().split(" ")
a_s = list(map(int, a_s))

mod = 10**9 +7
ans = 0
for i in range(len(a_s)-1):
  ans += (sum(a_s[i+1:])*a_s[i])%mod
  if ans > mod:
    ans = ans%mod
      
print(ans)

### FIXED CODE ###

N = int(input())
a_s = input().split(" ")
a_s = list(map(int, a_s))
asum = sum(a_s)

mod = 10**9 +7
ans = 0
for i in range(len(a_s)-1):
  asum -= a_s[i]
  ans += (asum*a_s[i])%mod
  if ans > mod:
    ans = ans%mod
      
print(ans)
### BUGGY CODE ###

import numpy as np
from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
N=int(input())
tree=[[0]*N for i in range(N)]
for i in range(N-1):
    a,b,c=map(int,input().split(' '))
    tree[a-1][b-1] = c
    tree[b-1][a-1] = c
tree = np.array(tree)
Q,K=map(int,input().split(' '))
ans = dijkstra(tree,indices=K-1)
for i in range(Q):
    s,e=map(int,input().split(' '))
    print(int(ans[s-1]+ans[e-1]))

### FIXED CODE ###

from collections import deque

N = int(input())
ABC=[map(int,input().split(' ')) for i in range(N-1)]
Q,K =  map(int,input().split(' '))
query = [map(int,input().split(' ')) for i in range(Q)]
tree = [[] for i in range(N+1)]
for a,b,c in ABC:
    tree[b].append((a,c))
    tree[a].append((b,c))
k_shortest = [0]*(N+1)
stack=deque([K])
while stack:
    k = stack.popleft()
    for v,d in tree[k]:
        if k_shortest[v] == 0:
            k_shortest[v] = k_shortest[k]+d
            stack.append(v)
for i,j in query:
    print(k_shortest[i]+k_shortest[j])
### BUGGY CODE ###

from collections import defaultdict

H,W,M = map(int,input().split())
bomb = [[0,0] for _ in range(M)]
bomb_d = defaultdict(int)

for i in range(M):
    bomb[i] = list(map(int,input().split()))
    bomb[i][0] -= 1
    bomb[i][1] -= 1
    bomb_d[tuple(bomb[i])] = 1


dh = [0]*H
dw = [0]*W

for i in range(M):
    dh[bomb[i][0]] += 1
    dw[bomb[i][1]] += 1

Maxh = max(dh)
Maxw = max(dw)

h_p = []
w_p = []

for i in range(H):
    if dh[i] == Maxh:
        h_p.append(i)
for i in range(W):
    if dw[i] == Maxw:
        w_p.append(i)

f = 0
for h in h_p:
    for w in w_p:
        if bomb_d[(h,w)] != 1:
            f = 1

if f == 0:
    print(Maxh+Maxw-1)
else:
    print(Maxh+Maxw)













### FIXED CODE ###

from collections import defaultdict

H,W,M = map(int,input().split())
bomb = [[0,0] for _ in range(M)]
bomb_d = defaultdict(int)

for i in range(M):
    bomb[i] = list(map(int,input().split()))
    bomb[i][0] -= 1
    bomb[i][1] -= 1
    bomb_d[tuple(bomb[i])] = 1


dh = [0]*H
dw = [0]*W

for i in range(M):
    dh[bomb[i][0]] += 1
    dw[bomb[i][1]] += 1

Maxh = max(dh)
Maxw = max(dw)

h_p = []
w_p = []

for i in range(H):
    if dh[i] == Maxh:
        h_p.append(i)
for i in range(W):
    if dw[i] == Maxw:
        w_p.append(i)

f = 0
for h in h_p:
    for w in w_p:
        if bomb_d[(h,w)] != 1:
            f = 1
            break
    else:
        continue
    break

if f == 0:
    print(Maxh+Maxw-1)
else:
    print(Maxh+Maxw)
### BUGGY CODE ###

def Warshall_Floyd(edges,N):
  """頂点N個のグラフ上の隣接行列edges(空欄はinfとせよ)が与えられたとき, 
  2点間の最短距離距離を隣接行列で返す"""
  for k in range(N):
    for i in range(N):
      for j in range(i):
        if edges[i][j]>edges[i][k]+edges[k][j]: return 1
  return 0
 
import sys
from sys import stdin
input = stdin.readline
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]
if Warshall_Floyd(A,N):
  print(-1)
  sys.exit()
 
ans=0
for i in range(N):
  for j in range(i):
    need=1
    for k in range(N):
      if k!=i and k!=j:
        if A[i][j]==A[i][k]+A[k][j]:
          need=0
          break
    ans+=need*A[i][j]
print(ans)

### FIXED CODE ###

def Warshall_Floyd(edges,N):
  """頂点N個のグラフ上の隣接行列edges(空欄はinfとせよ)が与えられたとき, 
  2点間の最短距離距離を隣接行列で返す"""
  for k, i, j in itertools.product(range(N), range(N),range(N)):
    if edges[i][j]>edges[i][k]+edges[k][j]: return 1
  return 0
 
import sys
import itertools
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]
if Warshall_Floyd(A,N):
  print(-1)
  sys.exit()
 
ans=0
for i, j in itertools.product(range(N),range(N)):
  need=1
  for k in range(N):
    if k!=i and k!=j and A[i][j]==A[i][k]+A[k][j]:
      need=0
      break
  if need:ans+=A[i][j]
print(ans//2)
### BUGGY CODE ###

import sys
from collections import Counter
from itertools import combinations

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    s = input()
    D = Counter(s)
    idx = [[] for _ in range(26)]
    for k, v in D.items():
        if v >= 2:
            for i in range(n):
                if s[i] == k:
                    idx[ord(k) - 97].append(i)

    res = 0
    for i in idx:
        if not i:
            continue
        tmp = 0
        for pattern in combinations(i, 2):
            left_init, right_init = pattern
            left, right = left_init, right_init
            length = 0
            while right < n and left < right_init:
                if s[left] == s[right]:
                    length += 1
                    left += 1
                    right += 1
                else:
                    break
            tmp = max(tmp, length)
        res = max(res, tmp)
    print(res)


if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    s = input()

    dp = [[0] * (n + 1) for _ in range(n + 1)]
    for i in reversed(range(n)):
        for j in reversed(range(n)):
            if s[i] == s[j]:
                dp[i][j] = dp[i + 1][j + 1] + 1

    res = 0
    for i in range(n):
        for j in range(n):
            if i < j:
                now = min(dp[i][j], j - i)
                res = max(res, now)
    print(res)


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

def combination_modp(n, r, p): # nCr modpを求める
    r = min(n-r, r)
    result = 1
    for i in range(n, n-r, -1):
        result *= i
        result %=p
    for i in range(1, r+1):
        result *= pow(i,p-2,p)
        result %= p
    return result

n = int(input())
a = list(map(int,input().split()))
search = [-1 for i in range(n)]
l,r = -1,-1
for i,x in enumerate(a):
    if search[x-1] == -1:
        search[x-1] = i
    else:
        l = search[x-1]
        r = i
#print(l,r)
p = 10**9 + 7
for i in range(1,n+2):
    if l+n-r+1 >= i:
        ans = combination_modp(n+1,i,p)-combination_modp(l+n-r,i-1,p)
    else:
        ans = combination_modp(n+1,i,p)
    print(ans%p)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
search = [-1 for i in range(n)]
l,r = -1,-1
for i,x in enumerate(a):
    if search[x-1] == -1:
        search[x-1] = i
    else:
        l = search[x-1]
        r = i
#print(l,r)
p = 10**9 + 7

#前計算
comb1 = [0 for _ in range(n+1)]
comb1[0] = n+1
x = n+1
for i in range(1,n+1):
    x = (x*(n-i+1))%p
    x = (x*pow(i+1,p-2,p))%p
    comb1[i] = x

comb2 = [0 for _ in range(n+1)]
comb2[0] = 1
x = 1
for i in range(1,l+n-r+1):
    x = (x*(n+l-r-i+1))%p
    x = (x*pow(i,p-2,p))%p
    comb2[i] = x

for i in range(n+1):
    ans = comb1[i]-comb2[i]

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

import math as m

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

if N >= B:
  print(m.floor(A * -1 / B) - A * m.floor(-1 / B))

else:
  list = []
  flag = 0
 
  list += [m.floor(A * 0 / B) - A * m.floor(0 / B)]
  
  for x in range(1, N + 1):
    list += [m.floor(A * x / B) - A * m.floor(x / B)]
    if list[x] < list[x - 1]:
      print(list[x - 1])
      flag = 1
      break
      
  if flag == 0: print(max(list))

### FIXED CODE ###

import math as m
A, B, N = map(int, input().split())
if N >= B: print(m.floor(A * -1 / B) - A * m.floor(-1 / B))
else: print(m.floor(A * N / B) - A * m.floor(N / B))
### BUGGY CODE ###

from collections import defaultdict
import heapq

def dijkstra(G, s):
    prev = [None] * len(G.keys())
    dist = [float('inf')] * len(G.keys())
    dist[s] = 0
    q = [(dist[v], v) for v in G.keys()]
    heapq.heapify(q)
    while True:
        try:
            _, u = heapq.heappop(q)
        except:
            break
        for v, d in G[u]:
            tmp = dist[u] + d
            if dist[v] > tmp:
                dist[v] = tmp
                prev[v] = u
                heapq.heappush(q, (tmp, v))
    return dist

n, m, s, t = map(int, input().split())
G1 = defaultdict(list)
G2 = defaultdict(list)

for i in range(m):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    G1[u].append((v, a))
    G1[v].append((u, a))
    G2[u].append((v, b))
    G2[v].append((u, b))

dist1 = dijkstra(G1, s-1)
dist2 = dijkstra(G2, t-1)

mv = 0
ans = []
for i in range(n-1, -1, -1):
    mv = max(mv, 10**15 - dist1[i] - dist2[i])
    ans.append(mv)

ans.reverse()
for a in ans:
    print(a)

### FIXED CODE ###

from collections import defaultdict
import heapq

def dijkstra(G, s):
    q = []
    heapq.heapify(q)
    prev = [None] * len(G.keys())
    dist = [float('inf')] * len(G.keys())
    dist[s] = 0
    for v in sorted(G.keys()):
        heapq.heappush(q, (dist[v],v))
    while True:
        try:
            _, u = heapq.heappop(q)
        except:
            break
        for v, d in G[u]:
            tmp = dist[u] + d
            if dist[v] > tmp:
                dist[v] = tmp
                prev[v] = u
                heapq.heappush(q, (tmp, v))
    return dist

n, m, s, t = map(int, input().split())
G1 = defaultdict(list)
G2 = defaultdict(list)

for i in range(m):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    G1[u].append((v, a))
    G1[v].append((u, a))
    G2[u].append((v, b))
    G2[v].append((u, b))

dist1 = dijkstra(G1, s-1)
dist2 = dijkstra(G2, t-1)

mv = 0
ans = []
for i in range(n-1, -1, -1):
    mv = max(mv, 10**15 - dist1[i] - dist2[i])
    ans.append(mv)

ans.reverse()
for a in ans:
    print(a)
### BUGGY CODE ###

#import numpy as np

n = int(input())
A = [list(map(int,input().split())) for i in range(n)]

for i in range(n):
    for j in range(n-1):
        A[i][j] -= 1

#print(A)

S = [0 for i in range(n)]
#F = [[0 for i in range(n)] for j in range(2*n*n)]

n1n = n*(n-1)

d = 0
for ii in range(n*n*2):
    F = [0 for i in range(n)]
    co = 0
    i = 0
    ga = 0
    for jj in range(n*n*2):
        if F[i] == 0 and S[i] <= n-2:
            aite = A[i][S[i]]
            #print(S)
            #print("aite",aite)
            if aite < n and A[aite][S[aite]] == i and F[aite] == 0:
                #print("g", i, aite)
                S[i] += 1
                S[aite] += 1
                F[i] = 1
                F[aite] = 1
                co = 0
                ga += 1
        i = (i+1) % n
        co += 1
        if co == n-1:
            break
    d += 1
    #print("d", d)
    if ga == 0:
        if sum(S) == n1n:
            print(d-1)
        else:
            print(-1)
        break



### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
A = [list(map(int,input().split())) for i in range(n)]
for i in range(n):
    for j in range(n-1):
        A[i][j] -= 1

AA = [[j for j in i] for i in A]

ID = [[-1] * n for i in range(n)]
id_ = 0
for i in range(n):
    for j in range(i+1,n):
        ID[i][j] = id_
        ID[j][i] = id_
        id_ += 1

for i in range(n):
    for j in range(n-1):
        A[i][j] = ID[i][A[i][j]]

M = [[] for i in range(id_)]
IN = [0] * id_
for i in range(n):
    for j in range(n-2):
        M[A[i][j]].append(A[i][j+1])
        IN[A[i][j+1]] +=1
# print(A)
# print(M)

# 以下、トポロジカルソート

S = []
s = 0

for i in range(id_):
    if IN[i] == 0:
        S.append(i)

while s < len(S):
    for x in M[S[s]]:
        IN[x] -= 1
        # print(x,IN)
        if IN[x] == 0:
            S.append(x)
    s += 1

# print(S)

if len(S) < id_:
    print(-1)
else:
    T = [1] * id_
    for i in range(id_):
        for j in M[S[i]]:
            T[j] = max(T[j], T[S[i]] + 1)
    print(max(T))


# 以下、閉路検出(今は削除)

# V = [0] * id_
# S = [0]
# V[0] = 1

# import sys

# def visit(x):
#     if V[x] == 1:
#         print(-1)
#         sys.exit()
#     elif V[x] == 0:
#         V[x] = 1
#         for i in M[x]:
#             visit(i)
#         V[x] = 2

# for i in range(id_):
#     if V[i] == 0:
#         visit(i)
# print("heironasi")

# 閉路検出ここまで
### BUGGY CODE ###

import math

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

if abs(N-M)>=2:
    print(0)
elif abs(N-M)==1:
    print(math.factorial(N)*math.factorial(M))
else:
    print((2*math.factorial(N)*math.factorial(M))%(10**9+7))  

### FIXED CODE ###

import math

def f(n):
    if n==1:
        return 1
    return n*f(n-1)

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

if abs(N-M)>=2:
    print(0)
elif abs(N-M)==1:
    print(math.factorial(N)*math.factorial(M)%(10**9+7))
else:
    print((2*math.factorial(N)*math.factorial(M))%(10**9+7))
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


L = LI2()
N = len(L)
mod = 10**9+7

ans = 0
a = 1
for i in range(N):
    if L[i] == 1:
        ans += pow(3,N-i-1)*a
        ans %= mod
        a *= 2
        a %= mod

print((ans+a) % mod)


### FIXED CODE ###

import sys

def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

L = LI2()
l = len(L)
mod = 10**9+7

A = []
for i in range(l):
    if L[i] == 1:
        A.append(l-i-1)
A.append(0)

ans = 0
for i in range(len(A)):
    ans += pow(3,A[i],mod)*pow(2,i,mod)
    ans %= mod

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

from sys import stdin
input = stdin.readline

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


C = [-1] * (N + 1)


def comb(N, r):
    r = min(r, N - r)

    if C[r] != -1:
        return C[r]
    else:
        ue = 1
        shita = 1

        for i in range(r):
            ue *= (N - i)
            ue %= mod
            shita *= (i + 1)
            shita %= mod

        C[r] = ue * pow(shita, mod - 2, mod)
        C[r] %= mod
        return C[r]


ans = 0

for i in range(K + 1):
    ans += M * pow(M - 1, N - 1 - i, mod) * comb(N - 1, i)
    ans %= mod

print(ans)
# print(C)


### FIXED CODE ###

from sys import stdin
input = stdin.readline

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


C = [-1] * (N + 1)


def comb(n, r):
    if r > n - r:
        C[r] = C[n - r]

    if r == 0:
        C[0] = 1

    if C[r] != -1:
        return C[r]
    else:
        C[r] = comb(n, r - 1) * (n + 1 - r) * pow(r, mod - 2, mod)
        C[r] %= mod
        return C[r]


ans = 0

for i in range(K + 1):
    ans += M * pow(M - 1, N - 1 - i, mod) * comb(N - 1, i)
    ans %= mod

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

from copy import deepcopy

N = int(input())

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

n = prime_factors(N)

dicts = {}
for x in range(2**len(n)):
    flgs = bin(x)[2:]
    if len(flgs) < len(n):
        flgs = ''.join(['0' for _ in range(len(n)-len(flgs))]) + flgs
    flgs = flgs[::-1]
    
    a = 1
    b = 1
    for i in range(len(flgs)):
        if flgs[i] == '1':
            a *= n[i]
        else:
            b *= n[i]
    dicts[a+b] = {'a':deepcopy(a), 'b':deepcopy(b)}

            
min_ab = min(dicts.keys())
print(dicts[min_ab]['a'] + dicts[min_ab]['b'] - 2)

### FIXED CODE ###

N = int(input())
 
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    # divisors.sort()
    return divisors
 
n = sorted(make_divisors(N))

sum_yakusuu = N
for _n in n:
    if _n == 1:
        continue
    if _n+N/_n < sum_yakusuu:
        sum_yakusuu = int(_n+N/_n)
        bef_n = _n
    else:
        if len(n) == 2:
            print(int(_n-1))
        else:
            print(int(bef_n+N/bef_n-2))
        break
### BUGGY CODE ###

N, S = map(int, input().split())
A = list(map(int, input().split()))
d = sum(A)
mod = 998244353

"""
多項式係数を使った数え上げでリベンジしてみる。
maspyさんのを参考に実装する。

やってみてわかったけど、実装自体はdpでやったのとほぼ同じ。
多項式係数を使う方法は実質flexibleなdpということ？
"""

f = [0] * (1 + d) # f[i] = (coefficient of degree i)
ans = 0

for i in range(N):
    g = [0] * (1 + d) # g = (1 + f) * (1 + x^{A[i]})
    f[0] += 1
    for j in range(1 + d):
        if j - A[i] < 0:
            g[j] = f[j]
        else:
            g[j] = f[j] + f[j - A[i]]
    ans += g[S]
    ans %= mod
    f = g

print(ans)


### FIXED CODE ###

N, S = map(int, input().split())
A = [0] + list(map(int, input().split()))
mod = 998244353

dp = [0] * (S + 1)
dp2 = [0] * (S + 1)

"""
dp[i][j] = (i個までの数を使ってj点とる組み合わせ)
としたはいいが、f(L, R)をf(1,L)とf(1, R)に分解できずに爆死したのが敗因。

各(L, R)に対してdpするとTLEになるから手詰まりになると思ったわけだけど、
上のdpテーブルを各iに対して使い回しつつ、新たなdpテーブル[1, 0, 0, ...]を
作成して「元のdpテーブルに加算しておけば」dpテーブル一個で1番目スタート、2番目スタート、
..., L番目スタートのdpテーブル全てを考えられる！
（解説放送前半を参考）
"""

# i == 0の時
dp[0] = 1
ans = 0

# i >= 1の時
for i in range(1, N + 1):
    for j in range(S + 1):
        if j - A[i] < 0:
            dp2[j] = dp[j]
        else:
            dp2[j] = dp[j] + dp[j - A[i]]
    ans += dp2[S]
    ans %= mod

    dp = dp2 # deepcopyしなくてもこれで十分なはずだし、ポインタ渡しなので高速？
    dp[0] += 1
    dp2 = [0] * (S + 1)

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


def main():
  import sys
  input = sys.stdin.readline

  N = int(input())
  A = list(map(int, input().split()))
  T = set(A)
  mod = 10 ** 9 + 7

  from fractions import gcd
  from functools import reduce

  def lcm(x, y):
    return x * y // gcd(x, y)

  L = reduce(lcm, T)

  B = [None] * N

  for i in range(N):
    B[i] = (L // A[i]) % mod

  print(sum(B) % mod)

if __name__ == '__main__':
    main()

### FIXED CODE ###


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

from fractions import gcd

L = A[0]
for i in range(1,N):
  L=(L*A[i])//gcd(L,A[i])

ans = 0

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

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

#!/usr/bin/env python3
N = int(input())

print(0, flush=True)
w1 = input()
if w1 == 'Vacant':
    exit()

l, r = 0, N - 1
while r - l > 1:
    m = (l + r) // 2
    print(m, flush=True)
    w2 = input()
    if w2 == 'Vacant':
        break
    if w1 == w2:
        l, r = (l, m) if (m - l) & 1 else (m + 1, r)
    else:
        l, r = (m + 1, r) if (m - l) & 1 else (l, m)
    w1 = w2
print(l, flush=True)


### FIXED CODE ###

#!/usr/bin/env python3
N = int(input())

print(0, flush=True)
w0 = input()
if w0 == 'Vacant':
    exit()

l, r = 0, N
while True:
    m = (l + r) // 2
    print(m, flush=True)
    w1 = input()
    if w1 == 'Vacant':
        break
    if m % 2 == (w0 != w1):
        l = m
    else:
        r = m
### BUGGY CODE ###

import numpy as np

def main():
  n=int(input())
  s=np.array([ord(i) for i in input()])
  dp=np.zeros((n,n),dtype=int)
  for i in range(n-1):
    for j in range(i+1,n):
      if s[i]==s[j]:
        dp[i][j]=min(j-i, dp[i-1][j-1]+1)
  print(np.amax(dp))
        

if __name__=='__main__':
  main()

### FIXED CODE ###

def main():
  n=int(input())
  s=input()
  dp=[[0]*(n+1) for i in range(n+1)]
  for i in range(n-1,-1,-1):
    for j in range(n-1,i,-1):
      if s[i]==s[j]:
        dp[i][j]=dp[i+1][j+1]+1
  #for i in dp:
  #  print(i)
  
  ans=0
  for i in range(n-1):
    for j in range(i+1,n):
      ans=max(ans,min(j-i,dp[i][j]))
  print(ans)      
        

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

#!/usr/bin/env python3

def main():
    N = int(input())
    L = sorted(map(int, input().split()),reverse=True)
    ans = 0
    for a in range(N - 2):
        for b in range(a + 1, N - 1):
            if L[a] > 2*L[b]:
                break
            for c in range(b + 1, N):
                if L[a] < L[b] + L[c] and L[b] < L[c] + L[a]:
                    ans += 1
                else:
                    break

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import bisect


def main():
    N = int(input())
    L = sorted(map(int, input().split()))
    ans = 0
    for a in range(N - 2):
        for b in range(a + 1, N - 1):
            ans += bisect.bisect_right(L, L[a] + L[b] - 1) - b - 1

    print(ans)


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

from collections import deque
l=lambda:[int(x) for x in input().split()]
H,W=l()
CH,CW=l()
DH,DW=l()
S=[[x=='#' for x in list(input())] for _ in range(H)]
d={(CH-1,CW-1):0}
q=deque([(CH-1,CW-1,0)])
def check(h,w,c,o):
    if h < 0 or h >= H or w < 0 or w >= W:
        return False
    key=(h,w)
    if key in d:
        if d[key]<=c:
            return False
    if S[h][w]:
        return False
    if o:
        q.append((h,w,c))
        d[key]=c
    else:
        q.appendleft((h,w,c+1))
        d[key]=c+1
    return True
while q:
    h,w,c=q.pop()
    # walk
    check(h-1,w-0,c,True)
    check(h-0,w-1,c,True)
    check(h+1,w+0,c,True)
    check(h+0,w+1,c,True)
    # warp
    check(h-1,w-1,c,False)
    check(h+1,w+1,c,False)
    for i in [-2,+2]:
        for j in range(-2,3):
            check(h+i,w+j,c,False)
            check(h+j,w+i,c,False)
key=(DH-1,DW-1)
if key in d:
    print(d[key])
else:
    print(-1)

### FIXED CODE ###

def l():
    return [int(x) for x in input().split()]
def main():
    H,W=l()
    ch,cw=l()
    dh,dw=l()
    ch-=1
    cw-=1
    dw-=1
    dh-=1
    s=[[-2 if x=='#' else -1 for x in list(input())] for _ in range(H)]
    pad1=[-2,-2]
    pad2=[[-2]*(W+4)]*2
    s=pad2+[pad1+x+pad1 for x in s]+pad2
    move1=[(-1,0),(1,0),(0,-1),(0,1)]
    move2=list(set([(i,j) for i in range(-2,3) for j in range(-2,3)])-set(move1)-set([(0,0)]))
    q1=[(0,ch+2,cw+2)]
    q2=[]
    s[ch+2][cw+2]=0
    def mark(c,h,w):
        #if 0<=h<H and 0<=w<W and s[h][w]==-1:
        if s[h][w]==-1:
            s[h][w]=c
            q1.append((c,h,w))
    while q1:
        #print(q1)
        c,h,w=q1.pop()
        for i,j in move1:
            mark(c,h+i,w+j)
        q2.append((c+1,h,w))
        if not q1:
            for c,h,w in q2:
                for i,j in move2:
                    mark(c,h+i,w+j)
            q2=[]
    ans=s[dh+2][dw+2]
    if ans>=0:
        print(ans)
    else:
        print(-1)
main()
### BUGGY CODE ###

n=int(input())

dl_list=[]

for i in range(n):
    cmd=input().split()
    if cmd[0]=="insert":
        dl_list.insert(0,cmd[1])
    elif cmd[0]=="delete":
        try:
            dl_list.remove(cmd[1])
        except:
            pass
    elif cmd[0]=="deleteFirst":
        del dl_list[0]
    elif cmd[0]=="deleteLast":
        del dl_list[-1]

print(" ".join(dl_list))

### FIXED CODE ###

from collections import deque
n=int(input())
dq=deque()

for i in range(n):
    cmd=input().split()
    if cmd[0]=="insert":
        dq.appendleft(cmd[1])
    elif cmd[0]=="deleteFirst":
        dq.popleft()
    elif cmd[0]=="deleteLast":
        dq.pop()
    elif cmd[0]=="delete":
        try:
            dq.remove(cmd[1])
        except:
            pass
print(*dq)
### BUGGY CODE ###

import math
def main():

    N = int(input())
    cnt = dict()
    for i in range(1, N+1):
        for j in range(1, N+1):
            if i * j < N:
                cnt[i*j] = cnt.get(i*j, 0) + 1
            else:
                break
    ans = 0
    for i in range(1, N):
        if N-i in cnt:
            ans += cnt[N-i]
    return ans


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

### FIXED CODE ###

import math
def main():

    N = int(input())
    ans = 0
    for i in range(1, N):
        j = N // i
        if i * j == N:
            j -=1
        ans += max(j, 0)
    return ans

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