peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N = int(input())
csf = [0]*(N-1)
for i in range(N-1):
    csf[i] = list(map(int,input().split()))

for i in range(N-1):
    ans = 0
    ans += csf[i][1] + csf[i][0]
    for j in range(i+1, N-1):
        if ans >= csf[j][1]:
            ans += csf[j][2] - (ans % csf[j][2]) + csf[j][0]
        else:
            ans = csf[j][1] + csf[j][0]
    
    print(ans)
print(0)
# Judge status: Accepted
l = input().split()
print('A'+l[1][0]+'C')
# Judge status: Accepted
S = map(int, input())

a, b = 0, 1
for s in S:
    a, b = a + s if a + s < b + 10 - s else b + 10 - s, a + (s + 1) if a + (s + 1) < b + 10 - (s + 1) else b + 10 - (s + 1)

print(a)
# Judge status: Accepted
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))

print(math.ceil((n - k) / (k - 1)) + 1)
# Judge status: Accepted
S = input()
T = input()
l = len(S)
cnt = 0
for i in range(l):
  if S[i]!=T[i]:
    cnt += 1
print(cnt)
# Judge status: Accepted
s=input()
print(s.rfind('Z')-s.find('A')+1)
# Judge status: Accepted
#s , t = 'red' , 'blue'
#a , b = 3,4
#u = 'red'

s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())

if u == s :
  a -= 1
else :
  b -= 1

print('{} {}'.format(a,b))
# Judge status: Accepted
from math import gcd
from functools import reduce

n = int(input())

ans = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            ans += reduce(gcd,[i,j,k])

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

mod = 1e9+7
S = int(input())

a = [None]*S

if S == 1 or S == 2:
    print(0)
    exit()
if S == 3:
    print(1)
    exit()

a[0] = 0
a[1] = 0
a[2] = 1

for i in range(3,S):
    a[i] = a[i-1] + a[i-3]
    a[i] %= mod

print(int(a[S-1]))
# Judge status: Wrong Answer
N = int(input())
a = sorted(map(int, input().split()[::-1]))
print(sum(a[::2]) - sum(a[1::2]))
# Judge status: Accepted
N, M = map(int, input().split())
py = []
for i in range(M):
    p, y = map(int, input().split())
    py += [[i, p, y]]
py = sorted(py, key=lambda x:(x[1], x[2]))
cnt = 0
pre = py[0][1]
ans = []
for n, p, y in py:
    if pre != p:
        cnt = 1
        pre = p
    else:
        cnt += 1
        
    ans += [[n, str(p).zfill(6)+str(cnt).zfill(6)]]

ans = sorted(ans, key=lambda x:x[0])
for _, n in ans:
    print(n)
# Judge status: Wrong Answer
n,b,r = map(int, input().split())		# 5 7 2

