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

n = int(input(''))
adl = input('')

a = list(map(int,adl.split(' ')))

number = 0

mod = 7+1000000000

amari = 0

for i in range(n):
    for e in range(n):
        if i != e:
            number = number + (a[i] * a[e])
amari = int((number % mod) / 2)
print(amari)


### FIXED CODE ###

n = int(input(''))
adl = input('')

a = list(map(int,adl.split(' ')))

number = 0

mod = 1000000007

amari = 0

all_a = 0

for i in range(n):
    all_a = all_a + a[i]

for i in range(n):
    all_a = all_a - a[i]
    number = number + (a[i] * all_a)
    number = number % mod
amari = number % mod
print(amari)
### BUGGY CODE ###

def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    d = collections.defaultdict(list)
    for i in range(m):
        a, b = list(map(int, input().rstrip('\n').split()))
        if a == 1 or a == n:
            d[a] += [b]
        if b == 1 or b == n:
            d[b] += [a]
    if 1 in d and n in d:
        for i in d[1]:
            for j in d[n]:
                if i == j:
                    print("POSSIBLE")
                    exit()
    print("IMPOSSIBLE ")


if __name__ == '__main__':
    slove()


### FIXED CODE ###

def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    ad = collections.defaultdict(list)
    bd = collections.defaultdict(list)
    for i in range(m):
        a, b = list(map(int, input().rstrip('\n').split()))
        if a == 1:
            ad[b] = 1
        if b == 1:
            ad[a] = 1

        if a == n:
            bd[b] = 1
        if b == n:
            bd[a] = 1
    for k, v in ad.items():
        if k in bd:
            print("POSSIBLE")
            exit()
    print("IMPOSSIBLE")


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

s = str(input())
q = int(input())
query = [0 for _ in range(q)]
for i in range(q):
    query[i] = list(map(str,input().split()))
for i in range(q):
    if(query[i][0] == "1"):
        s = s[::-1]
    else:
        mem = query[i][2]
        if(query[i][1] == "1"):
            s = mem + s
        else:
            s = s + mem
print(s)

### FIXED CODE ###

from collections import deque
s = str(input())
q = int(input())
s = deque(s)
query = []
w = True
for i in range(q):
    query = list(map(str,input().split()))
    if(query[0] == "1"):
        w = not(w)
    else:
        mem = query[2]
        if(query[1] == "1"):
            if(w):
                s.appendleft(mem)
            else:
                s.append(mem)
        else:
            if(w):
                s.append(mem)
            else:
                s.appendleft(mem)
if(w):
    print("".join(s))
else:
    s.reverse()
    print("".join(s))
### BUGGY CODE ###

from collections import deque

def dfs(i):
    q = deque()
    q.append(i)
    p = i
    d[i] = 1
    while True:
        if len(q) == 0:
            print(" ".join(map(str, c)))
            return
        s = 0
        p = q[len(q) - 1]
        for j in G[p]:
            if d[j] == 0:
                c[j] += c[p]
                q.append(j)
                s = 1
                p = j
                d[j] = 1
                break
        if s == 0:
            q.pop()

n, q = map(int, input().split())
G = [-1 for _ in range(n)]
for _ in range(n - 1):
    a, b = map(int, input().split())
    if G[a - 1] == -1:
        G[a - 1] = [b - 1]
    else:
        G[a - 1].append(b - 1)
    if G[b - 1] == -1:
        G[b - 1] = [a - 1]
    else:
        G[b - 1].append(a - 1)

c = [0] * n
d = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    c[p - 1] += x
dfs(0)

### FIXED CODE ###

from collections import deque
"""
def dfs(i):
    q = deque()
    q.append(i)
    p = i
    d[i] = 1
    while True:
        if len(q) == 0:
            print(" ".join(map(str, c)))
            return
        s = 0
        p = q[len(q) - 1]
        for j in G[p]:
            if d[j] == 0:
                c[j] += c[p]
                q.append(j)
                s = 1
                p = j
                d[j] = 1
                break
        if s == 0:
            q.pop()
"""
def bfs(i):
    q = deque()
    q.append(i)
    p = i
    d[i] = 1
    while True:
        if len(q) == 0:
            print(" ".join(map(str, c)))
            return
        p = q.popleft()
        for j in G[p]:
            if d[j] == 0:
                q.append(j)
                c[j] += c[p]
                d[j] = 1

