peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N = int(input())
if N < 1000:
    tmp = str(N)
    print("ABC"+tmp.zfill(3))
else:
    tmp = str(N%1000+1)
    print("ABD"+tmp.zfill(3))
# Judge status: Accepted
import sys
N=int(sys.stdin.readline().strip())
XY=[ map(int, sys.stdin.readline().split()) for _ in range(N) ]
X=[]
Y=[]
for x,y in XY:
    X.append(x-y)
    Y.append(x+y)
X.sort()
Y.sort()
print max(abs(X[0]-X[-1]),abs(Y[0]-Y[-1]))
# Judge status: Accepted
a, b, c = map(int, input().split())
if any(x % 2 == 0 for x in (a, b, c)):
    print(0)
else:
    print(min(a*b, b*c, c*a))
# Judge status: Accepted
a,b,c=input().split();print(a[0]+b[0]+c[0])
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()

l = 0
for i in range(n):
  for j in range(n):
    if s[i] == t[j]:
      l += 1
      
print(2 * n - l)
# Judge status: Accepted
from sys import stdin, stdout
from time import perf_counter

import sys
sys.setrecursionlimit(10**9)
mod = 10**9+7

# import sys
# sys.stdout = open("e:/cp/output.txt","w")
# sys.stdin = open("e:/cp/input.txt","r")

n,l = map(int,input().split())
a = [input() for item in range(n)]
b = sorted(a)
print(''.join(b))
# Judge status: Accepted
k = int(input())

lunlun = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for li in lunlun:
     if 10**10 < li:
         break
     lunlun.append(li * 10 + li % 10)
     if 0 <= li % 10 < 9:
         lunlun.append(li * 10 + li % 10 + 1)
     if 0 < li % 10 <= 9:
         lunlun.append(li * 10 + li % 10 - 1)
lunlun.sort()
print(lunlun[k - 1])
# Judge status: Accepted
def main():
    from math import ceil
    from itertools import accumulate
    from bisect import bisect_left
    n, h, *ab = map(int, open(0).read().split())

    x = max(ab[::2])
    *y, = filter(lambda i: i >= x, ab[1::2])
    y = sorted(y, reverse=True)
    *z, = accumulate(y)

    if z[-1] <= h:
        print(len(y) + ceil((h - z[-1]) / x))
    else:
        print(bisect_left(z, h) + 1)


if __name__ == '__main__':
    main()
# Judge status: Accepted
def main():
    O = input()
    E = input()

    ans = ''
    for i in range(len(O)):
        if len(O) == len(E):
            ans += O[i] + E[i]
        elif i < len(O)-1:
            ans += O[i] + E[i]
        else:
            ans += O[i]

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())

a = [0] + list(map(int, input().split()))
a = sorted(a)

# print(f"N:{N} a:{a}", file=sys.stderr)
max_power = 0
for i in range(N):
    max_power += a[(N + 1) + 2 * i]
print(max_power)
# Judge status: Accepted
N = int(input())
A = tuple(map(int, input().split()))

MOD = 10 ** 9 + 7
cnt = [0] * 61

for a in A:
  for i in range(61):
    cnt[i] += 1 if (a >> i) & 1 else 0

answer = 0
for i in range(61):
  answer = (answer + (2 ** i * cnt[i] * (N - cnt[i]))) % MOD
print(answer)
# Judge status: Wrong Answer
S = input()
k = len(S)//2
res = 0
for i in range(k):
  if S[i]==S[len(S)-1-i]:
    res += 1
print(res)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = max(ans,sum(a[:5-i])+sum(b[4-i:]))
print(ans)
# Judge status: Wrong Answer
import numpy as np
n = int(input())
a = list(map(int,input().split()))
base = np.zeros(100000)

for i in range(n):
  base[a[i]-1] += 1
  base[a[i]] += 1
  base[a[i]-2] += 1
  
print(int(max(base)))
# Judge status: Wrong Answer
n, x = map(int, input().split())
a = [ int(x) for x in input().split() ]

ans = 0

for i in range(n-1):
    # greedy
    if a[i] + a[i+1] > x:
        cost = ((a[i] + a[i+1]) - x)
        a[i+1] -= cost
        ans += cost

print(ans)
# Judge status: Accepted
S=input()
T=input()
dict1={}
a=0
for i in range(len(S)):
  if S[i] in dict1:
    if dict1[S[i]]!=T[i]:
      a=1
  else:
    dict1[S[i]]=T[i]