ans = (n//(b+r)) + min(n%(b+r),b)

print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 0

for i in range(N-1):
    ans += A[N - 1 - (i+1)//2]

print(ans)
# Judge status: Accepted
T = input()

ans = T.replace('?', 'D')

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

if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(int(b/2))
else:
  print(0)
# Judge status: Accepted
S=input()
T="keyence"
if S[:7]==T:
    print("YES")
    exit()
for i in range(len(S)-1):
    for j in range(i,len(S)):
        if S[:i]+S[j:]==T:
            print("YES")
            exit()
print("NO")
# Judge status: Accepted
import math
x,y = map(int,input().split())
lcm = (x*y)//math.gcd(x,y)
flag = False
for i in range(x,lcm):
  if i%x==0 and i%y!=0:
    flag=True
    print(i)
    break
if not flag:
  print(-1)
# Judge status: Accepted
import math

x = int(input())

print(x * 2 * math.pi)
# Judge status: Wrong Answer
x,a,b=map(int,raw_input().split())
if a-x < b-x:
  print "A"
else:
  print "B"
# Judge status: Accepted
n = int(input())
ans=""
while n!=0:
  if n%2==0:
    ans = "0"+ans
  else:
    n-=1
    ans = "1"+ans
  n//=-2  

if ans=="":
  print("0")
else:
  print(ans)
# Judge status: Accepted
N = int(input())
S = [input() for _ in range(N)]
d = {}
ans = 0
for s in S:
    ss = "".join(sorted(s))
    if ss in d:
        d[ss] += 1
        ans += d[ss]
    else:
        d[ss] = 0
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

L = 0
for a in A:
    L ^= a
for a in A:
    print(L ^ a)
# Judge status: Accepted
D,N=map(int,input().split())
if N==100:
    print(101*100**D)
else:
    print(N*100**D)
# Judge status: Accepted
def main():
    n = int(input())
    ps = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        if ps[i] == i+1:
            if ps[i] == n:
                ps[i-1], ps[i] = ps[i], ps[i-1]
            else:
                ps[i], ps[i+1] = ps[i+1], ps[i]
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
a = list(map(int,input().split()))
print(max(0,a[2]-(a[0]-a[1])))
# Judge status: Wrong Answer
S = str(input())
T = str(input())
for i in range(len(S)):
    if S[i-1] != T[-i]:
        print("No")
        break
else:
    print("Yes")
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
m = max([a, b, c])
print((m * 3 - (a + b + c)) // 2 if (a + b + c) % 2 == m else ((m + 1) * 3 - (a + b + c)) // 2)
# Judge status: Accepted
# coding: utf-8

renga_count = int(input())
renga_list = [int(i) for i in input().rstrip().split(" ")]

count = 0
for i in renga_list:
    if i == count + 1:
        count += 1

if count == 0:
    print(-1)
else:
    print(renga_count - count)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
max_A=0
for i in range(N):
    if max_A<A[i]:
        max_A=A[i]
    if A[i]<max_A-1:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
s=input()
print('x'*len(s))
# Judge status: Accepted
n = int(input())
p = [int(x) for x in input().split()]

skip = False
cnt = 0
for i in range(n):
    if skip:
        skip = False
    elif p[i] == i + 1:
        cnt += 1
        skip = True
else:
    print(cnt)
# Judge status: Accepted
x, y = map(int, input().split())
ans = 0
if x*y > 0:
  if x > y:
    ans = abs(x-y)+2
  else:
    ans = abs(x-y)
elif x*y < 0:
  ans = abs(abs(x)-abs(y))+1
else:
  if x == 0:
    if y < 0:
      ans = abs(x-y)+1
    else:
      ans = abs(x-y)
  else:
    if x < 0:
      ans = abs(x-y)
    else:
      ans = abs(x-y)+1
print(ans)
# Judge status: Wrong Answer
s = input()
print(s[0],s[1],s[2])
# Judge status: Accepted
x, y = list(map(int, input().split()))

for i in range(x+1):
    j = x - i
    if 2*i + 4*j == y:
        print('Yes')
        break
else:
    print('No')
# Judge status: Accepted
n = int(input())
L = list(int(input()) for _ in range(n))
SL = sorted(L)
first_max = SL[-1]
second_max = SL[-2]
for l in L:
  if (l != first_max):
    print(first_max)
  elif (l == first_max):
    print(second_max)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))
doubling_list = [[-1] * n for i in range(60)]

for i in range(n):
    tmp = a[i] - 1
    doubling_list[0][i] = tmp

for i in range(1, 60):
    for j in range(n):
        doubling_list[i][j] = doubling_list[i - 1][doubling_list[i - 1][j]]

now = 0
for i in range(60)[::-1]:
    if k >> i & 1:
        now = doubling_list[i][now]

ans = now + 1        
print(ans)
# Judge status: Wrong Answer
X, Y = map(int, input().split())

if (X % Y == 0): print(X)
else: print(-1)
# Judge status: Wrong Answer
import math

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

a, b, c = math.sqrt(A), math.sqrt(B), math.sqrt(C)

if a + b < c:
    print("Yes")

else:
    print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

from collections import Counter

c = Counter(a)

for i in range(1,n+1):
	print(c[i])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 1
tmp = "0"
for i in range(n-1):
  if a[i] < a[i+1]:
    if tmp == "-":
      ans += 1
      tmp = "0"
    else:
      tmp ="+"
  elif a[i] > a[i+1]:
    if tmp == "+":
      ans += 1
      tmp = "0"
    else:
      tmp = "-"      

print(ans)
# Judge status: Accepted
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# library
# -------------------------------------------------------------



# -------------------------------------------------------------
# main
# -------------------------------------------------------------

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

ans = 0
if 13 <= A:
    ans = B
elif 6 <= A <= 12:
    ans = B//2

print(ans)
# Judge status: Accepted
# import sys
# input = sys.stdin.readline
s = input()
if s == "ARC":
    print("ABC")
else:
    print("ARC")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

c_4 = 0
c_2 = 0
odd = 0
for i in range(n):
    if a[i]%4==0:
        c_4+=1
    elif a[i]%2==1:
        odd += 1
    else:
        c_2 += 1
if c_2==0:
    if odd <= c_4+1:
        print("Yes")
    else:
        print("No")
else:
    if odd <= c_4:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
k, n = map(int, input().split())
a = list(map(int, input().split()))

max_dist = 0
for i in range(n-1):
	cur_dist = a[i+1] - a[i]
	if cur_dist > max_dist:
		max_dist = cur_dist

cur_dist = k + a[0] - a[-1]
if cur_dist > max_dist:
	max_dist = cur_dist

print(k - max_dist)
# Judge status: Accepted
r, g, b = map(int, input().split())
if (r*100+g*10+b) % 4 == 0:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
ans = []

c = Counter(s)
max_count = max(c.values())

for k, v in c.items():
    if v == max_count:
        ans.append(k)
ans.sort()
print('\￿n'.join(ans))
# Judge status: Wrong Answer
H,W=map(int,input().split())
print(H) if H==W else print(H*W//2 if H*W%2==0 else H*W//2+1)
# Judge status: Wrong Answer
import sys
from fractions import gcd

N=input()
A=map(int, sys.stdin.readline().split())

mod=10**9+7
def lcm(a, b):
    g=gcd(a, b)
    return a*b*pow(g,mod-2,mod)

lc=1
for a in A:
    lc=lcm(lc,a)

ans=0
for a in A:
    b=lc*pow(a,mod-2,mod)
    ans+=b

print ans%mod
# Judge status: Accepted
import collections
N = int(input())
L = list(map(int, input().split()))
L = collections.Counter(L)
L = list(L.items())
L = sorted(L)
N = len(L)

ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i][0]+L[j][0] > L[k][0]:
                ans += L[i][1]*L[j][1]*L[k][1]

print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 27 02:58:21 2020

@author: liang
"""

N, M = map(int,input().split())
MOD = 10**9 + 7

if abs(N-M) >= 2:
    ans = 0
else:
    ans = 1
    for i in range(1,N+1):
        ans *= i
        ans %= MOD

    for i in range(1,M+1):
        ans *= i
        ans %= MOD
    
    if N == M:
        ans *= 2
        ans %= MOD
print(ans)
# Judge status: Accepted
s=int(input())
if s+1<=10**9:
  b=str(s+1)
  a=['0','0',b,'1','1','1']
else:
  x2=int(s**(1/2))
  y3=int(s**(1/2))
  while x2*y3<s:
    y3+=1
  if y3>10**9:
    x2+=1
    y3=int(s**(1/2))+1
  x2=str(x2)
  y3=str(y3)
  
  y2=str(1)
  x3=str(int(x2)*int(y3)-s)
  x1=str(0)
  y1=str(0)
  a=[x1,y1,x2,y2,x3,y3]
print((' ').join(a))
# Judge status: Accepted
S=input()
score=0
maxscore=0
for i in range(len(S)):
  if S[i]=='T':
    score+=1
    maxscore=max(maxscore,score)
  else:
    score-=1
print(2*maxscore)
# Judge status: Accepted
N = int(input())
V = list(map(int, input().split()))
sv = sorted(V)
ans = sv[0]
for i in range(1, N):
	ans = (ans + sv[i]) / 2
print(ans)
# Judge status: Accepted
N, K = [int(s) for s in input().split()]
A = [int(s) for s in input().split()]

x = 1
for i in range(K, N):
    if A[i] > A[i - K]:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
N = int(input())
a = []*N
for _ in range(N):
	a.append(list(map(int,input().split())))

dp = [[0,0]]*(N+1)
m = max(a[0])
j = a[0].index(m)
dp[0][0] = m
dp[0][1] = j
for i in range(1,N):
	prev = dp[i-1][1]
	m = 0
	for j in range(3):
		if j!=prev:
			m = max(a[i][j],m)
	j = a[i].index(m)
	dp[i][0] = dp[i-1][0] + m
	dp[i][1] = j
print(dp[N-1][0])
# Judge status: Accepted
a, b = map(int, input().split())

print(''.join([str(min(a, b)) for i in range(max(a, b))]))
# Judge status: Accepted
from collections import Counter
n, m = list(map(int, input().split()))

s = []
for i in range(n):
  s += list(map(int, input().split()))[1:]

ss = Counter(s)

ans = []
for k, v in ss.items():
  if v == n:
    ans.append(k)
    
print(len(ans))
# Judge status: Accepted
def resolve():
    S = input()
    if S[0] == "A" and S[2:-1].count("C") == 1:
        if S.count("A") == 1 and S.count("C") == 1:
            S = S.replace("A", "").replace("C", "")
            if S == S.lower():
                print("AC")
                return
    print("WA")


resolve()
# Judge status: Accepted
n, d = map(int, input().split())
ans = n // (2 * d + 1)
if n % (2 * d + 1) != 0:
    ans += 1
print(ans)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
s=0
for i in range(N):
  if i>=1 and A[i]==A[i-1]+1:
    s=s+B[A[i]-1]+C[i-1]
  else:
    s=s+B[A[i]-1]
print(s)
# Judge status: Accepted
from collections import Counter

N, *S = open(0)

C = Counter(S)
print(len(C.keys()))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = [0]*N
for i, j in enumerate(A):
    B[j-1] = i+1
print(*B)
# Judge status: Accepted
sx, sy, tx, ty = map(int,input().split())

ans = ""

#1周目
ans += (ty-sy)*"U" + (tx-sx)*"R" + (ty-sy)*"D" + (tx-sx)*"L"

#2周目
ans += "L" + (ty-sy+1)*"U" + (tx-sx+1)*"R" + "DR" + (ty-sy+1)*"D" + (tx-sx+1)*"L" + "U"

print(ans)
# Judge status: Wrong Answer
s_list = list(input())
n = len(s_list)
c_count = 0
if s_list[0] == "A":
    for s in s_list[2:-1]:
        if s == "C":
            c_count += 1
    if c_count == 1:
        if all([s == "A" or "C" or s.islower() for s in set(s_list)]):
            print("AC")
            exit()
print("WA")
# Judge status: Accepted
n, m = map(int, input().split())
ans = [list(input().split()) for i in range(m)]
ac = [0 for i in range(n)]
penali = [0 for i in range(n)]

a = 0

for s,t in ans:
    if t== 'WA' and ac[int(s)-1] == 0:
        penali[int(s)-1] += 1
    if t == 'AC':
        if ac[int(s)-1] == 0:
            a +=1
        ac[int(s)-1] = 1

for i in range(n):
    if ac[i] == 0:
        penali[i] = 0

pena = 0
for i in penali:
    pena += i

print(a, pena)
# Judge status: Accepted
N = int(input())
lstW = list(map(int, input().split()))

S1 = 0
S2 = sum(lstW)
minVal = S2

for i in range(0, len(lstW)):
    S1 = S1 + lstW[i]
    S2 = S2 - lstW[i]
    val = abs(S1 - S2)
    minVal = min(minVal, val)

print(minVal)
# Judge status: Wrong Answer
from sys import stdin
f_i = stdin

H, N = map(int, f_i.readline().split())

import numpy as np
dp = np.full((N + 1, H + 10 ** 4), 10 ** 8)
dp[0][0] = 0

for i in range(N):
    A, B = map(int, f_i.readline().split())
    dp[i+1][:A] = dp[i][:A]
    for j in range(A, H + A):
        dp[i+1][j] = min(dp[i][j], dp[i+1][j-A] + B)

print(np.min(dp[-1][H:]))
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(n - 2):
    if p[i] <= p[i + 1] < p[i + 2]:
        ans += 1
    elif p[i + 2] <= p[i + 1] < p[i]:
        ans += 1
    else:
        continue

print(ans)
# Judge status: Accepted
import re
s, t = input().replace('?', '.'), input()
l, m = len(s), len(t)

if l < m:
    print("UNRESTORABLE")
    exit()

can = []  # candidates
for i in range(l - m + 1):
    if re.match(s[i:i + m], t):
        can.append((s[:i] + t + s[i + m:]).replace('.', 'a'))
print(min(can) if can else "UNRESTORABLE")
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = map(int, readline().split())

    if N % K == 0:
        print(0)
    else:
        print(1)

    return


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
p=10**9+7
n=int(input())
A=[int(x) for x in input().split()]
A2=[(x**2) for x in A]
print(int((((sum(A))**2-sum(A2))/2)%p))
# Judge status: Accepted
a,b=map(float,input().split())
a=int(a)
b=int((b+10**-8)*100)
print(a*b//100)
# Judge status: Accepted
N,W=map(int,input().split())
wv = [tuple(map(int,input().split())) for _ in range(N)]

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

for i in range(1,N+1):
  for j in range(1, W+1):
    if j >= wv[i-1][0]:
      dp[i][j] = max(dp[i-1][j], dp[i-1][j-wv[i-1][0]]+wv[i-1][1])
    else:
      dp[i][j] = dp[i-1][j]
      
print(dp[-1][-1])
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Sun May 17 20:23:09 2020

@author: Kanaru Sato
"""
import math

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

s = a**2+b**2-2*a*b*math.cos(math.pi*(11*m-60*h)/360)
ans = math.sqrt(s)

print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
c = b - a - 1
res = c * (c + 1) // 2 - a
print(res)
# Judge status: Accepted
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)