n, q = map(int, input().split())
G = [-1 for _ in range(n)]
for _ in range(n - 1):
    a, b = map(int, input().split())
    if G[a - 1] == -1:
        G[a - 1] = [b - 1]
    else:
        G[a - 1].append(b - 1)
    if G[b - 1] == -1:
        G[b - 1] = [a - 1]
    else:
        G[b - 1].append(a - 1)

c = [0] * n
d = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    c[p - 1] += x
bfs(0)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N = int(input())

g = [[] for _ in range(N+1)]
dist = [[-1]*(N+1) for _ in range(N+1)]
for i in range(N-1):
    a, b, c = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
    dist[a][b] = c
    dist[b][a] = c
    
Q, K = map(int, input().split())

cost = [-1] * (N+1)
cost[K] = 0
temp = [[K, 0]]
while temp:
    p = temp.pop()
    gset = set(g[p[0]])
    gset.discard(p[1])
    for q in gset:
        cost[q] = cost[p[0]] + dist[p[0]][q]
        temp.append([q, p[0]])

for i in range(Q):
    x, y = map(int, input().split())
    print(cost[x] + cost[y])


### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())

g = [[] for _ in range(N+1)]

for i in range(N-1):
    a, b, c = map(int, input().split())
    g[a].append([b, c])
    g[b].append([a, c])
    
Q, K = map(int, input().split())

cost = [-1] * (N+1)
cost[K] = 0
temp = [K]
while temp:
    p = temp.pop()
    for q in g[p]:
        if cost[q[0]] == -1:
            cost[q[0]] = cost[p] + q[1]
            temp.append(q[0])

for i in range(Q):
    x, y = map(int, input().split())
    print(cost[x] + cost[y])
### BUGGY CODE ###

import math
import sys
import os

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")

def divisor_count(n):
    divisors = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors += 1
            if i != n // i:
                divisors += 1  
    return divisors    

N = I()
ans = 0

for i in range(1,N):
    ans += divisor_count(i)

print(ans)

### FIXED CODE ###

import math
import sys
import os

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")

def divisor_count(n):
    divisors = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors += 1
            if i != n // i:
                divisors += 1  
    return divisors    

N = I()
ans = 0

# for i in range(1,N):
#     ans += divisor_count(i)

for i in range(1,N):
    ans += (N-1)//i

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

it = input()
it = it.split()
n = int(it[0])
m = int(it[1])
p1 = []
p2 = []
for _ in range(m):
    itf = input()
    itf = itf.split()
    a = int(itf[0])
    b = int(itf[1])
    p1.append(a)
    p2.append(b)
d = [[1], ]
c = [[0], ]
l = 0
flag = True
for j in range(1, n):
    a = []
    b = []
    for i, t in enumerate(p1):
        for h in d[l]:
            if t == h:
                a.append(p2[i])
                b.append(t)
    for i, t in enumerate(p2):
        for h in d[l]:
            if t == h:
                a.append(p1[i])
                b.append(t)
    d.append(a)
    c.append(b)
    if len(d) > l:
        l += 1
    else:
        flag = False
        break
con = []
for i in range(2, n+1):
    for y, j in enumerate(d):
        flfl = True
        for w, k in enumerate(j):
            if k == i:
                con.append(c[y][w])
                flfl=False
                break
        if not flfl:
            break
    if flfl:
        con.append(0)

if 0 in con:
    print('No')
else:
    print('Yes')
    for i in con:
        print(i)

### FIXED CODE ###

it = input()
it = it.split()
n = int(it[0])
m = int(it[1])
p = [[] for _ in range(n)]
for _ in range(m):
    itf = input()
    itf = itf.split()
    a = int(itf[0])
    b = int(itf[1])
    p[a-1].append(b)
    p[b-1].append(a)
d = [1, ]
con = [0] * n
while d:
    l = d.pop(0)
    for k in p[l-1]:
        if con[k-2]==0:
            d.append(k)
            con[k-2] = l
print('Yes')
for i in range(n-1):
    print(con[i])
### BUGGY CODE ###

N = int(input())
A = tuple(map(int, input().split()))
MAX = 10 ** 18
ans = A[0]
for a in A[1:]:
    ans *= a
if ans > MAX:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

N = int(input())
A = sorted(map(int, input().split()))
MAX = 10 ** 18
ans = A[0]
for a in A[1:]:
    ans *= a
    if ans > MAX:
        ans = -1
        break
print(ans)
### BUGGY CODE ###

from operator import itemgetter
N= int(input())
ans = 1
a = []

