peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from collections import deque


r, p = map(int, input().split())
graph = [[] for _ in range(r)]

for x in range(p):
    x1, x2 = map(int, input().split())
    graph[x1-1].append(x2-1)
    graph[x2-1].append(x1-1)

q = deque([0])
res = [-1]*r
res[0] = 0
while q:
    l = q.popleft()
    for x in graph[l]:
        if res[x] == -1:
            res[x] = l
            q.append(x)
if -1 in res[1:]:
    print("No")
    exit()
print("Yes")
for x in res[1:]:
    print(x+1)
# Judge status: Accepted
X, K, D = map(int, input().split())
X = abs(X)

if K*D <= X:
    print(abs(X - K*D))
else:
    m = X // D
    re = K - m
    if re % 2 == 0:
        print(abs(X - D*m))
    else:
        print(abs(X - D*(m+1)))
# Judge status: Wrong Answer
a,b= map(int,input().split())
if b>a:
    print(a)
else:
    print(a-1)
# Judge status: Wrong Answer
n = int(input())
ans = 0
m = 0
for i in range(2,n+1,2):
    a = 0
    x = i
    while(True):
        if x%2!=0:
            break
        a+=1
        x = x//2
    if a>m:
        m=a
        ans=i

print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
h = list(map(int, input().split()))
lis = [1] * n
for i in range(m):
    a, b = map(int, input().split())
    h[a-1]
    h[b-1]

    if h[a-1] < h[b-1]:
        lis[a-1] = 0
        h[a-1] = h[b-1]
    elif h[a-1] > h[b-1]:
        lis[b-1] = 0
        h[b-1] = h[a-1]
    else:
        lis[a-1]=0
        lis[b-1]=0

print(len([i for i in lis if i == 1]))
# Judge status: Wrong Answer
N,A,B = (int(x) for x in input().split())
if N == 1:
    if A != B:
        print('0')
    else:
        print('1')
elif A > B:
    print('0')
elif A == B:
    print('1')
else:
    print((N-2)*(B-A+4-N)+1)
# Judge status: Accepted
import sys
import numpy as np
import numba
from numba import jit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main(s):
    ans = 1<<10
    for i in range(len(s)-2):
        num = int(s[i:i+3])
        ans = min(abs(num-753), ans)
    return ans

s = input().strip()
print(main(s))
# Judge status: Accepted
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(input())
    A = list(map(int, input().split()))
    d = defaultdict(int)
    for i in range(N):
        d[A[i]-1] += 1
        d[A[i]] += 1
        d[A[i]+1] += 1
    print(max(d.values()))
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
x=int(input())
year=0
for i in range(0,x+1):
  year+=(x*1/100)
print(year)
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
for i in range(1,N+1):
    print(c[i])
# Judge status: Accepted
from collections import defaultdict

n = int(input())
arr = list(map(int, input().split()))

d = defaultdict(int)
for x in arr:
    d[x] += 1

a = d[0] + d[1] + d[2]
ans = [a]

for i in range(max(arr) - 2):
    a -= d[i]
    a += d[i + 3]
    ans.append(a)

print(max(ans))
# Judge status: Accepted
#b
N,K=map(int,input().split())
A = list(map(int, input().split()))
A.sort()
ans=0
for i in range(K):
    ans+=A[i]
print(ans)
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))

a = [i for i in range(1,n+1)]

c = 0
for i in range(n) :
    if a[i] != p[i] :
        c += 1
print("YES" if c<=2 else "NO")
# Judge status: Wrong Answer
A = list(map(int , input().split()))
if len(A) != A.count(A[0]):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
h, n = map(int, input().split())

m = [i for i in input().split()]

result = 0

for i in m:
    result += int(i)

if result >= h:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
s = input()
t = input()
if s == t[:len(t)]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
A,B=map(int,input().split())
tap=1
cnt=0
while tap<B:
    tap+=A-1
    cnt+=1