n = int(input())
ans = []

def dfs(arr, max_val):
    if len(arr) == n:
        ans.append(arr)
        return
    for i in range(max_val + 2):
        next_arr = arr[:]
        next_arr.append(i)
        dfs(next_arr, max(max_val, i))

dfs([0], 0)

ans.sort()
orda = ord("a")
for line in ans:
    print("".join([chr(orda + item) for item in line]))
# Judge status: Accepted
n=int(input())
i=1
tmp=1
while True:
  if i**2 <= n:
    tmp = i**2
  else:
    break
  i += 1
print(tmp)
# Judge status: Accepted
N=int(input())
S=input()
R,G,B=0,0,0
for i in range(N):
    if(S[i]=='R'):
        R+=1
    elif(S[i]=='G'):
        G+=1
    else:
        B+=1
res=R*G*B
cnt=0
for i in range(N):
    lr=0
    while(i-lr>=0 and i+lr<N):
        s=set([S[i],S[i-lr],S[i+lr]])
        if(len(s)==3):
            res-=1
        lr+=1
print(res)
# Judge status: Accepted
n = int(input())
list = list(map(int, input().split()))

immigre = 'APPROVED'
for num in list:
  if num % 2 == 0:
    if (num % 3 != 0) and (num % 5 != 0):
      immigre = 'DENIED'
