Harryxun/stf_run huggingface dataset:
def weight(n, p, c):
    global count
    global m
    
    if n % c[0] == 0:
        count = min(count, p + n // c[0])
        return count
    elif p + n // c[0] >= count:
        return n
    elif c[0] < n:
        return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
    else:
        return weight(n, p, c[1:])

N, W = map(int, input().split())
lisv = []
lisw = []

for i in range(N):
    v, w = map(int, input().split())
    lisv.append(v)
    lisw.append(w)

for j in range(N):
    pass

count = N
print(weight(N, 0, lisw))

#print(coin(n, 0, mon))
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


### FIXED CODE ###

N,W=map(int,input().split())
dp=[[0 for i in range(W+1)]for j in range(N+1)]
goods=[]
for i in range(N):
    v,w=map(int,input().split())
    goods.append([v,w])

    
for i in range(N):
    v=goods[i][0]
    w=goods[i][1]
    for j in range(W+1):
        dp[i+1][j]=max(dp[i][j],dp[i+1][j])
        next_w=j+w
        next_v=dp[i][j]+v
        if(next_w<=W and next_v>dp[i+1][next_w]):
            dp[i+1][next_w]=next_v

ans=0
for i in range(W+1):
    ans=max(ans,dp[N][i])
print(ans)
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i, n):
        if all('ACGT'.count(c) == 1 for c in s[i + j +1]):
            ans = max(ans, j-i+1)
print(ans)


### FIXED CODE ###

s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i, n):
        if all('ACGT'.count(c) == 1 for c in s[i : j + 1]):
            ans = max(ans, j-i+1)
print(ans)
R = input()
if R < 1200:
    print("ABC")
elif 1200 <= R < 2800:
    print("ARC")
else print("AGC")

### FIXED CODE ###

R = int(input())
if R < 1200:
    print("ABC")
elif 1200 <= R < 2800:
    print("ARC")
else :
    print("AGC")
A, B, C = map(int, raw_input().split())

if C == 0 and (B % A) == 0 or \
        (C % A) == 0 and (B % A) == 0 or \
        (C % A) % (B % A) == 0:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

import sys

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

for i in range(1, 101):
    if C == 0 and (B * i % A) == 0 or \
            (C % A) == 0 and (B * i % A) == 0 or \
            (B * i % A) != 0 and (C % A) % (B * i % A) == 0:
        print('YES')
        sys.exit()

print('NO')
N=int(input())
ac=0
wa=0
tle=0
re=0
for _ in range(N):
  s=input()
  if 'AC'==s:
     ac+=1
  elif 'WA'==s:
    wa+=1
  elif 'TLE'==s:
    tle+=1
  elif 'RE'==s:
    re+=1
print('AC',×,ac)
print('WA',x,wa)
print('TLE',x,tle)
print('RE',x,re)
    
  

### FIXED CODE ###

N=int(input())
ac=0
wa=0
tle=0
re=0
for _ in range(N):
  s=input()
  if 'AC'==s:
     ac+=1
  elif 'WA'==s:
    wa+=1
  elif 'TLE'==s:
    tle+=1
  elif 'RE'==s:
    re+=1
print('AC','x',ac)
print('WA','x',wa)
print('TLE','x',tle)
print('RE','x',re)
N = int(input())

answer = 0
big = 0

for i in range(N):
	a = int(input())
	answer += a
	if big < a:
		big = a