dict2={}
for i in range(len(T)):
  if T[i] in dict2:
    if dict2[T[i]]!=S[i]:
      a=1
  else:
    dict2[T[i]]=S[i]
if a==0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import numpy as np

n = int(input()) 

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

minus = 0
zero = 0
for num in nums:
    if num == 0:
        zero += 1
        break
    elif num < 0:
        minus += 1

nums = np.abs(nums)
nums.sort()

if minus % 2 and not zero:
    ans = sum(nums) - 2 * nums[0]

else:
    ans = sum(nums)

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

if k <= a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(a-(k-a-b))
# Judge status: Wrong Answer

s = str(input())
n = len(s)
s1 = s[:int((n-1)/2)]
s2 = s[int((n+3)/2)-1:]


i = 1
while i < len(s):
    if not s[i-1] == s[-i]:
        print("No")
        exit()
    i += 1
while i < len(s1):
    if not s1[i-1] == s1[-i]:
        print("No")
        exit()
    i += 1
while i < len(s2):
    if not s2[i+2] == s2[-i]:
        print("No")
        exit()
    i += 1
print("Yes")
# Judge status: Accepted
n = int(input())
p = [int(x) for x in input().split()]

ans = 0
for i in range(n):
    if p[i] == i+1:
        if i+1 < n:
            p[i],p[i+1] = p[i+1],p[i]
        ans += 1
print(ans)
# Judge status: Wrong Answer
import sys
S=input()
first=S[0]
second=S[1]
last=S[len(S)-1]
cnt=0
moji=[i for i in "abcdefghijklmnopqrstuvwxyz"]
# print(len(moji))

if first=="A":
  for i in range(2,len(S)-1):
    print(i)
    if S[i]=="C":
      cnt+=1
    else:
      if (S[i] in moji)==False:
        print("WA")
        sys.exit()

  if cnt==1 and ((last in moji)==True) and ((second in moji)==True):
    print("AC")
  else:
    print("WA")
        
else:
  print("WA")
# Judge status: Wrong Answer
inp = (input().split())

if inp[0] == inp[1]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N = int(input())
C = [0]*(N-1)
S = [0]*(N-1)
F = [0]*(N-1)
for TN in range(0,N-1):
    C[TN],S[TN],F[TN] = (int(T) for T in input().split())
for TN in range(0,N):
    Time = 0
    for TS in range(TN,N-1):
        if Time>=S[TS]:
            Time += C[TS]+(F[TS]-(Time%F[TS]))%F[TS]
        else:
            Time += C[TS]+(S[TS]-Time)
    print(Time)