print(cnt)
# Judge status: Wrong Answer
n, m = map(int, input().split())
left = 1
right = n
for i in range(m):
    l, r = map(int, input().split())
    left = max(left, l)
    right = min(right, r)
print(right-left+1)
# Judge status: Wrong Answer

import math
import itertools
import statistics
#import collections

#n =  list(map(int, input().split()))
s = int(input())

def calc_f(n):
    if n%2==0:
        return n/2
    else:
        return 3*n+1

count1 = 0

a = [s]
while count1<2:
    s = calc_f(s)
    a.append(s)
    if s==1:
        count1+=1
    
#print(a)
print(a.index(1)+2)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

ans = min(b, d)-max(a, c)
if ans < 0:
    print(0)
else:
    print(ans)
# Judge status: Accepted
import bisect as bi
def main():
  from builtins import input, int, map
  N = int(input())
  A = list(map(int,input().split()))
  B = list(map(int,input().split()))
  C = list(map(int,input().split()))
  A.sort()
  C.sort()

  ans = 0

  for i in range(N):
    a = bi.bisect_left(A,B[i])
    c = N-bi.bisect_right(C,B[i])
    ans += a*c
  print(ans)
main()
# Judge status: Wrong Answer
A,B=map(int,input().split())
S=input()
if (S[0:A].isdecimal()==True) and (S[A+1:-1].isdecimal()==True) and (S[A]=='-') and len(S)==(A+B+1):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a, b, c = map(int,input().split())

x = c - (a - b)

if x > 0:
    print(x)
else:
    print(0)
# Judge status: Wrong Answer
n = int(input())
vi = list(map(int,input().split()))
if n%2 == 0:
    mean = sum(vi)/len(vi)
    print(mean)
else:
    vi.sort()
    saidai = vi.pop(-1)
    mean = sum(vi)/len(vi)
    ans = (mean+saidai)/2
    print(ans)
# Judge status: Wrong Answer
n = int(input())

powwer = 1
if n > 1:
    for i in range(1, n+1):
        powwer *= i
ans = powwer
print(int(ans))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

B = [0] * N
M = 0
ans = []
for i in range(N,0,-1):
    S, idx = 0, i-1
    while idx <= N-1:
        S += B[idx]
        idx += i

    if S % 2 != A[i-1]:
        B[i-1] = 1
        M += 1
        ans.append(i)
        

print(M)
for a in ans:
    print(a, end=" ")
print("")
# Judge status: Wrong Answer
N, M = map(int,input().split())
X = N*(N+1)/2 + M*(M+1)/2
print(X)
# Judge status: Accepted
"""
import math


a, b, x = list(map(float, input().split()))

theta = 0
if x >= a * a * b / 2:
    theta = math.atan((2.0 * (a * a * b - x)) / (a ** 3)) / (2 * math.pi) * 360
else:
    theta = math.atan((a * b * b) / 2.0 * x) / (2 * math.pi) * 360

print(theta)
"""

from math import atan, pi

a, b, x = map(int, input().split())

if x >= a * a * b / 2:
    print(atan((a*a*b-x)/(a*a*a/2))/(2 * pi)*360)
else:
    print(90 - atan(x/(a*b*b/2))/(2 * pi)*360)