print(int(answer-(big/2))

### FIXED CODE ###

N = int(input())

answer = 0
big = 0

for i in range(N):
	a = int(input())
	answer += a
	if big < a:
		big = a

print(int(answer-(big/2)))
c = a * b
if c%2 == 0:
    print(even)
else:
    print(odd)

### FIXED CODE ###

a, b = map(int, input().split())
c=a*b
if (c) % 2:
    print("Odd")
else:
    print("Even")
N,M,V,P = map(int, input().split())
As = list(map(int, input().split()))
As.sort(reverse=True)
# print(As)
"""
M人がV問のスコアを1挙げられる
N問のうち降順に並べたP問が採用される

6 1 2 2
2 1 1 3 0 2
方針
最小の数(-1)にVを足す
上からP-1番目までの数にMを足す
P番目の数がVを超えているかどうか判定
最小の数からindex-1
"""


x = N - (P-1)
y = max(0, V - P - 1) #除外対象
# print(P-1,y)
if y == 0:
    As = As[P-1:]
else:
    As = As[P-1:-y]
# 同じは弾く
As = [a for a in As if a > As[y]]
# print(As)
mx = max(As)
cnt = 0
for a in As:
    if a + M >= mx:cnt+=1
print(P-1+cnt)

### FIXED CODE ###

n,m,v,p = map(int, input().split())
As = list(map(int, input().split()))
As.sort(reverse=True)
# print(As)
def f(x):
    # 判定基準
    if x < p:
        return True
    if As[x]+m < As[p-1]:
        return False
    cnt0 = (n-x)*m
    cnt1 = (p-1)*m
    cnt2 = 0
    for i in range(p-1, x):
        cnt2 += As[x]+m-As[i]
    return cnt0 + cnt1 + cnt2 >= m*v    


# 二部探索でOK/NG求める
ok = 0
ng = n
while ng - ok > 1:
    mid = (ok+ng)//2
    if f(mid):
        ok = mid
    else:
        ng = mid
print(ok+1)
import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(1000000)
from collections import *
from bisect import *
from copy import deepcopy
mod = 10**9+7

N, K = map(int, input().split())
T = [0 if x == 'L' else 1 for x in input()]
f = 0
cnt = 0
for i in range(N-1):
    if T[i] != T[i+1]:
        cnt += 1
if cnt < 2:
    f = 1
S = deepcopy(T)
l, r, k = 0, N-1, 0
while l < N and S[l] == 1:
    l += 1
while l < N-1 and S[l+1] == 0:
    l += 1
while 0 <= r and S[r] == 1:
    r -= 1
while 0 < r and S[r-1] == 0:
    r -= 1
while l < r and k < K:
    k += 1
    for i in range(l+1, r):
        S[i] ^= 1
    while l < r and S[l] == S[l+1]:
        l += 1
    while l < r and S[r-1] == S[r]:
        r -= 1
ans1 = 0
i = 0
while i < N-1:
    c = 0
    while i < N-1:
        if S[i] == S[i+1]:
            i += 1
            c += 1
        else:
            ans1 += c
            c = 0
            i += 1
ans1 += c

S = deepcopy(T)
l, r, k = 0, N-1, 0
while l < N and S[l] == 0:
    l += 1
while l < N-1 and S[l+1] == 1:
    l += 1
while 0 <= r and S[r] == 0:
    r -= 1
while 0 < r and S[r-1] == 1:
    r -= 1
while l < r and k < K:
    k += 1
    for i in range(l+1, r):
        S[i] ^= 1
    while l < r and S[l] == S[l+1]:
        l += 1
    while l < r and S[r-1] == S[r]:
        r -= 1
ans2 = 0
i = 0
while i < N-1:
    c = 0
    while i < N-1:
        if S[i] == S[i+1]:
            i += 1
            c += 1
        else:
            ans2 += c
            c = 0
            i += 1
ans2 += c
print(max(ans1, ans2, f*N-1))


### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
sys.setrecursionlimit(1000000)
from collections import *
from bisect import *
from copy import deepcopy
mod = 10**9+7

N, K = map(int, input().split())
T = [0 if x == 'L' else 1 for x in input()]
f = 0
cnt = 1
for i in range(N-1):
    if T[i] != T[i+1]:
        cnt += 1
if cnt//2 <= K:
    f = 1
ans1 = ans2 = N-cnt
# print(ans1, ans2, cnt)
S = [x for x in T]
l, r, k = 0, N-1, 0
while l < N and S[l] == 1:
    l += 1
# ans1 += l
while l < N-1 and S[l+1] == 0:
    l += 1
while 0 <= r and S[r] == 1:
    r -= 1
# ans1 += N-r-2
while 0 < r and S[r-1] == 0:
    r -= 1
# print(ans1)
while l < r and k < K:
    k += 1
    ans1 += 2
    l += 1
    r -= 1
    while l < r and S[l] == S[l+1]:
        l += 1
    while l < r and S[r-1] == S[r]:
        r -= 1

S = [x for x in T]
l, r, k = 0, N-1, 0
while l < N and S[l] == 0:
    l += 1
# ans2 += l
while l < N-1 and S[l+1] == 1:
    l += 1
while 0 <= r and S[r] == 0:
    r -= 1
# ans2 += N-r-2
while 0 < r and S[r-1] == 1:
    r -= 1
while l < r and k < K:
    k += 1
    ans2 += 2
    l += 1
    r -= 1
    while l < r and S[l] == S[l+1]:
        l += 1
    while l < r and S[r-1] == S[r]:
        r -= 1
print(max(ans1, ans2, f*N-1))
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]