for i in range(N):
    tmpa, tmpb = map(int,input().split())
    if tmpa-tmpb in a:
        a[tmpa-tmpb].append(tmpa+tmpb)
    else:
        a.append([tmpa-tmpb,tmpa+tmpb])

b = sorted(a, key=itemgetter(1))
tmp = b[0][1]
for i in range(1, N):
    if b[i][0] >= tmp:
        ans += 1
        tmp = b[i][1]
print(ans)

### FIXED CODE ###

from operator import itemgetter
N= int(input())
ans = 1
a = []

for i in range(N):
    tmpa, tmpb = map(int,input().split())
    a.append([tmpa+tmpb, tmpa-tmpb])

a.sort()
    
tmp = a[0][0]
for i in range(1, N):
    if a[i][1] >= tmp:
        ans += 1
        tmp = a[i][0]
print(ans)
### BUGGY CODE ###

#標準入力の受け取り
N = int(input())
A = list(map(int, input().split()))

#Aの各値を二進数にした時の桁ごとに配列にまとめる
bit_lis = [0] * 61
for i in range(N):
    tmp = A[i]
    for j in range(61):
        bit_lis[j] += tmp % 2
        tmp = tmp // 2
        
#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    bit_1 = bit_lis[i]
    ans += (2 ** i) * bit_1 * (N-bit_1) % mod
    ans = ans % mod
print(ans)

### FIXED CODE ###

#標準入力の受け取り
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

#Aの各値を二進数にした時の桁ごとに配列にまとめる
bit_lis = [0] * 61
for i in range(61):
    bit_lis[i] = np.count_nonzero(A & 1)
    A >>=1
        
#各桁について値を計算する
ans = 0
bit_1 = 0
mod = 10 ** 9 + 7
for i in range(61):
    bit_1 = bit_lis[i]
    if bit_1 == 0:
        continue
    ans += pow(2, i, mod) * bit_1 * (N-bit_1) 
    ans = ans % mod
print(ans)
### BUGGY CODE ###

a,b,q = map(int,input().split())
s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]
x = [int(input()) for i in range(q)]
ans = []
for x_ in x:
    s_ = []
    t_ = []
    for i in range(len(s)):
        s_.append(s[i]-x_)
    for i in range(len(t)):
        t_.append(t[i]-x_)
    s_l=-float('inf')
    s_r=float('inf')
    t_l=-float('inf')
    t_r=float('inf')
    for k in s_:
        if k<0:
            s_l=k
        else:
            s_r=k
            break
    for k in t_:
        if k<0:
            t_l=k
        else:
            t_r=k
            break
    ans.append(min(max(abs(s_l),abs(t_l)),abs(s_l)*2+t_r,t_r*2+abs(s_l),max(s_r,t_r),s_r*2+abs(t_l),abs(t_l)*2+s_r))
for ans_ in ans:
    print(ans_)


### FIXED CODE ###

a,b,q = map(int,input().split())
s = [-float('inf')]+[int(input()) for i in range(a)]+[float('inf')]
t = [-float('inf')]+[int(input()) for i in range(b)]+[float('inf')]
x = [int(input()) for i in range(q)]
import bisect
for x_ in x:
    s_r = bisect.bisect_right(s,x_)
    t_r = bisect.bisect_right(t,x_)
    res = float('inf')
    for S in [s[s_r-1],s[s_r]]:
        for T in [t[t_r-1],t[t_r]]:
            d1 = abs(S-x_)+abs(T-S)
            d2 = abs(T-x_)+abs(S-T)
            res = min(res,d1,d2)
    print(res)
### BUGGY CODE ###

def resolve():
    A, B, K = list(map(int, input().split()))
    l = [int(i) for i in range(A, B+1)]
    if len(l) >= 2 * K:
        ls = l[:K] + l[-K:]
    else:
        ls = l
    for _ in ls:
        print(_)
    return

resolve()

### FIXED CODE ###

def resolve():
    A, B, K = list(map(int, input().split()))
    if B - A + 1 >= 2 * K:
        ls = [i for i in range(A, A+K)] + [i for i in range(B-K+1, B+1)]
    else:
        ls = [i for i in range(A, B+1)]

    print('\n'.join(map(str, ls)))
    return

resolve()
### BUGGY CODE ###

S=input()
mem_mod = [0 for i in range(0,2019,1)]
N = len(S)
counter = 0
for i in range(0,N,1):
    X = int(S[N-i-1::]) % 2019
    if X==0:
        counter+=1
    counter += mem_mod[X]
    mem_mod[X] += 1