# Judge status: Accepted
N = int(input())
if int(N//1.08 * 1.08) == N:
    print(int(N//1.08))
elif int(-(-N//1.08) * 1.08) == N:
    print(int(-(-N//1.08)))
else:
    print(':(')
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    A, B, C = inl()
    if A % 2 == 0 or B % 2 == 0 or C % 2 == 0:
        return 0
    x = sorted([A, B, C])

    return x[0] * x[1]


print(solve())
# Judge status: Wrong Answer
N,A,B=map(int,input().split())

sum=0

if A==0:
    print(0)
else:
    a=N//(A+B)
    b=N%(A+B)

    # print(a)
    # print(b)

    sum=A*a+b

    print(sum)
# Judge status: Accepted
y,m,d=map(int,input().split("/"))
print('TBD' if (y>2019 or (y==2019 and m>4)) else 'Heisei')
# Judge status: Accepted
from fractions import gcd
a, b, c, d = map(int, input().split())

lcm = lambda x, y: x * y // gcd(x, y)
a -= 1
ans = b - (b // c + b // d - b // lcm(c, d)) - a + (a // c + a // d - a // lcm(c, d))
print(ans)
# Judge status: Accepted
import sys

N,H=map(int,input().split())
A=[0]*N
B=[0]*N

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

max_A=max(A)
B.sort(reverse=True)

K=0
for b in B:
    if H>0 and b>=max_A:
        K+=1
        H-=b

if H>0:
    K+=(H+max_A-1)//max_A

print(K)
# Judge status: Wrong Answer
import functools
import fractions
def lcm(a, b):
    return a * b // fractions.gcd(a, b)
N,M=map(int,input().split())
A=list(map(int,input().split()))
LCM=functools.reduce(lcm,A)
HLCM=LCM//2
Y=M//HLCM
if Y%2==0:
    print(Y//2)
else:
    print((Y+1)//2)
# Judge status: Accepted
S = input()
if S.count("hi") > 0:
    num = S.count("hi")
    S = S.replace("hi", "", num)
    if len(S) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Accepted
n = int(input())
 
ans = []
while n != 0:
    if n % 2 != 0:
        n -= 1
        ans.append("1")
    else:
        ans.append("0")
    n //= -2
 
if len(ans) == 0:
    ans.append("0")
 
print("".join(reversed(ans)))
# Judge status: Accepted
ans = 0
position = []
for i in range(5):
    x = int(input())
    position.append(x)
k = int(input())
distance_list = []
for i in range(5):
    for j in range(5):
        if i != j:
            distance = abs(position[i] - position[j]) 
            distance_list.append(distance)

y = max(distance_list)
if y <= k:
    print('Yay!')
else:
    print(':(')
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))

P=sorted(A)
cnt=0

for i in range(len(A)):
    if A[i] != P[i]:
        cnt += 1

print("YES" if cnt <= 2 else "NO")
# Judge status: Accepted
n=int(input())
ans=int(0)
check=int(0)
A=[]
for i in range(1,n*100):
    ans+=i
    A.append(i)
    if ans>=n:
        break

check=ans-n
for i in range(len(A)):
    if i==check-1:
        continue
    else:
        print(A[i])
# Judge status: Accepted
import math
N,M,K = map(int,input().split())
list = [0 for i in range(N*M+1)]
i = 0
while i <= M:
    k=0
    list[N*i]=1
    while k < N:
        list[N*i+(M-2*i)*k]=1
        k+=1
    i+=1
j = 0
while j <= N:
    l = 0
    list[M*j]=1
    while l < M:
        list[M*j+(N-2*j)*l]=1
        l+=1
    j+=1
if list[K] ==1:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s = input()

l = ['SUN','MON','TUE','WED','THU','FRI','SAT']

ans = l.index(s)

if ans == 0:
    ans = 7

print(ans)
# Judge status: Accepted
a=str(input())
ans=1000
for i in range(len(a)-2):
    ans=min(ans,abs(int(a[i]+a[i+1]+a[i+2])-753))
print(ans)
# Judge status: Accepted
N, Q = map(int, input().split())
S = str(input())

l = [0]*N
count = 0

for i in range (1, N):
	if S[i-1] == 'A' and S[i] == 'C':
		count+=1
		l[i] = count
	else:
		l[i] = count

for i in range(0, Q):
	O, P = map(int, input().split())
	print(l[P-1] - l[O-1])
# Judge status: Accepted
a,b,c,d = map(int,input().split())
total_num = b-a+1
# # of x%c==0
c_num = b//c - (a-1)//c
d_num = b//d - (a-1)//d
from fractions import gcd
lcm = c*d//gcd(c,d)
cd_num = b//lcm - (a-1)//lcm
print(total_num-c_num-d_num+cd_num)
# Judge status: Wrong Answer
# coding: utf-8

N = int(input())

ans_cou = 0
ans_num = 0
for i in range(N + 1):
    a = i
    sum = 0
    while a % 2 == 0 and a != 0:
        sum += 1
        a = a // 2
    if sum > ans_cou:
        ans_cou = sum
        ans_num = i

print(ans_num)
# Judge status: Wrong Answer
import math

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

if K == 0:
  print(int(max(A)))
  exit()

if N == 1:
  print(math.ceil(A[0]/K))
  exit()


min_A = 0
max_A = 10**10

while( max_A - min_A > 1):
  now = (min_A + max_A) // 2
  temp = 0
  for i in A:
    if i > now:
      temp += (i // now)
  if temp > K:
    min_A = now
  else:
    max_A = now
print(int(min_A) + 1)
# Judge status: Accepted

def resolve():
    X, a, b = list(map(int, input().split()))
    print("A" if abs(X-a) < abs(X-b) else "B")


if '__main__' == __name__:
    resolve()
# Judge status: Accepted
a, b, n = list(map(int, input().split()))
x = min(b - 1, n) # b-1がいいけど、上限 nの制約あり
ans = int(a * x / b)
print(ans)
# Judge status: Accepted
N,S=int(input()),input()
ans=0
for i in range(1,N):
    a,b,c=S[:i],S[i:],0
    for j in range(97,123):
        if chr(j)in a and chr(j)in b:c+=1
    ans=max(ans,c)
print(ans)
# Judge status: Accepted
s=list(input())
r=[]

for x in s:
    if x=="0":r.append("0")
    elif x=="1":r.append("1")
    elif x=="B" and len(r)>0:
        r.pop()
print("".join(r))
# Judge status: Wrong Answer
N = int(input())
 
m = 10**9 + 7
a = 10**N
a %= m
b = 9**N
b %= m
c = 8**N
c %= m

ans = a - 2*b + c
ans %= m
print(ans)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
count=0
A={}
for i,j in enumerate(a):
    A[i+j]=0
    #print(A)
    if i-j in A.keys():
        count+=1
    if i+j in a:
        A[i+j]+=1
    else:
        A[i+j]=1

count=sum(A.values())
print(count)
# Judge status: Accepted
three = list(map(int, input().split()))
three.sort()

print(int(three[0] * three[1] / 2))
# Judge status: Wrong Answer
s_l = list(input())

print('Yes') if len(s_l) == len(set(s_l)) else print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
s = 0
for i in range(n):
    a[i] -= (i+1)

a.sort()
for i in range(n):
    s += (a[i]-a[n//2])

print(s)
# Judge status: Wrong Answer
N, X, Y = map(int, input().split())
K = [0]*N
for i in range(1,N+1):
	for j in range(i+1,N+1):
		K[min(min(abs(X-i)+1,abs(Y-i))+abs(j-Y),abs(i-j))-1]+=1
for i in range(N):
	print(K[i])
# Judge status: Accepted
n, m = map(int, input().split())

print('Yes') if n == m else print('No')
# Judge status: Accepted
N,T = map(int,input().split())
c = 0
for _ in range(N):
  _c, _t = map(int,input().split())
  if _t <= T:
    if c == 0:
      c = _c
    elif c != 0 and _c <= c:
      c = _c
print(c if c != 0 else "TLE")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
x = 0
y = 0
z = 0
for i in range(n):
  if a[i] % 2 == 1:
    x += 1
  elif a[i] % 4 == 0:
    z += 1
  elif a[i] % 2 == 0:
    y += 1

if x == 0:
  ans = 'Yes'
elif y == 0:
  if x <= z + 1:
    ans = 'Yes'
  else:
    ans = 'No'
else:
  if x > z:
    ans = 'No'
  else:
    ans = 'Yes'
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

A.sort()
C = [0] * A[-1]
for Ai in A:
    if C[Ai - 1] >= 1:
        C[Ai - 1] += 1
        continue
    i = Ai
    while i <= A[-1]:
        C[i - 1] += 1
        i += Ai
print(sum([C[Ai - 1] == 1 for Ai in A]))
# Judge status: Accepted
x,a,b=map(int,input().split())
n=b-a
if n<=0:
    print("delicious")
elif n<=x:
    print("safe")
else:
    print("dangerous")
# Judge status: Accepted

n = int(input())
cnt2 = 0
cnt4 = 0
A = list(map(int, input().split()))
for a in A:
    if a % 4 == 0:
        cnt4 += 1
    elif a % 2 == 0:
        cnt2 += 1
odd = n - cnt2 - cnt4
if cnt2 != 0:
    odd += 1

if odd - 1 > cnt4:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

k, x = map(int, input().split())
ans = 'No'
if 500 * k >= x:
    ans = 'Yes'

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

ans = 1

for i in A:
  ans = ans * i
  if ans > 10**18:
    ans = -1
    break
for i in A:
  if i == 0:
    ans = 0
print(ans)
# Judge status: Accepted
x, k, d = map(int, input().split())

x = abs(x)

if x == 0:
    if k % 2 == 0:
        print(0)
    else:
        print(d)
    exit()

if x - k*d >= 0:
    print(abs(x) - k*d)
else:
    k -= (x//d)
    x -= (x//d)*d
    if k % 2 == 0:
        print(x)
    else:
        print(abs(x-d))
# Judge status: Accepted
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    x = sorted(list(map(int, input().split())))
    diff = list()

    for i, j in zip(x, x[1:]):
        diff.append(abs(i - j))

    diff = sorted(diff, reverse=True)
    print(sum(diff) - sum(diff[:n - 1]))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
ls=[0 for _ in range(N)]
for i in range(N):
  ls[A[i]-1]+=1
s=0
for i in range(len(ls)):
    m=ls[i]*(ls[i]-1)//2
    s+=m
for j in range(N):
  print(s-(ls[A[j]-1]-1))
# Judge status: Accepted
N = int(input())
S = input()

d = [0] * (N + 1)
for i in range(N):
    d[i + 1] = d[i] + int(S[i] == "(") - int(S[i] == ")")

a = d[-1]
b = min(d)

print("(" * -b + S + ")" * (a - b))
# Judge status: Accepted
N,T = map(int,(list(input().split())))
cost = 1001
for _ in range(N):
    c,t = map(int,(list(input().split())))
    if t<=T:
        cost=min(cost,c)
if cost == 1001:
    print('TLE')
else:
    print(cost)
# Judge status: Wrong Answer
n,k=map(int,input().split())
cnt=1
ans=0
if k>n:
 print(1)
else:
 while n>cnt:
  ans+=1
  cnt*=k
 print(ans)
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1, int(n**0.5)+1):
    if i*i <= n:
        ans = i*i
print(ans)
# Judge status: Accepted
K=int(input())
A,B=map(int, input().split())
cnt=0

for i in range(B//K+1):
    if A<=K*i and K*i<=B:
        cnt+=1
print('OK' if cnt>0 else 'NG')
# Judge status: Accepted
n,m = map(int,input().split())
if n*2>m:
  print(m//2)
else:
  m -= n*2
  print(n+m//4)
# Judge status: Accepted
from collections import Counter
def main():
    n = int(input())
    A = list(map(int, input().split()))
    c = Counter(A)
    B = sorted([(k, v) for k, v in c.items() if v >= 2], reverse = True, key = lambda x: x[0])
    if len(B) < 2:
        print(0)
    elif B[0][1] >= 4:
        print(B[0][0] ** 2)
    else:
        print(B[0][0] * B[1][0])

if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
from bisect import bisect_left

read=sys.stdin.buffer.readline

N=int(read())
L=list(map(int,read().split()))

L.sort()

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

print(ans)
# Judge status: Accepted
N = int(input())
cnt = [0] * (N+1)
for x in range(1, int(N**0.5)+1):
    for y in range(1, int(N**0.5)+1):
        fxy = x**2 + y**2 + x*y
        if N < fxy: break
        for z in range(1, int(N**0.5)+1):
            f = fxy + z**2 + y*z + z*x
            if N < f: break
            cnt[f] += 1
print(*cnt[1:], sep='\n')
# Judge status: Accepted
_,b,c=map(int,input().split('/'));print("HTeBiDs e i"[b>4and c>0::2])
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N, A, B = mi()
    if (B-A)%2==0:
        print((B-A)//2)
    else:
        print(min(B-1, N-A))


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n=I()
ps=LI()
compare=[]
count=0
for i in range(1,n-1):
    compare=[]
    compare.append(ps[i-1])
    compare.append(ps[i])
    compare.append(ps[i+1])
    s=sorted(compare)
    if ps[i]==s[1]:
        count+=1
print(count)
# Judge status: Wrong Answer
A, B, K = map(int, input().split())

cnt = 0
for i in range(1, 101):
    if A%i == 0 and B%i == 0:
        cnt += 1
    if cnt == K:
        print(i)
        break
# Judge status: Accepted
l=list(map(int,input().split()))
print("Yes")if(e:=sum(l))%2==0 and e//2 in l else print("No")
# Judge status: Accepted
#C
import numpy as np
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
G = 0
lists = np.zeros(N)
for i in range(M):
    A, B = list(map(int, input().split()))
    if H[A-1] < H[B-1]:
        lists[A-1] = 1
    elif H[A-1] == H[B-1]:
        lists[A-1] = 1
        lists[B-1] = 1
    else:
        lists[B-1] = 1
for i in range(N):
    if lists[i] == 0:
        G += 1
print(G)
# Judge status: Accepted
s = input()
n = len(s)
a = s[:(n-1)//2]
b = s[(n+3)//2-1:n]
if s == s[::-1] and a == a[::-1] and b == b[::-1]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def ncr(n, r):
    return fac[n] * facinv[r] * facinv[n - r] % MOD


MOD = 10 ** 9 + 7
X, Y = map(int, input().split())

N = 10 ** 6
fac = [1, 1]
facinv = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
    fac.append(fac[i - 1] * i % MOD)
    inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
    facinv.append((facinv[-1] * inv[-1]) % MOD)

if (X + Y) % 3 or Y > 2 * X or Y < X // 2:
    print(0)
    exit()
d = (X + Y) // 3
print(ncr(d, X - (X + Y) // 3))
# Judge status: Accepted
#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

n=int(input())
H=input_array()

ans=0
tmp_ans=0
for i in range(1,n):
	if H[i-1]>=H[i]:
		tmp_ans+=1
	else:
		if tmp_ans>ans:
			ans=tmp_ans
		tmp_ans=0
if tmp_ans>ans:
	ans=tmp_ans
print(ans)
# Judge status: Accepted
from copy import deepcopy
n = int(input())
s = [input() for _ in range(n)]
cnt = []

for si in s:
    tmp = [0] * 26
    for i in range(len(si)):
        tmp[ord(si[i])-97] += 1
    if cnt == []:
        cnt = deepcopy(tmp)
    else:
        for j in range(26):
            cnt[j] = min(cnt[j], tmp[j])

ans = ''
for i in range(26):
    for j in range(cnt[i]):
        ans += chr(i+97)
print(ans)
# Judge status: Wrong Answer
N = int(input())
S = ""
c = 1
while N != 0:
  if N%(2**c) != 0:
    N -= (-2)**(c-1)
    S = "1" + S
  else:
    S = "0" + S
  c += 1
print(S)
# Judge status: Accepted
N = int(input())
S = input()

cnt = S.count("R")*S.count("G")*S.count("B")
for i in range(N):
    for d in range(N):
        j = i+d
        k = j+d
        if(k >= N):
            break
        if(S[i] != S[j] and S[j] != S[k] and S[k] != S[i]):
            cnt -= 1
print(cnt)
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M = mapint()
As = list(mapint())
As.sort()

BC = [list(mapint()) for _ in range(M)]
BC.sort(key=lambda x: x[1])

cum = 0
for b, c in BC[::-1]:
    if b<As[0]:
        break
    As.extend([c]*b)
    cum += b
    if cum>=N:
        break

As.sort(reverse=True)
print(sum(As[:N]))
# Judge status: Accepted
D = int(input())
print('Christmas'+' Eve'*(25-D))
# Judge status: Accepted
X,K,D=map(int,input().split())
c=[]
k=K
if X<0:
  X=-X
if X-K*D>0:
  print(X-K*D)
else:
  a=X//D
  if a%2==K%2:
    print(min((X-D*a),abs(X-D*(a+2))))
  else:
    print(min((X-D*(a-1)),abs(X-D*(a+1))))
# Judge status: Accepted
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
r=[0]*(n+1)
for i in range(n):
    l[i+1]=gcd(l[i],a[i])
for i in range(n-1,-1,-1):
    r[i]=gcd(r[i+1],a[i])
ans=l[-1]
for i in range(n):
    ans=max(ans,gcd(l[i],r[i+1]))
print(ans)
# Judge status: Wrong Answer
n = int(input())
s = 0

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

  
for i in range(n):
  s += b[i]

  
for i in range(n-1):
  if a[i+1] - a[i] == 1:
    s += c[a[i]-1]
  print(s)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))

cnt=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i]==l[j] or l[j]==l[k] or l[i]==l[k]:
                continue
            if abs(l[i]-l[j])<l[k]<l[i]+l[j]:
                cnt+=1

print(cnt)
# Judge status: Accepted
from math import gcd

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

if N==2:
    print(max(A))
else:
    L=[0 for _ in range(N)]
    R=[0 for _ in range(N)]
    L[0]=A[0]
    R[-1]=A[-1]
    for i in range(1,N):
        L[i]=gcd(A[i-1],L[i-1])
        R[N-1-i]=gcd(A[N-i],R[N-i])
    ans=max(L[-1],R[0])
    for j in range(1,N-1):
        ans=max(ans,gcd(L[j],R[j]))
    print(ans)
# Judge status: Accepted
s = int(input())
p = [0]*(s+1)
mod = 10**9 + 7
p[0] = 1

if s >= 3:
	for i in range(3,s+1):
		p[i] = (sum(p[:i-2]))%mod
print(p[s])
# Judge status: Wrong Answer
import math
n = int(input())
X = [0]*n
Y = [0]*n
for i in range(n):
    X[i],Y[i] = map(int, input().split())

X.append(X[0])
Y.append(Y[0])

def length(X1, Y1, X2, Y2):
    l = (X2-X1)**2 + (Y2-Y1)**2
    return math.sqrt(l)

sum = 0
for i in range(n):
    sum += length(X[i],Y[i],X[i+1],Y[i+1])
#print(sum)
ans = sum * (2/n)
print(ans)
# Judge status: Accepted
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [input() for _ in range(n)]

n = int(input())

q, mod = divmod(n,111)

if mod == 0:
    print(q*111)
else:
    print((q+1)*111)