ab.sort(key=lambda x: x[0])

count = 0
money = 0
while True:
    count += ab[0][1]
    if count <= m:
        money += ab[0][0] * ab[0][1]
        del ab[0]
    else:
        money += ab[0][0] * (m - count + ab[0][1])
        break

print(money)

### FIXED CODE ###

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]

ab.sort(key=lambda x: x[0])

count = 0
money = 0
while True:
    count += ab[0][1]
    if count < m:
        money += ab[0][0] * ab[0][1]
        del ab[0]
    else:
        money += ab[0][0] * (m - count + ab[0][1])
        break

print(money)
def insertionSort(a,g):
    global cnt
    for i in range(g,len(a)):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt+=1
            a[j+g] = v


def shellSort(a):
    global cnt
    cnt = 0
    g = []
    h = 1
    while h <= len(a):
        g.append(h)
        h = 3*h+1
    g.reverse()
    m = len(g)
    print(m)
    print(' '.join(map(str,g)))
    for i in range(m):
        insertionSort(a,g[i])


a=[int(raw_input()) for i in range(int(raw_input()))]
shellSort(a)
print(cnt)
for e in a: print(e)

### FIXED CODE ###

import math


def insertionsort(a, n, g):
    cnt = 0
    for i in range(g, n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j + g] = a[j]
            j = j - g
            cnt += 1
        a[j + g] = v
    return cnt