print(counter)


### FIXED CODE ###

import collections
p = 2019
s=input()
n=len(s)
arr=[int(s[i]) for i in range(len(s))] #文字列の各文字をそれぞれ数字に変換しておく
if p==2 or p==5: #P=2,5のときは10を割り切るので連続部分列の右端のみを見ればよい
 ans=0
 for i in range(n):
   if arr[i]%p==0:
     ans+=i+1
 print(ans)
else: #Pが2でも5でもないとき
 dic=collections.defaultdict(int)
 tmp=0
 for i in range(n-1,-1,-1): #右端の要素を右端とする連続部分列のあまりを順に求める
   tmp+=arr[i]*pow(10,n-1-i,p)
   tmp%=p
   dic[tmp]+=1
 ans=0
 rem=0 #調べるあまりの値(初期値は0)
 for i in range(n-1,-1,-1):
   ans+=dic[rem]
   rem+=arr[i]*pow(10,n-1-i,p) #調べるあまりの値に(i番目の要素)*10^(n-1-i)を加える
   rem%=p
   dic[rem]-=1 #右端の要素が右端、i番目の要素が左端となる連続部分列のあまりの個数を1減らす
 print(ans)
### BUGGY CODE ###

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


def loop():
    diff = 2020202020 * 200000 + 1
    tot = sum(A)
    for i in range(N):
        temp1 = A[:i+1]
        # temp2 = A[i+1:]
        temp3 = abs(tot - 2 * sum(temp1))
        if temp3 <= diff:
            # mid = i
            diff = temp3

    print(diff)

loop()


### FIXED CODE ###

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


diff = 2020202020 * 200000 + 1
tot = sum(A)

temp1 = 0

for i in range(N):
    temp1 += A[i]
    # temp2 = A[i+1:]
    temp3 = abs(tot - 2 * temp1)
    if temp3 <= diff:
        # mid = i
        diff = temp3
    else:
        break

print(diff)
### BUGGY CODE ###

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

s = []
t = []
x = []
for i in range(A):
    s.append(int(input()))

for i in range(B):
    t.append(int(input()))

res = []
for i in range(Q):
    x = int(input())
    ans = 0

    minimum_ws = float('inf')
    minimum_wt = float('inf')
    minimum_es = float('inf')
    minimum_et = float('inf')
    for i in range(A):
        if s[i] < x:
            minimum_ws = x - s[i]
        else:
            minimum_es = s[i] - x
            break
    for i in range(B):
        if t[i] < x:
            minimum_wt = x - t[i]
        else:
            minimum_et = t[i] - x
            break

    # 西に突っ切る
    ans = max(minimum_ws, minimum_wt)
    # 東に突っ切る
    ans = min(ans, max(minimum_es, minimum_et))
    # 西いって東
    ans = min(ans, min(minimum_ws * 2 + minimum_et, minimum_wt * 2 + minimum_es))
    # 東いって西
    ans = min(ans, min(minimum_es * 2 + minimum_wt, minimum_et * 2 + minimum_ws))
    res.append(ans)

print('\n'.join(list(map(str, res))))


### FIXED CODE ###

import bisect
A, B, Q = map(int, input().split())

