peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
S=input()
s1=S[0:2]
s2=S[2:4]
li=["01","02","03","04","05","06","07","08","09","10","11","12"]

if s1 not in li:
    a=False
else:
    a=True
if s2 not in li:
    b=False
else:
    b=True

if a==b==True:
    print("AMBIGUOUS")
elif a==b==False:
    print("NA")
elif a==True:
    print("MMYY")
else:
    print("YYMM")
# Judge status: Accepted
a,b,c = map(int, input().split())
print(min(b//a,c))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

state = -1
res = 1
for i in range(1, n):
    if state == -1:
        if a[i] < a[i-1]:
            state = 0
        elif a[i] > a[i-1]:
            state = 1
    elif (state == 0 and a[i] > a[i-1]) or (state == 1 and a[i] < a[i-1]):
        res += 1
        state = -1

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

N = int(input())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda k: k[1])
t = 0

for Ai, Bi in AB:
    t += Ai
    
    if t>Bi:
        print('No')
        exit()

print('Yes')
# Judge status: Accepted
a=int(input().replace(" ",""))
if (a**.5).is_integer():
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
x = int(input())
d = 0
for j in range(10 * 5):
	d += j
	if d >= x:
		print(j)
		exit()
# Judge status: Accepted
s = int(input())
import math
k = math.floor(s**0.5)
m = 0
if s == 10**18:
    print(10**9,0,0,10**9,0,0)
else:
    if k**2+k < s:
        m = (k+1)**2 -s
        print(k+1,1,m,k+1,0,0)
    else:
        m = k*(k+1)-s
        print(k+1,1,m,k,0,0)
# Judge status: Accepted
import sys

a, b, c = map(int, sys.stdin.readline().split())

def main():
    return max(c + b - a, 0)

if __name__ == '__main__':
    ans = main()
    print(ans)
# Judge status: Wrong Answer
S = input()
T = input()
res = []

ok = -1
for i in range(len(S) - len(T) + 1):
    if S[i] == T[0] or S[i] == "?":
        for j in range(len(T)):
            if S[i + j] not in ("?", T[j]):
                break
        else:
            s = S[:i] + T + S[i + len(T):]
            res.append(s.replace("?", "a"))

if res:
    print(res)
else:
    print("UNRESTORABLE")
# Judge status: Accepted
D,T,S = map(int, open(0).read().split())
if T * S >= D:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
C = input()
W = sum([1 for c in C if c == 'W'])
R = len(C) - W
print(sum([1 for c in C[R:] if c == 'R']))
# Judge status: Wrong Answer
import math

a,b,c = map(int,input().split())
A = a*a + 2*a*b + b*b
C = c*c
if A < C:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import numpy as np
N = int(input())
X = np.array(list(map(int, input().split())))
x = int(np.sum(X) / N + 0.5)
print(np.sum(np.square(X - x)))
# Judge status: Wrong Answer
#!/usr/bin/env python3
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
f = lambda j: j not in a

mod = 10**9+7

dp = [0] * -~n
dp[0] = 1
dp[1] = f(1)

for i in range(2, -~n):
    if f(i):
        dp[i] = (dp[i - 1] + dp[i - 2]) % mod

print(dp[n])
# Judge status: Accepted
#coding: utf-8

sx, sy, tx, ty = map(int,input().split())
ans = ''
for i in range(tx-sx):
    ans += 'R'
for i in range(ty-sy):
    ans += 'U'
for i in range(tx-sx):
    ans += 'L'
for i in range(ty-sy):
    ans += 'D'

ans += 'D'
for i in range(tx-sx+1):
    ans += 'R'
for i in range(ty-sy+1):
    ans += 'U'
ans += 'L'

ans += 'U'
for i in range(tx-sx+1):
    ans += 'L'
for i in range(ty-sy+1):
    ans += 'D'
ans += 'R'

print(ans)
# Judge status: Accepted
n = int(input())
s = input()
mod = 10**9+7

s = sorted(s)
s += '#'
count = 1
ans = 1
for i in range(1, n+1):
    if s[i] == s[i-1]:
        count += 1
    else:
        ans = (ans * (count+1)) % mod
        count = 1
print(ans-1)
# Judge status: Accepted
import sys

N,K,X,Y=[int(input()) for i in range(4)]
 
if (N >= K):
  sum = K * X + (N - K) * Y
else:
  sum = N * X

print(sum)
# Judge status: Wrong Answer
if int(input()) >= 3200:
    print("red")
else:
    print(input())
# Judge status: Accepted
def main():
    print("Yes" if "9" in input() else "No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
X = int(input())

while True:
    i = 2
    while i * i <= X: 
        if X % i == 0:
            break     
        i += 1        
    else:
        print(X)      
        break
    X += 1
# Judge status: Accepted
s, c = map(int, input().split())

if c//2 - s > 0:
    ans = s + (c - 2*s)//4
else:
    ans = c//2
print(ans)
# Judge status: Wrong Answer
n=int(input())

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

needsearch=[]

for i in range(n):
    a[i]-=(i+1)
    needsearch.append(-2*(i+1)-a[i])

counter=[0]*(2*(10**5))

for i in range(n):
    if 0<a[i]+10**5<2*(10**5):
        counter[a[i]+10**5]+=1

ans = 0
for i in range(len(needsearch)):
    if 0<needsearch[i]+10**5<2*(10**5):
        ans += counter[needsearch[i]+10**5]


print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
print(1 if n%k else 0)
# Judge status: Accepted
n = input()
print(['No','Yes']["9" in n])
# Judge status: Accepted
n,a,b = map(int,input().split())
if n%(a+b) == 0:
    print(n//(a+b)*a)
else:
    print(n//(a+b)*a + (n%(a+b) if n%(a+b) < a else a))
# Judge status: Wrong Answer
#n = int(input())
n,k = map(int,input().split())
h_L = list(map(int,input().split()))

h_L.sort()

if k ==0:
    print(sum(h_L))
else:
    print(sum(h_L[k+1:]))
# Judge status: Accepted
from collections import deque

S = deque(input())
T = deque(input())

for _ in range(len(S)):
    if S == T:
        print('Yes')
        break
    S.rotate()
else:
    print('No')
# Judge status: Accepted
s = input()
ans = "yes"

for i in range(len(s)-1):
    for j in range((len(s)-1 -i)):
        if s[i] == s[i+(j+1)]:
            ans = "no"
            break

print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
if n % 2 == 1:
    ans = [[1+i,n-i] for i in range(n//2)]
else:
    ans = [[1+i,n-i] for i in range(n//4)]+[[n//2+1+i,n//2-1-i] for i in range(n//2-n//4-1)]
for a,b in ans:
    print(a,b)
# Judge status: Wrong Answer
import sys
import math
input = sys.stdin.readline
MOD = 10**9 + 7
INF = float('INF')

def main():
    s = input()
    ans = 0

    for i in range(math.ceil(len(s)/2)):
        if s[i] != s[-(i+1)]:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
def createPlural(s):
    if s[-1] == "s":
        return s[:-1] + "es"
    else:
        return s + "s"

s = input()
s_plural = createPlural(s)
print(s_plural)
# Judge status: Accepted
n=int(input())
if n<=6:print(1)
elif n<=11:print(2)
else:print(n//11*2+(n%11+5)//6)
# Judge status: Accepted
###############################################################################
#Imports
import collections
import itertools
from functools import lru_cache
import sys
import math
###############################################################################
#Constants
MOD = int(1e9)+7
###############################################################################
#Helper
def helper():
	pass
###############################################################################
#Solver
def solve():
	a, b = map(int, input().split(' '))
	print(a*b)

###############################################################################
#Driver
t = 1
for _ in range(t):
	solve()
###############################################################################
# Judge status: Accepted
# -*- coding: utf-8 -*-

n=int(input())
s=[input() for _ in range(n)]

print(len(set(s)))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
cnt = [100 for i in range(60)]
mod = 10 ** 9 + 7

# for i in A:
#     tmp = format(i, '060b')
#     for j in range(60):
#         if tmp[j] == "1":
#             cnt[j] += 1

ans = 0

lst = [1 for i in range(60)]

for i in range(59):
    lst[58-i] = (lst[59-i] * 2) % mod

for i in range(60):
    ans += (lst[i] * cnt[i] * (N -cnt[i])) % mod
    
ans %= mod

print(ans)
# Judge status: Accepted
import fractions
N = int(input())
T = list(int(input()) for _ in range(N))
ans = T[0]
for i in range(1, N):
    ans = ans * T[i] // fractions.gcd(ans, T[i])
print(ans)
# Judge status: Accepted
n = [int(i) for i in list(input())]
print("Yes" if sum(n)%9==0 else "No")
# Judge status: Accepted
print('YNEOS'[(int(input()[::2]))%4>0::2])
# Judge status: Accepted
import sys

n,a,b,c,d = map(int, input().split())
s = input()

tmp = ""
for i in range(a,c):
	if s[i] == tmp == "#":
		print("No")
		sys.exit()
	tmp = s[i]

for i in range(b,d):
	if s[i] == tmp == "#":
		print("No")
		sys.exit()
	tmp = s[i]

if c < d:
	print("Yes")
	sys.exit()

else:
	cnt = 0
	for i in range(b-2,d+1):
		if s[i] == ".":
			cnt += 1
			if cnt == 3:
				print("Yes")
				sys.exit()
		else:
			cnt = 0

print("No")
# Judge status: Wrong Answer
a = "7"
i = 1
n = int(input())
if(n % 2 == 0):
  print("-1")
else:
  while True:
    if(int(a) % n == 0 and int(a) / n != 0):
      break
    i += 1
    a = a + "7"
 
print(i)
# Judge status: Accepted
n,m = map(int,input().split())
if n == 1 and m == 1:
  print(1)
elif n == 1:
  print(m-2)
elif m == 1:
  print(n-2)
else:
  print((m-2)*(n-2))
# Judge status: Accepted
s = list(input())
ans = 0
for i in range(1,len(s)):
    if s[i-1] == '1' and s[i] == '1':
        s[i] = '0'
        ans += 1
    elif s[i-1] == '0' and s[i] == '0':
        s[i] = '1'
        ans += 1
print(ans)
# Judge status: Accepted
n=int(input())
L=list(map(int,input().split()))
cnt=0
p=0
for i in range(n):
	if L[i]==i+1:
		if p==1:
			p=0
		else:
			cnt+=1
			p=1
	else:
		p=0
print(cnt)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
s = [input() for i in range(n)]
s.sort()
c = Counter(s)
m = c.most_common()[0][1]
for i in c.most_common():
    if i[1] == m:
        print(i[0])
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    A,B,C=map(int,input().split())
    M=max(A,B,C)
    ans=M*10
    f=False
    for x in A,B,C:
        if x!=M or f:
            ans+=x
        else:
            f=True
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
S=input()
N=len(S)

def is_palindrome(s):
    return s==s[::-1]

S_all=is_palindrome(S)
S_forward=is_palindrome(S[:(N-1)//2])
S_rear=is_palindrome(S[(N+3)//2-1:])

if (S_all==True  and S_forward==True)  and S_rear==True:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x = int(input())
print("Yes" if x >29 else "No")
# Judge status: Accepted
n = int(input())
a = input().split()
if (len(a) == len(set(a))):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
days = ['SUN','MON','TUE','WED','THU','FRI','SAT']
s = input()
x = days.index(s)
print(7-x)
# Judge status: Accepted
from math import sqrt
s = input().split()
t = sqrt(int(''.join(s)))
print('Yes' if t.is_integer() else 'No')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

a_max = max(a)
cnt = [0] * (max(a) + 1)
ans = 0

for ai in a:
    for multi in range(ai, a_max + 1, ai):
        cnt[multi] += 1

for ai in a:
    if cnt[ai] == 1:
        ans += 1

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

n1 = N[0]
n2 = N[1]
n3 = N[2]
n4 = N[3]

if (n1 == n2 == n3) or (n2 == n3 == n4):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
CSF=[]
for _ in range(n-1):
  CSF.append(list(map(int,input().split())))

result=[]
for i in range(n-1):
  temp=CSF[i][1]+CSF[i][0]
  j=i+1
  while j<n-1:
    #at+b
    a,b=CSF[j][2],CSF[j][1]
    t=(temp-b)/a
    if t<=0:
      t=0
    else:
      t=-1*((b-temp)//a)
    temp=a*t+b+CSF[j][0]  
    j+=1
  result.append(temp)

for item in result:
  print(item)
print(0)
# Judge status: Accepted
import itertools
n = int(input())
a = list(map(int,input().split()))

four = len([1 for i in a if i%4 == 0])
two = len([1 for i in a if i%2 == 0]) - four
four += two//2
if four >= n-four-1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = list(input())

nows = []

for x in s:
    if x == "B":
        if len(nows) == 0:
            continue
        else:
            nows.pop(-1)
    else:
        nows.append(x)


print("".join(nows))
# Judge status: Wrong Answer
K,X = map(int,input().split())
for i in range((K-X+1),(K+X)):
  print(i,end=" ")
# Judge status: Wrong Answer
import math
def main():
    a, b = map(int, input().split())
    r = math.sqrt(int(a + b))
    if r**2 == int(a + b):
        print("Yes")
    else:
        print("No")
main()
# Judge status: Wrong Answer
n,m = map(int,input().split())
l = list(list(map(int,input().split())) for _ in range (m))
a = l[0][0]
b = l[0][1]
for s,t in l:
  a = max(a,s)
  b = min(b,t)
print(b-a+1)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

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

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

x=int(input())
ok=[0]*100001
ok[100]=1
if x<100:
    print(0)
    sys.exit()
a=[100,101,102,103,104,105]
for i in range(100,x):
    for item in a:
        if i-item>=0 and ok[i-item]==1:
            ok[i]=1
print(ok[x-1])
# Judge status: Accepted
n,*a=map(int,open(0).read().split())
t,v=sum(a),[1]
for q in a:
  v+=[min(2*(v[-1]-q),t:=t-q)]
  if v[-1]<0:print(-1);exit()
print(sum(v))
# Judge status: Accepted
import collections
w = input()
W = collections.Counter(w)

bl = True
v = W.values()
for i in v:
    if i&1:
        bl = False

print('Yes' if bl else 'No')
# Judge status: Accepted
from collections import deque

n = int(input())
a = [int(_) for _ in input().split()]

aa = deque(sorted(a, reverse=True))
ans = aa.popleft()
for i in range(n-2):
    if i % 2 == 0:
        comf = aa.popleft()
    ans += comf
    #print(ans)
print(ans)
# Judge status: Wrong Answer
n, k = map(int, input().split())

if n > k:
    ans = (n-k+1)
else:
    ans = 0

for i in range(1, min(n+1, k)):
    cnt = 0
    score = i
    while score < k:
        score *= 2
        cnt += 1
    ans += pow(1/2, cnt)

ans /= n
print(ans)
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
x_ave = sum(x) // n
def moment(val):
    list_init = [0]*n
    for i in range(n):
        list_init[i] = (x[i] - val)**2
    return(sum(list_init))

print(min(moment(x_ave), moment(x_ave + 1)))
# Judge status: Wrong Answer
n, h = map(int, input().split())
l = []
for i in range(n):
  l.append(list(map(int,input().split())))

l = sorted(l, key=lambda x: x[1])
l = sorted(l, reverse=True, key=lambda x: x[0])
c_a = 0
c_b = 0
b_sum = 0
for i in range(1, n):
  if l[i][1] > l[0][0]:
    b_sum += l[i][1]
    c_b += 1



while h-b_sum > l[0][1]:
  h -= l[0][0]
  c_a += 1

h -= l[0][1]
if h <= 0:
  print(c_a+1)
else:
  print(c_a+1+c_b)
# Judge status: Wrong Answer

import sys  
import numpy as np

input = sys.stdin.readline

N = input()
sum_ = 0

for i in list(N)[:-1]:
    
    sum_+=int(i)

print(sum_)
# Judge status: Accepted
x=int(input())
ans=[]
for a in range(1001):
    for b in range(-1000,1001):
        if a==b==0:
            pass
        else:
            if x%(a**4+a*a*a*b+a*a*b*b+a*b*b*b+b**4)==0:
                if a**5-b**5==x:
                    print(a,b)
                    exit()
# Judge status: Wrong Answer
n, k, x, y = (int(input()) for i in range(4))
if k <= n:
  print(k*x)
else:
  print(k*x + (n-k)*y)
# Judge status: Accepted
import bisect
N = int(input())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
count = 0
for b in B:
    a = bisect.bisect_left(A,b)
    c = bisect.bisect_right(C,b)
    count += a*(N-c)
print(count)
# Judge status: Accepted
n = int(input())
a,b,c = 1,1,1
for i in range(n):
  a *= 10
  b *= 9
  c *= 8
  a %= 10** 9 + 7
  b %= 10** 9 + 7
  c %= 10** 9 + 7
print((a - 2 * b +c)%(10** 9 + 7))
# Judge status: Wrong Answer
s = input()
sl = len(s)
l = [0]*sl
c = 0
ans = 0

for i in range(sl):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        l[i] = 1

for i in range(sl):
    if l[i] == 1:
        c += 1
    else:
        ans = max(ans, c)
        c = 0

print(ans)
# Judge status: Wrong Answer
A,B = map(str,input().split())
La = [int(A[:3]),int(A[3:])]
Lb = [int(B[:3]),int(B[3:])]
L = 900 - (La[0] - 100) - (999 - Lb[0])
ch1 = int(A[1] + A[0])
ch2 = int(B[1] + B[0])
if Lb[1] <= ch2:
  L -= 1
if ch1 <= La[1]:
  L -= 1
print(L)
# Judge status: Accepted
N,X,T = map(int,input().split())

ans = ( (N-1) // X + 1 ) * T

print(ans)
# Judge status: Accepted
L, R = map(int, input().split())
M = (L+2019-1)//2019*2019

if M<=R:
    print(0)
    exit()

ans = 10**18

for i in range(L, R):
    for j in range(i+1, R+1):
        ans = min(ans, i*j%2019)

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

l = [0] * N
for i in range(N):
    l[i] = L + i

ans = sum(l)
res = 10 ** 9
d = 0
for i in range(N):
    tmp = l[:i] + l[i+1:]
    solve = sum(tmp)
    c = abs(ans - solve)

    if(res > c):
        res = c
        d = solve

print(d)
# Judge status: Accepted
S = list(input())
S.sort()

a = ['a','b','c']

if S == a:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import sys
input = sys.stdin.readline


def log(*args):
    print(*args, file=sys.stderr)


def main():
    N, _L = map(int, input().rstrip().split())
    s = [input().rstrip() for _ in range(N)]
    print(''.join(sorted(s)))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N,M=map(int,input().split())
print(N*(N-1)/2+M*(M-1)/2)
# Judge status: Wrong Answer
N = int(input())

if 999<=N <= 1000:
     print('ABC')
else:
    print('ABD')
# Judge status: Accepted

def resolve():
    MOD = 10 ** 9 + 7
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    for i in range(60):
        p = 1 << i
        one = sum([1 for a in A if a & p])
        zero = N - one
        ans += p * one * zero
        ans %= MOD
    print(ans)


if __name__ == "__main__":
    resolve()
# Judge status: Accepted
X = int(input())
if X>=400 and X <=599:
    print("8")
if X>=600 and X <=799:
    print("7")
if X>=800 and X <=999:
    print("6")
if X>=1000 and X <=1199:
    print("5")
if X>=1200 and X <=1399:
    print("4")
if X>=1400 and X <=1599:
    print("3")
if X>=1600 and X <=1799:
    print("2")
if X>=1800 and X <=1999:
    print("1")
# Judge status: Accepted
def main():
    MOD = 10**9 + 7
    n = int(input())
    s = input().rstrip()
    alp = [1]*26
    ans = 0
    for c in s:
        p = ord(c) - ord("a")
        alp[p] += 1
        x = 1
        for i in range(26):
            if i == p:
                continue
            x *= alp[i]
            x %= MOD
        ans += x
        ans %= MOD
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
import re

s = "".join("." if i == "?" else i for i in input())
t = input()

lent = len(t)
mstart = -1
for start in range(len(s) - lent + 1):
    m = re.match(re.compile(s[start:start+lent]), t)    
    if m:
        mstart = start
else:
    if mstart == -1:
        print("UNRESTORABLE")
    else:
        s = s[:mstart] + t + s[mstart+lent:]
        print(s.replace(".", "a"))
# Judge status: Accepted
import collections

s=list(input())
t=list(input())

ss=collections.Counter(s)
tt=collections.Counter(t)

s_v = sorted(ss.values())
t_v = sorted(tt.values())

if s_v == t_v:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7

s = sum(a)
ans = 0

for i in a:
  s -= i
  s %= mod
  ans += s*i
  ans %= mod
  
print(ans)
# Judge status: Accepted
A, B, C, D = map(int, input().split())

print(max(min(B, D)-max(A, C), 0))
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
d=sum(a)
ans=d
for i in range(n):
  d=d-2*a[i]
  if abs(d)<ans:
    ans=abs(d)
print(ans)
# Judge status: Accepted
n = int(input())
c = 1
s = []
for i in range(n):
  ss = input()
  s.append(ss)
s.sort()  
for j in range(1,n):
  #print(s[i],s[i-1])
  if s[j] !=s[j-1]:
    c+=1 
print(c)
# Judge status: Accepted
from itertools import product
import numpy as np
N,M,X=map(int,input().split(' '))
Books=[np.array(list(map(int,input().split(' ')))) for i in range(N)]
A=[0]*M
maxi = sum([Books[i][0] for i in range(N)])+1
ans = maxi
for i in product([0,1],repeat=N):
    tmp = np.array([0]*M)
    t_ans = 0
    for n,j in enumerate(i):
        if j:
            tmp += Books[n][1:]
            t_ans += Books[n][0]
    if tmp.min() >=X:
        ans = min(ans,t_ans)
if ans < maxi:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
def problemA():
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())
    if N <= K:
        ans = N*X
    else:
        ans = K*X + (N-K)*Y
    print(ans)


if __name__ == '__main__':
    problemA()
# Judge status: Accepted
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X % n)
    return str(X % n)


N, K = list(map(int, input().split()))
ans = Base_10_to_n(N, K)
print(len(ans))
# Judge status: Accepted
s = input()
if s.count('a') == 1 and s.count('b') == 1 and s.count('c') == 1:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
S,T = input().split()
A,B = map(int,input().split())
U = input()

if S == U:
  A -= 1
else:
  B -= 1
  
print(A,B)
# Judge status: Wrong Answer
s = input()
s = s[::-1]
news = ""
c = 0
for i in range(len(s)):
    if s[i] == "B":
        c += 1
    elif c == 0:
        news += s[i]
    else:
        c = 0
print(news)
# Judge status: Accepted
a=int(input())
x = 0
i = 0
while(1):
  x += a
  i += 1
  x %= 360
  if x:
    continue
  else:
    print(i)
    quit()
# Judge status: Accepted
a, b = input().split()
a = int(a)

for i in range(len(b)):
    if b[i] == '.':
        t = 10 ** (len(b)-1-i)
        nb = int(b[:i] + b[i+1:])

print(a*nb//t)
# Judge status: Accepted
N = int(input())
arr = list(map(int, input().split()))
flg = False
ans = 0
for i in range(N):
    if flg:
        flg = False
        continue
    if arr[i] == i + 1:
        flg = True
        ans += 1
print(ans)
# Judge status: Wrong Answer
s=list(input())
from collections import Counter
d=Counter(s)
print(min(d[0], d[1])*2)
# Judge status: Accepted
N = int(input())
X = [0]*N
for i in range(N):
    X[i] = [0]*2
    x, l = map(int, input().split())
    X[i][1] = x - l
    X[i][0] = x + l
X = sorted(X)
nowplace = X[0][0]
ans = 1
for j in range(1, N):
    if nowplace <= X[j][1]:
        ans += 1
        nowplace = X[j][0]

print(ans)
# Judge status: Accepted
# EASY!数値をintでリスト化する方法を学んだ

n = int(input())
l = list(map(int,list(str(n))))
#print(l)
x = int(str(l[0])+str(l[0])+str(l[0]))
y = int(str(l[0]+1)+str(l[0]+1)+str(l[0]+1))

if n <= x:
    print(x)
else:
    print(y)
# Judge status: Accepted
x, y = map(int, input().split())

mod = 10 ** 9 + 7


def choose(n, r):
    cx = 1
    cy = 1
    for i in range(r):
        cx = cx * (n - i) % mod
        cy = cy * (i + 1) % mod
    cy = pow(cy, mod - 2, mod)
    return cx * cy % mod


if (x + y) % 3 != 0:
    print(0)
    exit()
else:
    n = (x + y) // 3
    x -= n
    y -= n
    if x < 0 or y < 0:
        print(0)
        exit()
    print(choose(x + y, x))
# Judge status: Wrong Answer
K, A, B = map(int, input().split())

ans = 0
if K % 2 == 0:
  ans = max(K+1, K//2*(B-A) - (A-1))
else:
  ans = max(K+1, (K-1)//2 *(B-A) - A)

print(ans)
# Judge status: Wrong Answer
x = int(input())
if x >= 30:
  print("Yes")
else:
  print("N0")
# Judge status: Accepted
N=int(input())
1<=N<=10000
if((N%1000)==0):
	print("0")
else:
	print(1000-(N%1000))
# Judge status: Wrong Answer
n = int(input())
res = float('inf')
for a in range(int(n/2)+1):
    b = n-a
    tmp = 0
    for c in str(a):
        tmp += int(c)
    for c in str(b):
        tmp += int(c)
    res = min(res, tmp)
print(res)
# Judge status: Wrong Answer
S = input()
if S.endswith('e') :
 print(S+'s')
elif  S.endswith('s'):
 print(S+'es')
else:
 print(S)
# Judge status: Accepted
N=int(input())
if N<=1000:
    print(1000-N)
if 2000>=N>1000:
    print(2000-N)
if 3000>=N>2000:
    print(3000-N)
if 4000>=N>3000:
    print(4000-N)
if 5000>=N>4000:
    print(5000-N)
if 6000>=N>5000:
    print(6000-N)
if 7000>=N>6000:
    print(7000-N)
if 8000>=N>7000:
    print(8000-N)
if 9000>=N>8000:
    print(9000-N)
if 10000>=N>=9000:
    print(10000-N)