def shellsort(a, n):
    g = []
    gap = 1
    while gap <= math.ceil(n / 3):
        g.append(gap)
        gap = 3 * gap + 1
    g = g[::-1]
    m = len(g)
    print(m)
    print(*g)
    cnt = 0
    for i in range(m):
        cnt += insertionsort(a, n, g[i])
    print(cnt)

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
shellsort(a, n)
print("\n".join(map(str, a)))
while(1):
  count = int(raw_input())
  if count == 0: break
  previous_cube = [1, 2, 3, 4, 5, 6]
  operation = {'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]}
  sum = 1
  for i in xrange(count):
    new_cube = []
    for e in xrange(6):
      new_cube.append(previous_cube[operation[str(raw_input())][e]])
    sum += new_cube[0]
    previous_cube = new_cube
  print sum

### FIXED CODE ###

while 1:
  n = input()
  if n == 0:  break
  d = range(1, 7)
  ans = 1
  for i in range(n):
    c = raw_input()[0]
    if c == 'N': S = [1,5,2,3,0,4]
    elif c == "S": S = [4,0,2,3,5,1]
    elif c == "E": S = [3,1,0,5,4,2]
    elif c == "W": S = [2,1,5,0,4,3]
    elif c == "R": S = [0,2,4,1,3,5]
    elif c == "L": S = [0,3,1,4,2,5]
    d = [d[s] for s in S]
    ans += d[0]
  print ans
import itertools as it
n = int(input())
t = []
ans = [0]*10**4
def calc(x, y, z):
    return x**2+y**2+z**2 + x*y + y*z + z*x

for x in range(1, 10**2):
    for y in range(1, 10**2):
        for z in range(1, 10**2):
            t.append(calc(x,y,z))

for i in t:
    if i < 10**4:
        ans[i] += 1
for i in range(1,n+1):
    print(ans[i])

### FIXED CODE ###

n = int(input())
t = []
ans = [0]*(10**4+5)
def calc(x, y, z):
    return x**2+y**2+z**2 + x*y + y*z + z*x

for x in range(1, 10**2):
    for y in range(1, 10**2):
        for z in range(1, 10**2):
            t.append(calc(x,y,z))

for i in t:
    if i < 10**4+5:
        ans[i] += 1
for i in range(1,n+1):
    print(ans[i])
n,k=map(int,input().split())
l=[int(input())for i in range(n)]
l.sort(reverse=1)
print(sum(l[:k]))

### FIXED CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=1)
print(sum(l[:k]))
def solve():
    l = list(map(int,input().split()))
    for i in range(5):
        if(l[i]==0){
            print(i+1)
        }
if __name__=='__main__':
    solve()

### FIXED CODE ###

def solve():
    l = list(map(int,input().split()))
    for i in range(5):
        if(l[i]==0):
            print(i+1)
if __name__=='__main__':
    solve()
s = input()
q = int(input())
for i in range(0, q):
    query = input()
    if query[0] == '1':
        s = s[::-1]
    else:
        if query[2] == '1':
            # 先頭
            s = ''.join([query[4],s])
        else:
            # 末尾
            s = ''.join([s,query[4]])
print(s)

### FIXED CODE ###

s = input()
if (s=='AAA')|(s=='BBB'):
    print('No')
else:
    print('Yes')
import sys
for a in sys.stdin:
 if'0'==a:break
 s=list(map(int,input().split()))
 c=0
 while 1:
  t=s;s=[t.count(e)for e in t]
  if t==s:break
  c+=1
 print(c);print(*s)


### FIXED CODE ###

while 1:
 a,b,_=sorted(map(int,input().split()))
 if a==0:break
 for _ in[0]*int(input()):print("OK"if(int(input())*2)**2>a*a+b*b else"NA")
a,b,k=[int(i) for i in input().split()]
c=list(range(a,b+1))

head=c[:k]
# tail=c[::-1][:k]
# d=head+tail
# e=list(set(d))
# e.sort()
# for i in e:
#     print(i)

### FIXED CODE ###

a,b,k=[int(i) for i in input().split()]

if b-a+1>=2*k:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)
X = int(input())
c = 0
for i in range(100):
    for j in range(100):
        if i**5-j**5==X:
            a = i
            b = j
            c += 1
            break
    if c ==0:
        for j in range(100):
            if i**5+j**5==X:
            a = i
            b = j
            break
print(a,b)         

### FIXED CODE ###

X = int(input())
c = 0
for i in range(-200,200):
    for j in range(-200,200):
        if i**5-j**5==X:
            a = i
            b = j
            print(a, b)    
            c = 1
            break
    if c != 0:
        break
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    N,M,X = map(int, input().split())
    ca = []
    res = sys.maxsize
    for _ in range(N):
        ca.append(list(map(int, input().split())))
    for i in range(2 ** N):
        tmp = [0]*M
        tmpres = 0
        for j in range(N):
            if ((i >> j) & 1):
                tca = ca[M-1-j]
                tmpres += tca[0]
                for k in range(M):
                    tmp[k] += tca[1+k]
        tassei = True
        for a in tmp:
            if a < X:
                tassei = False
                break
        if tassei:
            res = min(res,tmpres)
    if res != sys.maxsize:
        print(res)
    else:
        print(-1)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    N,M,X = map(int, input().split())
    ca = []
    res = sys.maxsize
    for _ in range(N):
        ca.append(list(map(int, input().split())))
    for i in range(2 ** N):
        tmp = [0]*M
        tmpres = 0
        for j in range(N):
            if ((i >> j) & 1):
                tca = ca[N-1-j]
                tmpres += tca[0]
                for k in range(M):
                    tmp[k] += tca[1+k]
        tassei = True
        for a in tmp:
            if a < X:
                tassei = False
                break
        if tassei:
            res = min(res,tmpres)
    if res != sys.maxsize:
        print(res)
    else:
        print(-1)


if __name__ == '__main__':
    main()
from fractions import gcd
P = 10**9 + 7
N = 100001 #使う最大値+1以上にする、値に注意3*10^5とかにしとくと安心
inv = [0] + [1] # 1/x
finv = [1] + [1] # 1/x!
fac = [1] + [1] # x!
for i in range(2,N):
  inv += [inv[P % i] * (P - int(P / i)) % P]
  fac += [(fac[i-1] * i) % P]
  finv += [(finv[i-1] * inv[i]) % P]