# Judge status: Accepted
N = int(input())
b = -2
a = []
def d(n):
    if n > 0:
        return -(-n//b)
    elif n < 0:
        return (n-1)//b
def r(n):
    if n%b < 0:
        return -(n%b)
    else:
        return n%b

while N != 0 and N != 1:
    a.append(r(N))
    N = d(N)
if N == 1:
    a.append(N)
else:
    a.append(0)

a.reverse()
ans = "".join(map(str,a))
print(ans)
# Judge status: Wrong Answer
s = input()

number = 0
for i in range(len(s)):
  if s[i] == 1:
    number += 1
print(number)
# Judge status: Wrong Answer
a = int(input("Enter an integer : "))
s=a**2
t=a**3
print(a+s+t)
# Judge status: Wrong Answer
import numpy as np
from collections import Counter
n = int(input())
l = np.array([int(i) for i in input().split()])
l2 = np.array([i for i in range(1,n+1)])

c = Counter(l-l2)
mode = c.most_common()[0][0] if c.most_common()[0][1] != 1 else 0

print(abs((l- (l2 + mode))).sum())
# Judge status: Accepted
N=int(input())
S=[]
for i in range(N):
  s, n=input().split()
  S.append([s,int(n),i+1])
S.sort(key=lambda x:(x[0], -x[1]))
[print(p[2]) for p in S]
# Judge status: Accepted
tmp = input().split()
n = int(tmp[0])
m = int(tmp[1])

a = [0] * m
b = [0] * m

for i in range(m):
    tmp = input().split()
    tmp = list(map(int,tmp))
    a[i] = tmp[0]
    b[i] = tmp[1]

arr = [[0] * (n+1) for i in range(n+1)]

for i in range(m):
    arr[a[i]][b[i]] += 1
    arr[b[i]][a[i]] += 1

for i in range(1,n+1):
    count = 0
    for k in range(len(arr[i])):
        if arr[i][k] != 0:
            count += arr[i][k]
    print(count)
# Judge status: Accepted
a,b,t=map(int,input().split())
n=t//a

print(n*b)
# Judge status: Accepted
n,a,b = map(int,input().split())

if n == 1:
    if a == b:
        ans = 1
    else:
        ans = 0
else:
    if a > b:
        ans = 0
    elif a == b:
        ans = 1
    else:
        ans = (n-2)*(b-a)+1

print(ans)
# Judge status: Accepted
A,B,T = map(int,input().split())
print(int((T+0.5)//A*B))
# Judge status: Accepted
D=int(input())

if D==25:
  print('Christmas')
elif D==24:
  print('Christmas Eve')
elif D==23:
  print('Christmas Eve Eve')
else:
  print('Christmas Eve Eve Eve')
# Judge status: Accepted
import sys
import math
import bisect

def solve(a, b):
    n = b - a - 1
    A = sum(list(range(1, n + 1)))
    return A - a

def main():
    a, b = map(int, input().split())
    print(solve(a, b))

if __name__ == "__main__":
    main()
# Judge status: Accepted
S,C=map(int,input().split())
ans=0
#1
ans+=min(S,C//2)
S,C=S-ans,C-ans*2
if C>1:
  ans+=C//4
print(ans)
# Judge status: Wrong Answer
import math
a,b,c,d = map(int, input().split())
e = c*d/(math.gcd(c,d))

ac = math.ceil(a/c)
bc = math.floor(b/c)


ad = math.ceil(a/d)
bd = math.floor(b/d)

ae = math.ceil(a/e)
be = math.floor(b/e)

if b/c-a/c<1:
  xc = 0
else:
  xc = bc-ac + 1
if b/d-a/d<1:
  xd = 0
else:
  xd = bd-ad + 1
if b/e-a/e<1:
  xe = 0
else:
  xe = be-ae + 1
  
f = xc + xd - xe
g = b-a+1
h = g - f
print(h)
# Judge status: Accepted
S=[]
n = int(input())
for i in range(n):
    s=''.join(sorted(input()))
    S.append(s)
import collections
from scipy.special import comb
a=0
Sd=list(set(S))
c = collections.Counter(S)
for p in  range(len(Sd)):
    if c[Sd[p]] >=2:
        a  += comb(c[Sd[p]], 2, exact=True)
print(a)
# Judge status: Accepted
n=int(input())
l=sorted(list(map(int,input().split())))
s=1
d=1
for i in l:
    s=s*i
    if(s>10**18):
        print(-1)
        d=0
        break
if(d==1):
    print(s)
# Judge status: Wrong Answer
N = int(input())

chars = [chr(i) for i in range(ord('a'), ord('z')+1)]

ans = []

def dfs(s):
    if len(s) == N:
        # print(s)
        ans.append(s)
        return
    
    end = s[-1]
    end_i = chars.index(end)
    for i in range(end_i + 2):
        ns = s + chars[i]
        # print('-', i, ns)
        dfs(ns)

dfs('a')


ans.sort()
for si in ans:
    print(si)
# Judge status: Wrong Answer
#!/usr/bin/env python3
import math

a, b, x = list(map(int, input().split()))


tan_theta = a*b*b/(2*x)

if tan_theta <= a/b:
    tan_theta = 2*(b*a*a-x)/(a*a*a)


print(math.degrees(math.atan(tan_theta)))
# Judge status: Accepted
n = int(input())
sum_min = 100000
for i in range(1,n):
    i_sum = 0; j_sum = 0
    j = n-i
    i = str(i); j = str(j)
    for k in range(len(i)):
        i_sum += int(i[k])
    for k in range(len(j)):
        j_sum += int(j[k])
    tmp_sum  = i_sum + j_sum
    if sum_min >tmp_sum :
        sum_min = tmp_sum
print(sum_min)
# Judge status: Accepted
n = int(input())
count=n
for i in range(0,n+1):
  temp=0
  temp6=i
  while temp6>0:
    temp=temp+temp6%6
    temp6=int(temp6/6)
  temp9=n-i
  while temp9>0:
    temp=temp+temp9%9
    temp9=int(temp9/9)
  count=min(count,temp)
print(count)
# Judge status: Accepted
A,B,K=map(int,input().split())
C=set()
for i in range(A,min(A+K,B+1)):
  C.add(i)
for i in range(max(B-K+1,A),B+1):
  C.add(i)
for x in sorted(list(C)):
  print(x)
# Judge status: Wrong Answer
from fractions import gcd
from functools import reduce

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

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcm_value = lcm_list(a_list)

print((m*2//lcm_value+1)//2)
# Judge status: Accepted
n = int(input())
d = list(map(int,input().split()))

arc_list = list()
abc_list = list()

harf_num = int(n/2)

d.sort()
abc_list = d[:harf_num]
arc_list = d[harf_num:]

abc_max = max(abc_list)
arc_min = min(arc_list)

print(arc_min - abc_max)
# Judge status: Wrong Answer
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    d = collections.defaultdict(int)
    st = list(map(str, str(input().rstrip('\n')).split()))
    ab = list(map(str, str(input().rstrip('\n')).split()))
    for s, v in zip(st, ab):
        d[s] = int(v)
    d[str(input().rstrip('\n'))] -= 1
    print(*d.values())


if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
input()
T,A = map(int,input().split())
a = list(map(int,input().split()))
min_val = T-A
min_num=0
for i in range(len(a)):
    if abs(T-0.006*a[i]-A) <= min_val:
        min_val = abs(T-0.006*a[i]-A)
        min_num = i
print(min_num+1)
# Judge status: Accepted
n = int(input())
s = input()

E = [0] * (n + 10)
W = [0] * (n + 10)

e = 0
w = 0
for i in range(n):
    if s[i] == "E":
        e += 1
    else:
        w += 1
    W[i+1] = w
    E[i+1] = e

ans = float("inf")
for i in range(1, n+1):
    x = 0
    x += W[i-1]
    x += E[n]-E[i]
    ans = min(ans, x)

print(ans)
# Judge status: Accepted
def solve():
   N = int(input())
   table = [False] *1000000
   table[N] = True
   count = 1
   while True:
       if N&1:
           N = 3*N + 1
       else:
           N = N//2
       count += 1
       if not table[N]:
           table[N] = True
       else:
           print(count)
           break

if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
n = int(input())
if n < 10:
    print(n)
elif n < 10**2:
    print(9)
elif n < 10**3:
    print(10+(n%100))
elif n < 10**4:
    print(109)
elif n < 10**5:
    print(909 + 9*((n%10000)+1))
else:
    print(90909)
# Judge status: Accepted
from math import gcd
K=int(input())

result=[]
count=0
cnt=0


 
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      cnt+=gcd(gcd(i,j),k)


print(cnt)
# Judge status: Accepted
N = int(input())
list_D = [list(map(int, input().split())) for i in range(N)]

count = 0
for i in range(N-2):
  if list_D[N-i-1][0] == list_D[N-i-1][1] and list_D[N-i-2][0] == list_D[N-i-2][1] and list_D[N-i-3][0] == list_D[N-i-3][1]:
    count += 1
if count > 0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import numpy as np

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

H = np.array(H)
temp = T-H*0.006
res = np.abs(temp-A)

print(np.argmin(res)+1)
# Judge status: Wrong Answer
n = int(input())
A = [int(input()) for _ in range(n)]
used = {1}
pos = 1
count = 0
for _ in range(n):
  pos = A[pos - 1]
  count += 1
  if pos in used:
    print(-1)
    break
  if pos == 2:
    print(count)
    break
# Judge status: Accepted
import re
s = input().replace('?', '.')
t = input()

for i in range(len(s)-len(t),-1,-1):
    if re.match(s[i:i+len(t)], t):
        s = s[:i] + t + s[i+len(t):]
        s = s.replace('.', 'a')
        print(s)
        exit(0)
print('UNRESTORABLE')
# Judge status: Accepted
n = int(input())
arr = [int(x) for x in input().split()]

xor = 0

for x in arr:
    xor = xor ^ x

result = []

for i in range(n):
    result.append(str(xor ^ arr[i]))

print(" ".join(result))
# Judge status: Wrong Answer
S = [s for s in str(input())]
d = len(S) // 3
from collections import Counter
cntr = sorted(list(Counter(S).values()))
if cntr == [d,d,d] or cntr == [d,d,d+1] or cntr == [d,d+1,d+1]:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ans = float("INF")
X = sum(a)

x = 0
for i in range(n):
    x += a[i]
    if i+1 < n:
        ans = min(ans,abs(X-2*x))
print(ans)
# Judge status: Accepted
import numpy as np
N = int(input())
num_list = np.array(input().split(), dtype="int")

max_num = max(num_list)
max_bit_num = format(max_num, "b")
max_bit_num_length = len(max_bit_num)
ans = 0
radix = 1
for i in range(max_bit_num_length):
  new_num_list = (num_list >> i) & 1
  one_amount = np.count_nonzero(new_num_list == 1)
  zero_amount = len(num_list) - one_amount
  ans += (one_amount*zero_amount)*radix
  radix *= 2
print(ans%(10**9+7))
# Judge status: Accepted
from collections import Counter
s=Counter(Counter(input()).values())
t=Counter(Counter(input()).values())
print('Yes' if s==t else 'No')
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
a = [min(x//400, 8) for x in map(int, input().split())]
a = Counter(a)
#max:8 , over 8
if a[8] != 0:
    min_a = len(a)-1
else:
    min_a = len(a)

max_a = min([min_a+a[8], 8])
print(min_a, max_a)
# Judge status: Accepted
A,B,N=map(int,input().split())

x=min(B-1,N)
print(A*x//B-A*(x//B))
# Judge status: Wrong Answer
h,w,k = map(int,input().split())
for x in range(1,1001):
    for y in range(1,1001):
        if w*x + h*y - 2*x*y == k and 0<= x <= h and 0<= y <= w:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
def digits_sum(x):
    result = 0
    while x > 0:
        result += x % 10
        x //= 10
    return result

N = int(input())

result = 10**5

for A in range(1, N):
    B = N - A
    result = min(result, digits_sum(A) + digits_sum(B))

print(result)
# Judge status: Accepted
a,b=map(int,input().split())
ans=a+b
if ans<24:
    print(ans)
else:
    ans-=24
    print(ans)
# Judge status: Accepted
N=int(input())
X=list(map(int,input().split()))
ANS=[0]*100
for i in range(100):
  for x in X:
    ANS[i] += ((x - (i+1)) ** 2)
print(min(ANS))
# Judge status: Accepted
N     = int(input())
lst_X = list(map(int, input().split()))

def main(N, lst_X):
    
    min_P1 = sum(lst_X) // N
    sum_sutamina1 = 0
    for X in lst_X:
        sum_sutamina1 += (X - min_P1) ** 2

    min_P2 = min_P1 + 1
    sum_sutamina2 = 0
    for X in lst_X:
        sum_sutamina2 += (X - min_P2) ** 2

    return min(sum_sutamina1, sum_sutamina2)
        
if __name__ == "__main__":

    answer = main(N, lst_X)
    print(answer)
# Judge status: Accepted
def solve(h):
	best_p = abs(h[0] - h[1])
	best_pp = 0
	n = 2
	while n < len(h):
		cost1 = best_p + abs(h[n] - h[n-1])
		cost2 = best_pp + abs(h[n] - h[n-2])
		best = min(cost1, cost2)
		best_pp, best_p = best_p, best
		n = n + 1
	return best_p


def main():
	N = int(input())
	heights = list(map(int, input().split()))
	assert len(heights) == N
	assert N >= 2
	res = solve(heights)
	print(res)


if __name__ == '__main__':
	main()
# Judge status: Accepted
N = int(input())
tmp = 0

for i in range(1,N+1):
	tmp += i
	if tmp >= N:
		p = i
		break

fuyou = tmp - N

for i in range(1,p+1):
	if i == fuyou:
		continue
	print(i)
# Judge status: Accepted
s=input()
q=int(input())
cnt=0
front=[]
rear=[]
for qq in range(q):
  l=list(input().split())
  if l[0]=='1':
    cnt+=1
  else:
    if (cnt+int(l[1]))%2==1:
      front.append(l[2])
    else:
      rear.append(l[2])
front=''.join(front[::-1])
rear=''.join(rear)
s=front+s+rear
print(s if cnt%2==0 else s[::-1])
# Judge status: Accepted
N = int(input())
S = [input() for _ in range(N)]

D = {}
D['AC'] = 0
D['WA'] = 0
D['TLE'] = 0
D['RE'] = 0

for k in range(N):
  D[S[k]] += 1

print('AC x',D['AC'])
print('WA x',D['WA'])
print('TLE x',D['TLE'])
print('RE x',D['RE'])
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def main():
    A, B, C = map(int, input().split())
    if A + B >= C:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N, X, T = map(int,input().split())

if N <= X:
  print(T)
else:
  if N % X == 0:
    A = N / X * T
    print(A)
  else:
    B = (N / X + 1) * T
    print(B)
# Judge status: Accepted
N = int(input())
##N, M = map(int, input().split())
D = list(map(int, input().split()))
if sum(D) > 0:
    target = int(sum(D) / N + 0.5)
else:
    target = int(sum(D) / N - 0.5)
ans = 0
for i in D:
    ans += (target - i)*(target - i)

print(ans)
# Judge status: Accepted
n,a,b = map(int,input().split())
s = input()
maxa = a+b
maxb = b
counta = 0
countb = 0
for i in range(n):
  if s[i] == 'c':
    print("No")
  elif s[i] == 'b':
    if countb < maxb and counta < maxa:
      print("Yes")
      counta += 1
      countb += 1
    elif counta < maxa:
      print("No")
    else:
      print("No")
  else:
    if counta < maxa:
      print("Yes")
    else:
      print("No")
    counta+=1
# Judge status: Accepted
N = int(input())
mod = 10 ** 9 + 7

if N == 1:
    print(0)
    exit()

def factorial(p, n):
    result = 1
    for i in range(1, n + 1):
        result = result * p % mod
    return result

ans = factorial(10, N) - 2 * factorial(9, N) + factorial(8, N)
ans = ans % mod

while True:
    if ans > 0:
        break
    ans += mod

print(ans)
# Judge status: Wrong Answer
a=input()
if a==a or a==b or a==c or a==d or a==e or a==f or a==g or a==h or a==i or a==j or a==k or a==l or a==m or a==n or a==o or a==p or a==q or a==r or a==s or a==t or a==u or a==v or a==w or a==x or a==y or a==z:
    print("a")
else:
    print("A")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

n = int(input())
a = [int(x) for x in input().split()]
maxval = 10 ** 6 + 5
factor_cnt = [0] * (maxval+1)
factor_cnt[0] = 2
factor_cnt[1] = 2
for i in range(n):
    if factor_cnt[a[i]] > 1:
        continue
    if a[i] == 1:
        continue
    for k in range(a[i], maxval+1, a[i]):
        factor_cnt[k] += 1

result = sum(factor_cnt[v] == 1 for v in a)
print(result)
# Judge status: Accepted
import fractions
a,b,c,d = map(int,input().split())
AdivC = (a-1)//c
BdivC = b//c
AdivD = (a-1)//d
BdivD = b//d
gc = fractions.gcd(c,d)
div = (c*d)//gc
AdivCandD = (a-1)//div
BdivCandD = b//div

divC = BdivC - AdivC
divD = BdivD - AdivD
divCandD = BdivCandD - AdivCandD
ans = b-a+1
ans = ans -(divC+divD-divCandD)
print(ans)
# Judge status: Accepted
k=int(input())

if k%2==0:
    ans=(k//2)**2
else:
    ans=(k//2)*(k//2+1)
    
print(ans)
# Judge status: Accepted
icase=0
if icase==0:
    s=set(input())
    abc=list("abcdefghijklmnopqrstuvwxyz")
#    abc.sort(reverse=True)
    yn=""
    for i in range(len(abc)):
        if not abc[i] in s:
            print(abc[i])
            yn="OK"
            break
    if yn=="":
        print("None")
# Judge status: Wrong Answer
H = int(input())
W = int(input())
N = int(input())

x = H if H>W else W

print(N//x+ 0 if N%x==0 else 1)
# Judge status: Accepted
K = int(input())

runrun = [[1]*10]
s = sum(runrun[0][1:])
i = 1
while K > s:
  K -= s
  r = [sum(runrun[-1][max(0,i-1):min(10, i+2)]) for i in range(10)]
  runrun.append(r)
  s = sum(r[1:])
  i += 1

j = 1
while runrun[-1][j] < K:
  K -= runrun[-1][j]
  j += 1

ans = [j]
k = -2
while K and len(runrun) >= -k:
  j = max(0, j-1)
  while runrun[k][j] < K:
    K -= runrun[k][j]
    j += 1
  k -= 1
  ans.append(j)

print("".join(map(str, ans)))
# Judge status: Wrong Answer
import math
array=[2]
for i in range(3,100003,2):
    prime=True
    for n in range(len(array)):
        if array[n] > math.sqrt(i):
            break
        if i % array[n] == 0:
            prime = False
            break
    if prime:
        array.append(i)
l=int(input())
for m in range(len(array)):
    if l>array[m]:
        pass
    else:
        print(array[m])
        break
# Judge status: Wrong Answer
n = int(input())
s = input()

if n % 2 == 1:
    print('No')
    exit(0)

n = n // 2
a = s[:n]
if a.count(s) == 2:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N=int(input())
A=[int(x) for x in input().split()]
start=1
for i in A:
  if start==i:
    start+=1
print(len(A)-start+1)
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))
ans = 0
for i, l in enumerate(L):
  if i % 2 != 1 and l % 2 == 1:
    ans += 1
print(ans)
# Judge status: Accepted
red_str_list=[]
blue_str_list=[]

blue_cnt=int(input())

for _  in range(blue_cnt):
  red_str_list.append(input())
  
red_cnt=int(input())
for _  in range(red_cnt):
  blue_str_list.append(input())
  
ans=0
dic = dict()

for i in red_str_list:
  if (i in dic.keys()):
    dic[i]+=1
  else:
    dic[i]=1
    
for i in blue_str_list:
  if (i in dic.keys()):
    if dic[i]>0:
      dic[i]-=1

print(max(dic.values()))
# Judge status: Wrong Answer
a = list(input().split())
b = list(input().split())

a.sort()
b.sort(reverse=True)

if ''.join(a) < ''.join(b):
  print('Yes')
else:
  print('No')