Harryxun/stf_run huggingface dataset:
n,k = map(int,input().split())
A = list(map(int,input().split()))
B = []
B.append(A[0])
b = 1

while True:
  a = A[b-1]
  b = A[a-1]
  B.append(b)
  if len(B) == len(A):
    break

print(B[k])


### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
pos = 0
visit = [0] * N
move = []
roop = []
while visit[pos]!=2:
    if visit[pos]==0:
        move.append(pos)
    else:
        roop.append(pos)
    visit[pos] += 1
    pos = A[pos] - 1
if len(move)>K:
    print(move[K]+1)
else:
    print(roop[(K-(len(move)-len(roop)))%len(roop)]+1)
n, m = [int(i) for i in input().split()]

matrix = []
for ni in range(n):
    matrix.append([int(a) for a in input().split()])

vector = []
for ni in range(n):
    vector.append(int(input()))
    
for ni in range(n):
    sum = 0
    for mi in range(m):
        sum += matrix[ni][mi] * vector[mi]

    print(sum)


print(matrix)
print()
print(vector)

### FIXED CODE ###

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

matrix = []
for ni in range(n):
    matrix.append([int(a) for a in input().split()])

vector = []
for mi in range(m):
    vector.append(int(input()))

for ni in range(n):
    sum = 0
    for mi in range(m):
        sum += matrix[ni][mi] * vector[mi]

    print(sum)
def abc057_b():
    from math import inf
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(n)]
    cd = [list(map(int, input().split())) for _ in range(m)]

    for i in range(n):
        tmp_index = 0
        d = inf
        for j in range(m):
            tmp_d = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
            if tmp_d < d:
                tmp_index = j
                d = tmp_d
        print(tmp_index + 1)


abc057_b()

### FIXED CODE ###

def abc057_b():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(n)]
    cd = [list(map(int, input().split())) for _ in range(m)]

    for i in range(n):
        tmp_index = 0
        d = 10 ** 9
        for j in range(m):
            tmp_d = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
            if tmp_d < d:
                tmp_index = j
                d = tmp_d
        print(tmp_index + 1)


abc057_b()
import collections
N=int(input())
L=list(map(int,input().split()))
E=[i for i in L[::2]]
O=[i for i in L[1::2]]
e = collections.Counter(E)
o = collections.Counter(O)
e1=e.most_common()[0][1]
e2=e.most_common()[-1][1]
o1=o.most_common()[0][1]
o2=o.most_common()[-1][1]

Ans=[N-e1-o2,N-e2-o1,N-e2-o2,N-o1-e1]