n=int(input())
a=list(map(int,input().split()))
lcm=a[0]
mod=10**9+7
for i in range(1,n):
  lcm=(lcm//gcd(lcm,a[i]))*(a[i]//gcd(lcm,a[i]))*gcd(lcm,a[i])
ans=0
for i in range(n):
  ans+=lcm*inv[a[i]]%mod
print(ans%mod)

### FIXED CODE ###

from fractions import gcd
P = 10**9 + 7
N = 1000001 #使う最大値+1以上にする、値に注意3*10^5とかにしとくと安心
inv = [0] + [1] # 1/x
for i in range(2,N):
  inv += [inv[P % i] * (P - int(P / i)) % P]
n=int(input())
a=list(map(int,input().split()))
lcm=a[0]
mod=10**9+7
for i in range(1,n):
  lcm=(lcm//gcd(lcm,a[i]))*a[i]
ans=0
lcm%=mod
for i in range(n):
  ans=(ans+lcm*inv[a[i]])%mod
print(ans%mod)
n,Y = map(int,input().split())
x = -1
y = -1
z = -1

for i in range(Y//10000 + 1):
    for j in range(n-i+1):
        if 9*i + 4*j == Y/1000 - n:
            x = i
            y = j
            z = n-i-j
print(x,y,z)

### FIXED CODE ###

print("2018"+input()[4:])
import sympy as sym

a,b = map(int, input().split())
if a > 9 or b > 9:
  print('-1')
else:
  print(a * b)


### FIXED CODE ###

# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)

import math
import statistics
import numpy as np
import queue

a,b = map(int, input().split())
if a > 9 or b > 9:
  print('-1')
else:
  print(a * b)
def run(S):
    s = 0
    f = len(S) - 1
    cnt = 0
    while s < f:
        while S[s] == 'W' or S[f] == 'B':
            if S[s] == 'W':
                s += 1
            elif S[f] == 'B':
                f -= 1
        for i in range(s, f):
            if S[i] == 'B' and S[i+1] == 'W':
                cnt += 1
                S = S[:i] + 'WB' + S[i+2:]
    return cnt


def main():
    S = input()
    print(run(S))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def run(S):
    '''
    Bをすべて右に、Wをすべて左に移動する回数を求める
    '''
    cnt = 0
    n = len(S)
    cnt_B = 0
    cnt_W = 0
    for i in range(len(S)):
        if S[i] == 'B':
            cnt_B += 1
            cnt += n - (i+cnt_B)
        else:
            cnt += i - cnt_W
            cnt_W += 1
    return int(cnt / 2)


def main():
    S = input()
    print(run(S))


if __name__ == '__main__':
    main()
import numpy as np
n = int(input())
x = [0] * n
u = ['string'] * n
for j in range(n):
    x[j], u[j] = input().split()
for j in range(n):
    if u[j] == 'JPY':
        x[j] = 1
    elif u[j] == 'BIT':
        x[j] = float(x[j]) * 38
print(np.sum(x) * 10000)

### FIXED CODE ###

import numpy as np
n = int(input())
x = [0] * n
u = ['string'] * n
for j in range(n):
    x[j], u[j] = input().split()
for j in range(n):
    if u[j] == 'JPY':
        x[j] = int(x[j])
    elif u[j] == 'BTC':
        x[j] = float(x[j]) * 380000
print(np.sum(x))
n = int(input().strip())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))

sales = [v - c for v, c in zip(values, costs) if v > c else 0]

print(sum(sales))

### FIXED CODE ###

# coding: utf-8

from itertools import combinations, chain

N = int(input())
values = map(int, input().split())
costs = map(int, input().split())

sales = [v - c for v, c in zip(values, costs)]

print(max(chain.from_iterable(map(sum, combinations(sales, i)) for i in range(0, N+1))))
a = input()
s = input()

print s if a > 3200 else 'red'

### FIXED CODE ###

a = input()
s = input()

print(s if int(a) >= 3200 else 'red')
# -*- coding: utf-8 -*-
n = int(input())

if n < 1000:
    print(ABC)
else:
    print(ABD)

### FIXED CODE ###

# -*- coding: utf-8 -*-
n = int(input())

if n < 1000:
    print('ABC')
else:
    print('ABD')
N, K = map(int, input().split())
def calc_ans(ans):
    x = 0
    tmp = 0
    for i in range(K):
      tmp += ans[i][0]
      x += ans[i][1]
    return tmp + (x * x)

L = [list(map(int, input().split())) for i in range(N)]
L.sort(key=lambda x:x[1], reverse=True)
ans = []
etc = []
dic = {}
ind = {}
for l in L:
    if dic.get(l[0]):
        dic[l[0]].append(l[1])
    else:
        dic[l[0]] = [l[1]]
    if len(dic.keys()) > K:
        break
for t in dic.keys():
    dic[t].sort(reverse=True)
    for i,n in enumerate(dic[t]):
      if i == 0:
          ans.append((n, 1))
      else:
          etc.append((n, 0))
ans_all = calc_ans(ans)
ans.sort(reverse=True)
etc.sort(reverse=True)
for n in etc:
    if ans[-1][1] == 0 and ans[-1][0] >= n[0]:
        break
    ans[-1] = n
    tmp = calc_ans(ans)
    if ans_all < tmp:
        ans_all = tmp
    ans.sort(reverse=True)
print(ans_all)

### FIXED CODE ###

N,K = map(int,input().split())
td = [[int(i) for i in input().split()] for _ in range(N)]
td.sort(key=lambda x:x[1],reverse=True)
ans = 0
ls = set()
dl = []
for i in range(K):
    ans += td[i][1]
    if not td[i][0] in ls:
        ls.add(td[i][0])
    else:
        dl.append(td[i][1])
ans = ans + len(ls)**2
res = ans
for i in range(K,N):
    if not dl:
        break
    if td[i][0] in ls:
        continue
    ans += len(ls)*2+1
    ans += td[i][1]
    ans -= dl[-1]
    del dl[-1]
    res = max(res,ans)
    ls.add(td[i][0])
print(res)
#!usr/bin/env python3

import sys
from math import pi


def area_of_circle(radius):
    return pi * radius**2


def circumference_of_circle(radius):
    return 2*pi*radius


def main():
    r = (sys.stdin.readline())
    print('%f %f' % (area_of_circle(r), circumference_of_circle(r)))


if __name__ == '__main__':
    main()

### FIXED CODE ###

#!usr/bin/env python3

import sys
from math import pi


def area_of_circle(radius):
    return pi * radius**2


def circumference_of_circle(radius):
    return 2*pi*radius


def main():
    # NOTE Tried sys.stdin.readline() instead of input()
    r = float(sys.stdin.readline())
    print('%f %f' % (area_of_circle(r), circumference_of_circle(r)))


if __name__ == '__main__':
    main()
x1=int(input())
x2=int(input())
x3=int(input())
x4=int(input())
x5=int(input())
if x1==0:
    print('x1')
if x2==0:
    print('x2')
if x3==0:
    print('x3')
if x4==0:
    print('x4')
if x5==0:
    print('x5')


### FIXED CODE ###

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

if A == 0:
    print(1)
if B == 0:
    print(2)
if C == 0:
    print(3)
if D == 0:
    print(4)
if E == 0:
    print(5)
a,b,C=map(float,raw_input().split())
rad=math.radians(C)
c=(a**2+b**2-2*a*b*math.cos(rad))**0.5
h=b*math.sin(rad)
print h*a/2
print a+b+c
print h

### FIXED CODE ###

import math

(n,m,o) = map(float, raw_input().split())
#s=(n+m+o)/2.0
c=math.radians(o)
cs=math.sqrt(n**2+m**2-2*n*m*math.cos(c))
h=m*math.sin(c)
#ans=(s*(s-m)*(s-n)*(s-o))**0.5
#print ((n-o)**2 + (m-p)**2)**0.5
#print ans
S=h*n/2
L=n+m+cs
print S
print L
print h
N = input()
if N >1000:
    print("ABC")
else:
    print("ABD")

### FIXED CODE ###

N = int(input())
if N <= 999:
    print("ABC")
else:
    print("ABD")