s = [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')]
t = [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')]

res = []
for i in range(Q):
    x = int(input())
    b = bisect.bisect_right(s, x)
    a = b - 1
    d = bisect.bisect_right(t, x)
    c = d - 1
    ans = float('inf')
    for S in [s[a], s[b]]:
        for T in [t[c], t[d]]:
            ans = min(ans, abs(S - x) + abs(T - S), abs(T - x) + abs(S - T))
    res.append(ans)

print('\n'.join(map(str, res)))
### BUGGY CODE ###

#!/usr/bin/env python3
# Atcoder necoak answer
# https://atcoder.jp/contests/diverta2019/tasks/diverta2019_a
import itertools

intext = input()
[n, k] = map(int, intext.split())

int_list = [v for v in range(1, n+1)]
nk_combis = itertools.combinations(int_list, k)
ans_nk_combis = []

for nk_combi in nk_combis:
    # print(nk_combi) #
    nk_list = list(nk_combi)
    # nk_list.sort()

    prev_item = None
    is_renzoku = True

    for nk_item in nk_list:
        # print(prev_item, nk_item)
        if (prev_item != None) and (prev_item + 1 != nk_item):
            is_renzoku = False
            break
        prev_item = nk_item

    if is_renzoku:
        ans_nk_combis.append(nk_list)

# print(ans_nk_combis)
print(len(ans_nk_combis))


### FIXED CODE ###

#!/usr/bin/env python3
# Atcoder necoak answer
# https://atcoder.jp/contests/diverta2019/tasks/diverta2019_a
import itertools

intext = input()
[n, k] = map(int, intext.split())
print(n-k+1)
### BUGGY CODE ###

N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]
mod=10**9+7
#Dynamic Programming
dp=[0]*(N+1)
dp[0]=1
if 1 not in a:
	dp[1]=1
else:
	dp[1]=0
for i in range(2,N+1):
	if i in a:
		continue
	dp[i]=(dp[i-1]+dp[i-2])%mod
print(dp[N])

### FIXED CODE ###

N,M=map(int,input().split())
dp=[0]*(N+1)
dp[0]=1
mod=10**9+7
a=[False for _ in range(N+1)]
for _ in range(M):
    a[int(input())]=True
    
for i in range(1,N+1):
    if a[i]:
        continue
    dp[i]=(dp[i-1]+dp[i-2])%mod
 
print(dp[N])
### BUGGY CODE ###

import numpy as np
n, w = map(int, input().split())
dp = np.zeros((n+1, w+1))

for i in range(1,n+1):
  wn, vn = map(int, input().split())
  for j in range(1, w+1):
    if j-wn >= 0:
      dp[i][j] = max(dp[i-1][j], dp[i-1][j-wn]+vn)
    else:
      dp[i][j] = dp[i-1][j]
print(int(dp[-1][-1]))

### FIXED CODE ###

import numpy as np
n, w = map(int, input().split())
dp = np.zeros(w+1)

for i in range(1,n+1): #n個の荷物をそれぞれ持つか否か
  wn, vn = map(int, input().split())
  dp[wn:] = np.maximum(dp[wn:], dp[:-wn]+vn)#wnより小さい=>持てない=>価値変わらない
print(int(dp[-1]))
### BUGGY CODE ###

N,Q = map(int,input().split())
BIT = [0]*(N+1)

def BIT_query(idx):
    res_sum = 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx&(-idx)
    return res_sum

def BIT_update(idx,x):
    while idx <= N:
        BIT[idx] += x
        idx += idx&(-idx)
    return

c = [-1]+list(map(int,input().split()))
lastAppeared = [-1]*(N+1)
ans = [0]*Q
queries = []
for q in range(Q):
    l,r = map(int,input().split())
    queries.append((l,r,q))
queries.sort(key = lambda x:x[1])

curR = 0
for i in range(Q):
    l,r,q = queries[i]
    while curR < r:
        curR += 1
        last = lastAppeared[c[curR]]
        if last != -1:
            BIT_update(last,-1)
        lastAppeared[c[curR]] = curR
        BIT_update(curR,1)
    ans[q] = BIT_query(r)-BIT_query(l-1)
for i in range(Q):
    print(ans[i])

### FIXED CODE ###

N,Q = map(int,input().split())
BIT = [0]*(N+1)

def BIT_query(idx):
    res_sum = 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx&(-idx)
    return res_sum

def BIT_update(idx,x):
    while idx <= N:
        BIT[idx] += x
        idx += idx&(-idx)
    return

c = [-1]+list(map(int,input().split()))
lastAppeared = [-1]*(N+1)
ans = [0]*Q
queries = []
for q in range(Q):
    l,r = map(int,input().split())
    queries.append((l,r,q))
queries.sort(key = lambda x:x[1])

curR = 0
for i in range(Q):
    l,r,q = queries[i]
    while curR < r:
        curR += 1
        new = c[curR]
        last = lastAppeared[new]
        if last != -1:
            BIT_update(last,-1)
        lastAppeared[new] = curR
        BIT_update(curR,1)
    ans[q] = BIT_query(r)-BIT_query(l-1)
for i in range(Q):
    print(ans[i])
### BUGGY CODE ###

n, x, y = map(int, input().split())
lengths = [min(end - start, abs(x-start) + abs(y-end) + 1)
    for start in range(1, n+1)
        for end in range(start+1, n+1)]
for k in range(1, n):
    print(lengths.count(k))

### FIXED CODE ###

n, x, y = map(int, input().split())
lengths = [0 for i in range(n)]
for start in range(1, n+1):
    for end in range(start+1, n+1):
        lengths[min(end - start, abs(x-start) + abs(y-end) + 1)] += 1
print("\n".join(map(str, lengths[1:])))
### BUGGY CODE ###

n = int(input())
a = map(int, input().split())

l = []
ans = 'YES'
for i in a:
    if (i in l) != True:
        l.append(i)
    else:
        ans = 'NO'

print(ans)



### FIXED CODE ###

n = int(input())
a = map(int, input().split())

l = set(a)
if n == len(l):
    print('YES')
else:
    print('NO')
### BUGGY CODE ###

n, k, q = map(int, input().split())
t = [k]*n
s = [1]*n
for i in range(q):
  point = int(input())
  t = [t - s for (t, s) in zip(t, s)]
  t[point-1] = t[point-1]+1
for i in range(n):
  if t[i]<=0:
    print("No")
  else:
    print("Yes")


### FIXED CODE ###

n,k,q= map(int, input().split())#人数，初期ポイント，問題数
a = [0]*n
for i in range(q):
  a[int(input())-1]+=1
for i in range(n):
  if a[i]-q+k > 0:
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

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

tot = 0
for i in range(n):
    for j in range(i+1, n):
        tot += l[i]*l[j]
        if tot >= 10**9 + 7:
            tot %= (10**9 + 7)

print(tot % (10**9 + 7))

### FIXED CODE ###



def main():
    n = int(input().strip())
    l = list(map(int, input().split()))
    stack = [0]*n

    totstack = 0
    for i in range(n-1):
        totstack += l[n-i-1]
        stack[n-i-2] = totstack

    tot = 0
    for i in range(n):
        tot += (l[i] * (stack[i] % (10 ** 9 + 7))) % (10 ** 9 + 7)

    print(tot % (10 ** 9 + 7))


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

n = int(input())
s = []
list1 = []
list2 = []

for _ in range(n):
    car = input()
    s.append(car)

for i in range(n):
    if s[i] not in list1:
        list1.append(s[i])
        list2.append(s.count(s[i]))

maxs = [i for i in range(len(list2)) if list2[i] == max(list2)]
max_char = [list1[i] for i in maxs]
max_char_jisho = sorted(max_char)

for i in max_char_jisho:
    print(i)

### FIXED CODE ###

import collections

n = int(input())
s = [input() for _ in range(n)]
c_sort = collections.Counter(s).most_common()
list_most = [c_sort[i][0] for i in range(len(c_sort)) if c_sort[i][1] == c_sort[0][1]]
for i in sorted(list_most):
    print(i)
### BUGGY CODE ###

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

x = input()

for i in range(0, int(len(x)/2)):
    if "ST" in x:
        x = x.replace("ST", "")
    else:
        break

print(len(x))


### FIXED CODE ###

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

x = input()

# ペアになっていないSの数（ペアができたら-1）
sc = 0
# ペアにならなかったTの数
tc = 0

for c in x:
    if c == 'S':
        sc += 1
    elif sc >= 1:
        sc -= 1
    else:
        tc += 1

print(sc + tc)
### BUGGY CODE ###

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

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

if K == 1:
    N = 0

else:
    while abs(N-K)<N:
        N = abs(N-K)
print(N)

### FIXED CODE ###

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

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

if K == 1:
    N = 0

else:
    if N // K > 0:
        i = N//K
        N = N - (K * i)
    while abs(N-K)<N:
        N = abs(N-K)
print(N)
### BUGGY CODE ###

n = int(input())

a = input().split()

d = {}
for i in a:
    d[i] = d.get(i,0)+1
    
for i in d:
    d[i] = d[i]//2

s = []
for i in d:
    for _ in range(d.get(i)):
        s.append(int(i))
    s.sort()
if(len(s)>=2):
    print(s[-1]*s[-2])
else:
    print(0)

### FIXED CODE ###

n = int(input())

a = input().split()

d = {}
for i in a:
    d[i] = d.get(i,0)+1
    
for i in d:
    d[i] = d[i]//2

s = []
for i in d:
    s += [int(i)]*int(d.get(i))
if(len(s)>=2):
    s.sort()
    print(s[-1]*s[-2])
else:
    print(0)
### BUGGY CODE ###

K=int(input())
i='7'
if K%2==0 or K%5==0:
    print('-1')
else:
    while True:
        if int(i)%K==0:
            print(len(str(i)))
            break
        else:
            i+='7'

### FIXED CODE ###


K=int(input())
i=0
if K%2==0 or K%5==0:
    print('-1')

else:
    for d in range(K):
        i=(10*i+7)%K
        if i==0:
            print(d+1)
            break