print(immigre)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

xor_all = 0

for a in A:
    xor_all ^= a

#print(bin(xor_all))

ans = []
for a in A:
    ans.append(str(xor_all^a))

print(' '.join(ans))
# Judge status: Accepted
# coding: utf-8

N, K = (int(x) for x in input().split())

result = 0
count = 0
for n in reversed(range(1, N + 1)):
	while(True):
		if n >= K:
			result += (1 / N) * (0.5 ** count)
			break
	
		K /= 2
		count += 1

print(result)
# Judge status: Accepted
N = int(input())
L = int(str(N)[-1])

if L==3:
  print("bon")
elif L in [0,1,6,8]:
  print("pon")
else:
  print("hon")
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
sumX = 0
for i in x:
    sumX += (i - round(sum(x)/n)) ** 2
print(sumX)
# Judge status: Accepted
def divisor(n):
  cd = []
  i = 1
  while i*i <= n:
    if n%i==0:
      cd.append(i)
      if i != n//i:
        cd.append(n//i)
    i += 1
  return cd

N, M = map(int, input().split())
cd = divisor(M)
cd.sort(reverse=True)
for c in cd:
  if M//c>=N:
    print(c)
    break
# Judge status: Wrong Answer
X = int(input())
if X >30:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
arr = list(map(int, input().split()))
target_n = max(arr)
target_m = 0
tmp = float('inf')
for i in range(N):
    if abs((target_n/2)-arr[i]) <= tmp and target_n != arr[i]:
        target_m = arr[i]
        tmp = abs((target_n/2)-arr[i])
print(target_n,target_m)
# Judge status: Accepted
import sys
from collections import deque
import copy
def main():
    N = int(input())
    S = []
    for i in range(N):
        s = input()
        S.append(s)
    S.sort()
    count = N
    for i in range(1, len(S)):
        if S[i - 1] == S[i]:
            count -= 1
    print(count)
    

if __name__ == '__main__':
    main()
# Judge status: Accepted
s=input()
n=int(input())
a=[input() for _ in range(n)]

front=True
f=""
b=""

for q in a:
    if q=="1":front=not front;continue
    l=q.split()
    if l[1]=="1":
        if front:f=l[2]+f
        else:b=b+l[2]
    if l[1]=="2":
        if front:b=b+l[2]
        else:f=l[2]+f

print(f+s+b if front else (f+s+b)[::-1])
# Judge status: Accepted
a, b, c= map(int, input().split())

if a > b and a > c:
    print(int(b*c/2))
elif b > a and b > c:
    print(int(a*c/2))
else:
    print(int(a*b/2))
# Judge status: Accepted
N = str(input())

tmp=0
for i in range(len(N)):
	tmp += int(N[i])
if tmp%9==0:
	print('Yes')
else:
	print('No')
# Judge status: Wrong Answer
n=int(input())
x = n%10
if x in [2,4,7,9]:
    print("hon")
elif x in [0,1,6,8]:
    print("pon")
else:
    print("bon")
# Judge status: Accepted
x,y = map(int,input().split())

cnt = abs(abs(x) - abs(y))
if abs(x) < abs(y): 
    if x >= 0 and y >= 0: print(cnt)
    elif x < 0 and y < 0: print(cnt+2)
    else: print(cnt+1)
elif abs(x) > abs(y):
    if x >=0 and y > 0: print(cnt+2)
    elif x < 0 and y <= 0: print(cnt) 
    else: print(cnt+1)
elif abs(x) == abs(y):
    if x*y >= 0:print(cnt)
    else: print(cnt+1)
# Judge status: Accepted
a,b=map(int,input().split())
if a>=0:
    print("Positive" if a!=0 else "Zero")
if a<0 and b>0:
    print("Zero")
if b<=0:
    if b==0:
        print("Zero")
    else:
        if (a-b+1)%2==0:
            print("Positive")
        else:
            print("Negative")
# Judge status: Wrong Answer
n = int(input())
A = [int(i) for i in input().split(" ")]

now = 1
ans = 0
for i in A:
    if i == now:
        now += 1
    else:
        ans += 1
print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
import math 
mod=10**9+7
if n==m:
    x=math.factorial(n)
    x=x%mod
    x=x**2
    x%=mod
    x*=2
    x%=mod
    print(x)
elif abs(n-m)==1:
    x=min(n,m)
    y=max(n,m)
    ans=math.factorial(x)%mod
    ans*=ans
    ans%=mod
    ans=ans*2*y
    ans%=mod
    print(ans)
else:
    print(0)
# Judge status: Accepted
M=10**6+1
_,*l=map(int,open(0).read().split())
a=[0]*M
for i in l:
  a[i]+=1
  if a[i]==1:
    for j in range(2*i,M,i): a[j]=2
print(a.count(1))
# Judge status: Accepted
import math
import sys

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

vote = []
vote = list(map(int, input().split()))
sum_n = sum(vote)

i = 0
while i < M:
    max_n = max(vote)
    if max_n < math.ceil(sum_n / (4 * M)):
        print("No")
        sys.exit()
    vote.pop(vote.index(max_n))
    i += 1

print("Yes")
# Judge status: Accepted
n,k = map(int,input().split())

ans=0
mod = 10**9+7
for i in range(k,n+2):
  a0=(i*(i-1))//2
  an=i*n-a0
  ans+=an-a0+1

print(ans%mod)
# Judge status: Accepted
S = input()
T = input()
if len(S)+1 == len(T) and S == T[:len(S)]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
A = int(input())
B = int(input())

print(6-A-B)
# Judge status: Accepted
k = int(input())
a, b = map(int, input().split())
for i in range(a, b+1):
  if(i%k == 0):
    print("OK")
    exit()
print("NG")
# Judge status: Accepted
s = input()
m = (len(s) - 1) // 2
l = s[:m]
r = s[(len(s) + 3) // 2 - 1:]


def check(s):
    mid = len(s) // 2
    if len(s) % 2 != 0:
        left = s[:mid]
        right = s[mid+1:]
    else:
        left = s[:mid]
        right = s[mid:]
    if left == right[::-1]:
        return True
    else:
        return False

if check(s) and check(r) and check(l):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s=input()
k=int(input())
num=[(123-ord(s[i]))%26 for i in range(len(s))]
ans=""
for i in range(len(s)-1):
    if num[i]<=k:
        ans+="a"
        k-=num[i]
    else:
        ans+=s[i]
k%=26
if num[-1]<=k:
    ans+=chr(97+k-num[-1])
else:
    ans+=chr(ord(s[-1])+k)
print(ans)
# Judge status: Accepted
N, X, T = map(int, input().split())
ans = (N + X - 1)//X*T
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
if n > 2:
    n = n-2
elif n == 2:
    n = 0
if m > 2:
    m = m-2
elif m == 2:
    m = 0
print(n*m)
# Judge status: Accepted
n=int(input())
a=0
for i in range(1,10):
    for j in range(i,10):
        if n==i*j:
            a=1
            break
        else:
            continue
if a!=0:
    print('Yes')
else:
    print('No')