if len(set(L))==1:
  print(N//2)
else:
  print(min(Ans))

### FIXED CODE ###

print(1110-int(input()))
import math

n=int(input())
a=list(map(int,input().split()))
x=1
ans=0
for i in a:
    x=(x*i)//(math.gcd(x,i))
for i in a:
    ans+=(x//i)
ans=ans%(1000000007)
print(ans)

### FIXED CODE ###

def gcd(x, y): 
      
    while(y): 
        x, y = y, x % y 
      
    return x 
 
n=int(input())
a=list(map(int,input().split()))
x=1
ans=0
for i in a:
    x=(x*i)//gcd(x,i)
for i in a:
    ans+=(x//i)
ans=ans%(1000000007)
print(ans)
from collections import deque

def solve(n,k,a):
    mod = 10**9 + 7
    ans = 1
    if k == n:
        for i in a:
            ans = ans * i % mod
        return ans
    else:
        pos = [i for i in a if i>0]
        neg = [i for i in a if i<0]

        if len(neg) + len(pos) < 0:
            return 0            
        elif len(pos)== 0 and k%2== 1:
            neg.sort(reverse=True)
            for i in neg[:k]:
                ans = ans * i % mod
            return ans
        else:
            pos.sort()
            neg.sort(reverse=True)
            ctr = k
            pos = deque(pos)
            neg = deque(neg)

            while ctr >= 2:
                if len(pos) >=2 and len(neg) >2:
                    tmp_p = pos[-1] * pos[-2] %mod
                    tmp_n = neg[-1] * neg[-2] %mod
                    if tmp_p >=tmp_n:
                        ans = ans * tmp_p %mod
                        pos.pop()
                        pos.pop()
                    else:
                        ans = ans * tmp_n %mod
                        neg.pop()
                        neg.pop()
                    ctr-=2
                elif len(neg) >= 2:
                    ans = ans * neg.pop() * neg.pop() %mod 
                    ctr-=2
                else:
                    ans = ans * pos.pop() %mod
                    ctr -=1
                
            if ctr == 1:
                ans = ans * pos.pop() % mod

            return ans
                    
n, k = map(int, input().split())
A = list(map(int,input().split()))
ans = solve(n,k,A)
print(ans)

### FIXED CODE ###

def solve(n,k,a):
    mod = 10**9 + 7
    ans = 1
    l = 0
    r = n-1
    a.sort()
    
    if k%2 == 1:
        ans *= a[r]
        r-=1
    
    if ans < 0:
        ans = 1
        for i in range(k):
            ans*= a[n-i-1]
            ans%= mod
        return ans
    
    for i in range(k//2):
        tmp_min=a[l]*a[l+1]
        tmp_max=a[r]*a[r-1]
        if tmp_max> tmp_min:
            ans*=tmp_max
            ans%=mod
            r-=2
        else:
            ans*= tmp_min
            ans%=mod
            l+=2
    return ans


n, k = map(int, input().split())
A = list(map(int,input().split()))
ans = solve(n,k,A)
print(ans)
k = int(input())
a, b = map(int, input().split())

for i range(a, b):
  if i % k ==0:
    print("OK")
  else:
    print("NO")

### FIXED CODE ###

k=int(input())
a,b=map(int,input().split())
for n in range(a, b+1):
    if n%k==0:
        print('OK')
        exit()
print('NG')
N = int(input())
X = list(input())
one = X.count('1')
L1 = [1]
L2 = [1]

for _ in range(N-1):
    if one == 0:
        L1.append(0)
    else:
        L1.append((L1[-1] * 2) % (one - 1))
    L2.append((L2[-1] * 2) % (one + 1))

x1 = 0
x2 = 0
power1 = 1
power2 = 1

for i in range(N):
    if X[N-i-1] == '1':
        if one - 1 != 0:
            x1 += power1
        x2 += power2
    power1 *= 2
    power2 *= 2
    if one - 1 != 0:
        power1 %= one - 1
    power2 %= one + 1

def solve(X, cnt):
    if X == 0:
        return cnt
    
    X %= bin(X).count('1')
    return solve(X, cnt+1)

for i in range(N):
    if X[i] == '0':
        tmp = (x2 + L2[N-i-1]) % (one + 1)
        ans = solve(tmp, 0) + 1
    else:
        if one - 1 == 0:
            ans = 0
        else:
            tmp = (x1 - L1[N-i-1]) % (one - 1)
            ans = solve(tmp, 0) + 1
    print(ans)

### FIXED CODE ###

N = int(input())
X = list(input())
one = X.count('1')
L1 = [1]
L2 = [1]

for _ in range(N-1):
    if one - 1 == 0:
        L1.append(0)
    else:
        L1.append((L1[-1] * 2) % (one - 1))
    L2.append((L2[-1] * 2) % (one + 1))

x1 = 0
x2 = 0
power1 = 1
power2 = 1

for i in range(N):
    if X[N-i-1] == '1':
        if one - 1 != 0:
            x1 += power1
        x2 += power2
    power1 *= 2
    power2 *= 2
    if one - 1 != 0:
        power1 %= one - 1
    power2 %= one + 1

def solve(X, cnt):
    if X == 0:
        return cnt
    
    X %= bin(X).count('1')
    return solve(X, cnt+1)

for i in range(N):
    if X[i] == '0':
        tmp = (x2 + L2[N-i-1]) % (one + 1)
        ans = solve(tmp, 0) + 1
    else:
        if one - 1 == 0:
            ans = 0
        else:
            tmp = (x1 - L1[N-i-1]) % (one - 1)
            ans = solve(tmp, 0) + 1
    print(ans)
n = int(input())
a = map(int, input().split())
m = []
for i in range(n - 2):
    if a[i] < a[i + 1] < a[i + 2] or a[i + 2] < a[i + 1] < a[i]:
        m.append(0)
    if a[i + 1] < a[i] < a[i + 2] or a[i + 1] < a[i + 2] < a[i]:
        m.append(1)
    if a[i] < a[i + 2] < a[i + 1] or a[i + 2] < a[i] < a[i + 3]:
        m.append(3)

s = sum(abs(a[i] - a[i + 1]) for i in range(n - 1))

print(s - abs(a[0] - a[1]))
for i in m:
    if i == 0:
        print(s)
    elif i > 0:
        print(s - 2 * abs(a[i - 1] - a[i]))
    elif i < 0:
        print(s - 2 * abs(a[i] - a[i + 1]))
print(s - abs(a[n - 1] - a[n]))


### FIXED CODE ###

n = int(input())
a = [0] + list(map(int, input().split())) + [0]
m = []
for i in range(n):
    if a[i] <= a[i + 1] <= a[i + 2] or a[i + 2] <= a[i + 1] <= a[i]:
        m.append(0)
    elif a[i] <= a[i + 2] <= a[i + 1] or a[i + 1] <= a[i + 2] <= a[i]:
        m.append(1)
    elif a[i + 1] <= a[i] <= a[i + 2] or a[i + 2] <= a[i] <= a[i + 1]:
        m.append(-1)

s = sum(abs(a[i] - a[i + 1]) for i in range(n + 1))

for i, m0 in enumerate(m):
    if m0 == 0:
        print(s)
    elif m0 == 1:
        print(s - 2 * abs(a[i + 1] - a[i + 2]))
    elif m0 == -1:
        print(s - 2 * abs(a[i] - a[i + 1]))
dts = input().split()
if dts[1]*dts[2] >= dts[0]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

dts = input().split()
if int(dts[1])*int(dts[2]) >= int(dts[0]):
    print("Yes")
else:
    print("No")
for a in range(500):
    for b in range(500-100*a):
        for c in range(500-100*a-101*b):
            for d in range(500-100*a-101*b-102*c):
                for e in range(500-100*a-101*b-102*c-103*d):
                    for f in range(500--100*a-101*b-102*c*103*d-104*e):
                        if 100*a+101*b+102*c+103*d+104*e+105*f == X:
                            print(1)
                            exit()
                        else:
                            pass
print(0)

### FIXED CODE ###

# C - 100 to 105
X = int(input())

for a in range(2501):
    for b in range(2501-100*a):
        for c in range(2501-100*a-101*b):
            for d in range(2501-100*a-101*b-102*c):
                for e in range(2501-100*a-101*b-102*c-103*d):
                    for f in range(2501-100*a-101*b-102*c*103*d-104*e):
                        if 100*a+101*b+102*c+103*d+104*e+105*f == X:
                            print(1)
                            exit()
                        else:
                            pass
print(0)
import math
r = float[input()]

s = r * r * math.pi
l = r * 2 * math.pi

print("{0:.5f} {1:5f}".format(s, l))

### FIXED CODE ###

import math
r = float(input())

s = r * r * math.pi
l = r * 2 * math.pi

print("{0:.5f} {1:5f}".format(s, l))
n = int(input())
 
s = input()
 
alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","M","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
 
ans = ""
for i in range(len(s)):
    num = (alphabet.index(s[i]) + n) % len(alphabet)
    ans += alphabet[num]
    
print(ans)

### FIXED CODE ###

n = int(input())
 
s = input()
 
alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
 
ans = ""
for i in range(len(s)):
    num = (alphabet.index(s[i]) + n) % len(alphabet)
    ans += alphabet[num]
    
print(ans)
n=input()
l=list(map(int,input().split()))
col=[False for i in range(8)]
val=0
count=0
for i in range(n):
  m=l[i]
  if m<400:
    col[0]=True
  elif m<800:
    col[1]=True
  elif m<1200:
    col[2]=True
  elif m<1600:
    col[3]=True
  elif m<2000:
    col[4]=True
  elif m<2400:
    col[5]=True
  elif m<2800:
    col[6]=True
  elif m<3200:
    col[7]=True
  else:
    val+=1
for i in range(8):
  if col[i]:
    count+=1
print(count,min(8,count+val))

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
col=[False for i in range(8)]
val=0
count=0
for i in range(n):
  m=l[i]
  if m<400:
    col[0]=True
  if 400<=m<800:
    col[1]=True
  if 800<=m<1200:
    col[2]=True
  if 1200<=m<1600:
    col[3]=True
  if 1600<=m<2000:
    col[4]=True
  if 2000<=m<2400:
    col[5]=True
  if 2400<=m<2800:
    col[6]=True
  if 2800<=m<3200:
    col[7]=True
  if m>=3200:
    val+=1
for i in range(8):
  if col[i]:
    count+=1
print(max(1,count),count+val)
def knapsack1(weight_value, w):
    cur = [0] * (w + 1)
    nxt = cur.copy()

    for weight, value in weight_value:
        for i in range(1, weight):
            nxt[i] = cur[i]
        for i in range(weight, w + 1):
            nxt[i] = max(cur[i], cur[i - weight] + value)
        cur, nxt = nxt, cur
    return cur[w]


def main():
    n, w = [int(x) for x in input().split()]
    weight_value = [None] * n
    for i in range(n):
        weight_value[i] = [int(x) for x in input().split()]
    return knapsack1(weight_value, w)


print(main())


### FIXED CODE ###

def knapsack1(weight_value, w):
    cur = [0] * (w + 1)
    nxt = [0] * (w + 1)

    for weight, value in weight_value:
        for i in range(1, weight):
            nxt[i] = cur[i]
        for i in range(weight, w + 1):
            nxt[i] = max(cur[i], cur[i - weight] + value)
        cur, nxt = nxt, cur
    return cur[w]


def main():
    n, w = [int(x) for x in input().split()]
    weight_value = [None] * n
    for i in range(n):
        weight_value[i] = [int(x) for x in input().split()]
    return knapsack1(weight_value, w)


print(main())
N, M = map(int, input().split())
K=N*M
if N==1orM==1:
  print(1)
elif K%2==1:
  print(K//2+1)
else:
  print(K//2)

### FIXED CODE ###

N, M = map(int, input().split())
K=N*M
if N==1 or M==1:
  print(1)
elif K%2==1:
  print(K//2+1)
else:
  print(K//2)
sys.setrecursionlimit(2000000)
t=input()
x=0
tl=list(t)
while x != -1:
    x=t.find("?")
    if tl[x+1]=="D":
        tl[x]="P"
    elif tl[x+1]=="?":
        tl[x]="P"
    else:
        tl[x]="D"
    t="".join(tl)
    x=t.find("?")
print(t)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
t=input()
tl=list(t)
tln=len(t)
x=0
for x in range(tln):
    if tl[x] == "?":
        if x == tln-1:
            tl[x]="D"
            break
        elif x==0:
            if tl[x+1]=="?":
                tl[x]="P"
                tl[x+1]="D"
            else:
                tl[x]="D"
        elif tl[x-1]=="P":
            tl[x]="D"
        elif tl[x+1]=="?":
            tl[x]="P"
            tl[x+1]="D"
        elif tl[x+1]=="D":
            tl[x]="P"
        else:
            tl[x]="D"
t="".join(tl)
print(t)
mylist = []
x = 0
while x <= 1:
  val = input()
  x = x + 1
  if val:
    mylist.append(val)
  else:
    break
 


a = mylist[0].split( )
A = int(a[0])
B = int(a[1])
C = int(a[2])
K = int(mylist[1])
r = A
g = B 
b = C



for k in range(K):
    if r > b and r > g:
        if r > b:
            b = b * 2
        elif r > g:
            g = g * 2
        elif g > b:
            b = b * 2
    elif g > r:
        g = g * 2
    elif b == g or b == r:
        b = b * 2
    elif b > g and g == r:
        g = g * 2


if b > g and g > r:
    print("yes")
else:
    print("no")    


### FIXED CODE ###

import sys

x = input()
y = int(x)


a = 400
b = 0
kyu = 8

while(1):
    
    if a + b <= y <= a + b + 199:
        print(str(kyu))
        break
    
    b = b + 200
    kyu = kyu - 1
a = list(map(int,input().split()))
max_a = -10**30
import itertools
for i in itertools.combinations(a,2) :
    #print(i[0]*i[1])
    if( i[0]*i[1] > max_a):
        max_a = i[0]*i[i]

print(max_a)


### FIXED CODE ###

a = list(map(int,input().split()))
a_1,a_2 = [],[]
a_1.append(a[0])
a_1.append(a[1])
a_2.append(a[2])
a_2.append(a[3])

#print(a_1,a_2)
max_a = -(10**30)
for i in a_1:
    for l in a_2:
        if(i*l > max_a):
            max_a = i*l

print(max_a)
S = input()
T = input()

sl = len(S)
tl = len(T)

for i in range(sl-tl+1):
    s = S[i:i+tl]
    flag = True
    for j in range(tl):
        if s[j] == '?':
            continue
        elif s[j] == T[j] and s[j] != '?':
            continue
            
        flag = False
        break
            
    if flag == True:
        ans = S[:i] + T + s[i+tl:]
        break
        
if flag == False:
    print('UNRESTORABLE')
else:
    print(ans.replace('?','a'))

### FIXED CODE ###

S = input()
T = input()
S2 = S.replace('?','a')
ans = []

for i in range(len(S)-len(T)+1):
    S_sub = S[i:i+len(T)]
    
    check = True
    
    for s,t in zip(S_sub,T):
        if s != t and s == '?':
            continue
        elif s == t:
            continue
        elif s != t and s != '?':
            check = False
            break
        
    if check == True:
        tmp = S2[:i] + T + S2[i+len(T):]
        ans.append(tmp)
        
if len(ans) != 0:
    answer = sorted(ans)[0]
else:
    answer = 'UNRESTORABLE'
    
print(answer)
n = int(input())
as = list(map(int,input().split()))

ans = 1

for i in as:
    ans *= i
    ans = min(ans, 10**18+1)

if ans == 10**18+1:
    print(-1)

print(ans)


### FIXED CODE ###

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

ans = 1

for i in As:
    ans *= i
    ans = min(ans, 10**18 + 1)

if ans == 10**18 + 1:
    print(-1)

else:
    print(ans)
import decimal
def main():
    L = int(input())
    decimal.getcontext().prec = 6
    print('{:.020f}'.format(decimal.Decimal(L*L*L/27)))

main()


### FIXED CODE ###

def main():
    L = int(input())
    ans = '{:.010f}'.format(L*L*L/27)
    print(ans)

main()
import sys

sys.setrecursionlimit(10000000)
N,K = [int(v) for v in input().split()]
A = [int(v) for v in input().split()]
print(N,K)


loop = []

def dfs(now):
    loop.append(now)
    if A[now-1] == 1:
        return
    else:
        dfs(A[now-1])
dfs(1)

print(loop[K%len(loop)])


### FIXED CODE ###

import sys

sys.setrecursionlimit(10000000)
N,K = [int(v) for v in input().split()]
A = [int(v) for v in input().split()]

loop = []
pre = []
visited = set()

def dfs(index,now):
    global pre
    global loop
    loop.append(now)
    if now in visited:
        for left in range(len(loop)):
            if now == loop[left]:
                break
        pre = loop[:left]
        loop = loop[left:index]
        return
    else:
        visited.add(now)
        dfs(index+1,A[now-1])
dfs(0,1)

if len(pre) > K:
    print(pre[K])
else:
    K-=len(pre)
    print(loop[K%len(loop)])
H,W = map(int,input().split())
e = [[input() for i in range(W)]for c in range(H)]
a = []
b = []
for i in range(W):
  for c in range(H):
    if c =="#":
      a.append(int(c+i))
for x in range(a):
  for y in range(H*W):
    b.append(abs(a[x]-y))
print(max(b))

### FIXED CODE ###

from collections import deque
h,w=map(int,input().split())
ans=0
field=[["*" for i in range(w+2)]]+[["*"]+list(input())+["*"] for i in range(h)]+[["*" for i in range(w+2)]]
queue=deque([])
for H in range(h+2):
    for W in range(w+2):
        if field[H][W]=="#":
            queue.append((H,W))
            field[H][W]=0
        elif field[H][W]==".":
          field[H][W]=-1
move=[(0,1),(0,-1),(1,0),(-1,0)]
ans=0
while queue:
    pos=queue.popleft()
    for i in move:
      if field[pos[0]+i[0]][pos[1]+i[1]]!=-1:continue
      if field[pos[0]+i[0]][pos[1]+i[1]]=="*":continue
      field[pos[0]+i[0]][pos[1]+i[1]]=field[pos[0]][pos[1]]+1
      queue.append((pos[0]+i[0],pos[1]+i[1]))
      if ans < field[pos[0]+i[0]][pos[1]+i[1]]:ans=field[pos[0]+i[0]][pos[1]+i[1]]
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""

# -*- coding: utf-8 -*-
"""
Created on Sat Apr 13 09:53:12 2019

@author: Owner
"""

from operator import itemgetter
import itertools
import bisect

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

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

BC = [(0, 0)]*M
for m in range(M):
    BC[m] = tuple(map(int, input().split()))
BC.sort(key=itemgetter(1), reverse = True)

def main(): 
    #print(BC)
    res = 0
    num = 0
    for i in range(M):
        idx = 0         
        idx = bisect.bisect_left(A, BC[i][1])
        if idx == 0:
            break
        else:
            less =min(idx, BC[i][0]) 
            num+=less
            res += BC[i][1]*less

    print(res+sum(A[num：]))
                
                
                
            
            
                

    
if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 20:47:47 2019
 
@author: Owner
"""
 
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 13 09:53:12 2019
 
@author: Owner
"""
 
from operator import itemgetter
import itertools
import collections
import bisect
 
N, M = list(map(int, input().split()))
 
A = list(map(int, input().split()))
A.sort()

A = collections.deque(A)

BC = [(0, 0)]*M
for m in range(M):
    BC[m] = tuple(map(int, input().split()))
BC.sort(key=itemgetter(1), reverse = True)
 
def main(): 
    #print(BC)
    res = 0
    for i in range(M):
        idx = 0         
        idx = bisect.bisect_left(A, BC[i][1])
        if idx == 0:
            break
        else:
            less =min(idx, BC[i][0])
            for n in range(less):
                A.popleft()
            res += BC[i][1]*less
 
    print(res+sum(A))
                
                
                
            
            
                
 
    
if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
import math

A,B = map(int, input().split())
print(math.ceil((B-1)/(A-1)))


### FIXED CODE ###

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

N_cnt = int(input().strip())
H_ary = list(map(int, input().strip().split()))

step_cnt = 0
most_step = 0
for i in range(1,N_cnt):
    if H_ary[i] <= H_ary[i-1]:
        step_cnt += 1
        if most_step < step_cnt:
            most_step = step_cnt
    else:
        step_cnt = 0

print(most_step)
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
countAlice = 0
countBob = 0
for i in range(n):
    if i%2 == 0:
        countAlice += a[i]
    else:
        countBob += a[i]
print(coutAlice-countBob)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
countAlice = 0
countBob = 0
for i in range(n):
    if i%2 == 0:
        countAlice += a[i]
    else:
        countBob += a[i]
print(countAlice-countBob)
a=int(input())
if a<10:
  print("ABC00"+str(a))
elif 10<=a<100:
  print("ABC0"+str(a))
elif 100<=a<1000:
  print("ABC"+str(a))
elif: 1000<=a<1010:
  print("ABD00"+str(a))
elif: 1010<=a<1100:
  print("ABD0"+str(a))
else:
  print("ABD"+str(a))

### FIXED CODE ###

a=int(input())
if a<1000:
  print("ABC")
else:
  print("ABD")
import math
import functools
import fractions
from functools import reduce
import itertools
gcd3 = 0
gcd4 = 0
ans = 0
N = int(input())
values = ([int(x) for x in input().split()])

divided_values = [values[i::2] for i in range(2)]

values1 = divided_values[0].copy()
values2 = divided_values[1].copy()
gcd1 = functools.reduce(fractions.gcd,values1)
gcd2 = functools.reduce(fractions.gcd,values2)

for i in range(len(values1)):
  tem = values1.pop(i)
  gcd3 = fractions.gcd(gcd2,functools.reduce(fractions.gcd,values1))
  values1.insert(i,tem)
  if gcd3>gcd4:
    gcd4 = gcd3
    ans = gcd3

if len(values2)>1:
  for i in range(len(values2)):
    tem = values2.pop(i)
    gcd3 = fractions.gcd(gcd1,functools.reduce(fractions.gcd,values2))
    values2.insert(i,tem)
    if gcd3>gcd4:
      gcd4 = gcd3
      ans = gcd3
    
print(ans)

### FIXED CODE ###

import fractions
N = int(input())
values = ([int(x) for x in input().split()])

gcd_from_the_left = []
gcd_from_the_left.append(values[0])
for i in range(N):
	gcd_from_the_left.append(fractions.gcd(gcd_from_the_left[i],values[i]))
gcd_from_the_left.pop(0)

gcd_from_the_right = []
gcd_from_the_right.append(values[-1])
for i in range(N):
	gcd_from_the_right.append(fractions.gcd(gcd_from_the_right[i],values[-i-1]))

gcd_from_the_right.pop(0)

ans = 0
gcd = 0

for i in range(N-2):
  gcd = fractions.gcd(gcd_from_the_left[i],gcd_from_the_right[N-i-3])
  if gcd > ans:
    ans = gcd
    
gcd = gcd_from_the_left[-2]
if gcd > ans:
  ans = gcd
gcd = gcd_from_the_right[-2]
if gcd > ans:
  ans = gcd
print(ans)
N = input(int(N))
B = list(map(int, input().split()))
sum = B[0]

for i in range(1,N-1):
  sum += max(B[i-1], B[i])
print(sum)


### FIXED CODE ###

N = int(input())
B = list(map(int, input().split()))
sum = 0
 
for i in range(1,N-1):
  sum += min(B[i], B[i-1])
print(sum + B[N-2] + B[0])
# coding: utf-8

# In[1]:

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


# In[3]:

import numpy as np


# In[9]:

a = np.arange(1, N//2)
nN = np.ones(N//2-1)*N
print(np.sum((nN/a-1)[(nN/a-1)%1==0]))


# In[ ]:





### FIXED CODE ###


# coding: utf-8

# In[10]:

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


# In[13]:

sum_ = 0
#print(math.sqrt(N))
#print(int(math.sqrt(N)))
#print(int(N**0.5))
rn = N**0.5
if rn%1 == 0:
    rn -= 1
for i in range(1, int(rn)+1):
    if N%i == 0 and i < N//i-1:
        #print(i)
        #print(N/i-1)
        sum_ += N/i-1
print(int(sum_))


# In[ ]:
lw=input()
if lw='ABC':
    print('ARC')
else:
    print('ABC')

### FIXED CODE ###

lw=input()
if lw=='ABC':
    print('ARC')
else:
    print('ABC')