peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N = input_number()
    print("AABBCD"[N > 999::2])


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,m = map(int,input().split())
parts = n*2 + m
print(parts//4)
# Judge status: Accepted
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

x,y=mp()
ans=0
while x<=y:
    ans+=1
    x*=2
print(ans)
# Judge status: Wrong Answer
from fractions import gcd
from math import sqrt
A, B = map(int, input().split())
if (A == 1 or B == 1 or A == B):
    print(1)
    exit(0)

C = gcd(A, B)
ans = []
for i in range(2, C + 1):
    if (C % i == 0): ans.append(i)
    if (i >= C // i): break
N = len(ans)
seen = [0] * N
cnt = 0
for i in range(N):
    if(seen[i]): continue
    for j in range(i, N):
        if (ans[j] % ans[i] == 0):
            seen[j] = 1
    cnt += 1
print(cnt + 1)
# Judge status: Accepted
N, K = map(int, input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()

print(''.join(S))
# Judge status: Wrong Answer
def power_func(a,n,p):
    bi = str(format(n,"b"))
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res
N = int(input())
answer = power_func(10,N,pow(10,9) + 7) + power_func(8,N,pow(10,9) + 7) - 2 * power_func(9,N,pow(10,9) + 7)
print(answer)
# Judge status: Accepted
import collections
n = int(input())
l = map(int, input().split())
c = collections.Counter(l)
c = sorted(c.items(), key=lambda c:c[0], reverse=True)
 
ans = 1
cnt = 0
 
for key,val in c:
  if cnt==0 and val>=4:
    ans=key**2
    break
  if val>=2:
    ans*=key
    cnt+=1
  if cnt == 2:
    break
else:
  ans = 0
print(ans)
# Judge status: Wrong Answer
aa, bb, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = []
y = []
c = []
for i in range(m):
  x1, y1, c1 = list(map(int,input().split()))
  x.append(x1)
  y.append(y1)
  c.append(c1)

price = []
  
for i in range(m):
  price.append(a[x[i] - 1] + b[y[i] - 1] - c[i])
  
print(min(price))
# Judge status: Accepted
N = int(input())
S = input()
for s in S:
    print(chr((ord(s) - ord('A') + N) % 26 + ord('A')), end='')
# Judge status: Accepted
kx = input().split(" ")

k = int(kx[0])
x = int(kx[1])

if 500 * k >= x:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
D=int(input())
c=list(map(int,input().split()))
s=[]
t=[]
for i in range(D):
  s.append(list(map(int,input().split())))
l=[0]*26
# Judge status: Accepted
N=int(input())
c=list(map(int, input().split()))
ans=1
tmp=c[0]
for i in range(1,N):
  if c[i]<tmp:
    tmp=c[i]
    ans+=1
print(ans)
# Judge status: Accepted
n = int(input())
data = dict()
name = set()
for i in range(n):
    s, p = input().split()
    p = int(p)
    if s in data:
        data[s].append([p, i + 1])
    else:
        data[s] = []
        data[s].append([p, i + 1])
    name.add(s)
name = list(name)
name.sort()
for n in name:
    data[n].sort(reverse = True)
    for i in data[n]:
        print(i[1])
# Judge status: Accepted
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

oldp = min(a)+min(b)

for _ in range(M):
    x, y, cp = map(int,input().split())
    p = a[x-1]+b[y-1]-cp
    if oldp > p:
        oldp = p

print(oldp)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
if a+b*2>=c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a >= b:
  print(a-1)
else:
  print(a)
# Judge status: Accepted
n = int(input())
now, bef = 0, 0
ans = 0
for i in range(n):
  now = int(input())
  if now == 0 and bef == 1:
    bef = 0
  if (now+bef)%2 == 0:
    if bef == 0:
      ans += now//2
      bef = 0
    else:
      ans += (now+bef)//2
      bef = 0
  else:
    if bef == 0:
      ans += now//2
      bef = 1
    else:
      ans += (now+bef)//2
      bef = 1

print(ans)
# Judge status: Wrong Answer
N = int(input())
H = list(map(int, input().split()))
 
H.reverse()
ans = 0
val = 0
for i in range(N-1):
    if H[i] <= H[i+1]:
        val +=1
    else:
        ans = max(ans,val)
        val = 0
 
print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())

D = list(map(str, input().split()))

n = str(N)

rs = 0

for i in range(1, len(n) + 1):
    nn = n[-i]
    while True:
        if not nn in D:
            break
        else:
            nnn = int(nn)
            nnn += 1
            nn = str(nnn)

    rs += int(nn) * 10 ** (i-1)

print(rs)
# Judge status: Accepted
import heapq

I = input().split()
N = int(I[0])
M = int(I[1])
# N: 品物の数
# M: 割引券の数
# A: 品物の値段行列
A = list(map(int , input().split()))

A = list(map(lambda x: x*(-1), A))

heapq.heapify(A)
for i in range(M):
    M -= 1
    pri = heapq.heappop(A)

    pri *= -1
    pri //= 2
    pri *= -1

    heapq.heappush( A , pri )

Fi_pri = 0
for i in range(N):
    Fi_pri += A[i]

print( -1 * Fi_pri )
# Judge status: Accepted
X=int(input())

if X==2:
  print(2)
else:
  while 1:
    flag=0
    for i in range(2,X):
      if X%i==0:
        flag=1
        break

    if flag==0:
      break
    else:
      X=X+1
  print(X)
# Judge status: Accepted
s=int(input())

if s == 1 or s == 2 or s ==4 :
 print(4)

else:
 i = 2
 while s > 1:
  if s%2==0:
   s=s/2
  else:
   s=3*s+1
  i += 1
 print(i)
# Judge status: Accepted
N,A,B = list(map(int,input().split()))
if N==1 and A!=B:
    print(0)
    exit()
elif A>B:
    print(0)
    exit()

min = B+A*(N-1)
max = B*(N-1)+A
print(max-min+1)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
ans = 10 ** 10
for i in range(min(a), max(a) + 1):
    x = 0
    for n in a:
        x += (i - n) ** 2
    ans = min(ans, x)
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
n = len(list(filter(lambda x: x<0, A)))
A.sort(key=abs)
if n&1 == 0:
    print(sum(map(abs, A)))
else:
    print(sum(map(abs, A[1:]))-abs(A[0]))
# Judge status: Wrong Answer
N, M, K = map(int, input().split())
flag = False
area = 0
for i in range(M):
    area += N
    if area == K:
        flag = True
area = 0
for i in range(N):
    area += M
    if area == K:
        flag = True
for i in range(1, M):
    for j in range(1, N):
        area = i * j + (N - i) * (M - j)
        if area == K:
            flag = True

if flag:
    print('Yes')
else:
    print("No")
# Judge status: Accepted
n, m, *X = map(int, open(0).read().split())
X.sort()
if n >= m:
  print(0)
else:
  Y = [0] * m
  for i in range(m-1):
      Y[i] = X[i+1] - X[i]
  Y.sort()
  print(sum(Y[:m-n+1]))
# Judge status: Accepted
from math import log2

N,K = [int(i) for i in input().split()]
prob = 0
for i in range(1,N+1):
    j = 0
    while 2**(j) * i < K:
        j += 1
    prob += (1/N) * (0.5)**j
    # print((1/N) * (0.5)**j, j)
print(prob)
# Judge status: Accepted
L, R = map(int, input().split())
mod = 2019
ans = 10**9 + 7
for i in range(L, min(L + mod, R)):
  for j in range(i + 1, min(i + mod + 1, R + 1)):
    ans = min((i * j) % mod, ans)
print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
p=list(map(int,input().split()))

q=[]

for i in p:
  q+=[(i+1)/2]

ans=sum(q[:k])

for i in range(1,n-k+1):
  if q[i-1]<q[i-1+k]:
    ans=sum(q[i:i+k])
  
print(ans)
# Judge status: Wrong Answer
a = list(map(int,input().split()))
if(len(set(a)) == 1):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
a,b = map( int, input().split())
print( sum( [ i for i in range(1, b-a+1)]) - b)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

two = 0
four = 0
odd = 0

for a in A:
  if a % 4 == 0:
    four += 1
  elif a % 2 == 0:
    two += 1

N -= max(0, two - 1)

print("Yes" if four >= N // 2 else "No")
# Judge status: Accepted
from fractions import gcd

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

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

def main():
    N = ii()
    A = list(mi())
    ans = A[0]
    for i in range(N-1):
        ans = gcd(ans, A[i+1])
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')
# Judge status: Wrong Answer
a,b=map(int,input().split())
c=[1,3,5,7,8,10,2]
d=[4,6,9,11]
if a in c and b in c:
    print("Yes")
elif a in d and b in d:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a=list(map(int,input().split()))
s = sum(a)
s_tmp = 0
min_ = 10**18
for i in range(n-1):
  s_tmp += a[i]
  min_ = min(min_, abs(s_tmp-(s-s_tmp)))
print(min_)
# Judge status: Accepted
l,r,d = map(int, input().split())

print(r//d - (l-1)//d)
# Judge status: Wrong Answer
N=int(input())
lis=list(map(int,input().split()))
lis.sort()
print(sum(lis[::-1][:-1]))
# Judge status: Wrong Answer
n,m = map(int,input().split())
#a,b = map(int,input().split())

dic = {}

for _ in range(m):
    a,b = map(int,input().split())

    try:
        dic[a] += 1
    except:
        dic[a] = 1

    try:
        dic[b] += 1
    except:
        dic[b] = 1

dic = sorted(dic.items(),key=lambda x:x[0])

for i in dic:
    print(i[1])
# Judge status: Accepted
N = int(input())
al=[chr(ord('a') + i) for i in range(26)]
out = [1000]*26
for i in range(N):
    S = list(input())
    LS = len(S)
    tmp = [0]*26
    for j in range(LS):
        tmp[ord(S[j])-ord("a")]+=1
    for j in range(26):
        out[j]=min(out[j],tmp[j])
S = ""
for i in range(26):
    S += out[i]*chr(ord("a")+i)
print(S)
# Judge status: Accepted
import math
X = int(input())

n = math.ceil((-1+math.sqrt(1+8*X))/2)

print(n)
# Judge status: Wrong Answer
# coding: utf-8
import os, sys
import numpy as np

N, A, B = map(int, input().split())
# print(N, A, B)

rep = np.floor(N / (A+B))
rest = N - (A + B) * rep

diff = A if rest >= A else rest  
ans = A * rep + diff

print(int(ans))
# Judge status: Accepted

S = input()
st = []
if len(S) %2 != 0 :
    print('No')
else :
    for i in range(len(S) // 2) :
        st.append(S[i*2:i*2+2])
      
    st = list(set(st)) 
    if len(st) == 1 and st[0] == 'hi' :
        print('Yes')
    else :
        print('No')
# Judge status: Accepted
N,K,X,Y = [int(input()) for i in range(4)]

if N <= K:
    print(N * X)
else:
    print(K * X + (N-K) * Y)
# Judge status: Wrong Answer
N,Y = map(int,input().split())
a,b,c =-1,-1,-1
if Y<=10000*N:    
    target = Y - 1000*N
    for i in range(N+1):
        target_x = target - 4000*i
        if target_x < 4000:
            break
        if target_x % 9000 == 0:
            #print(target_x)
            a = int(target_x / 9000)
            b = i
            c = N - a - b
            break
print(*[a,b,c])
# Judge status: Wrong Answer
N, M = map(int, input().split())
if N == M:
  print("YES")
else :
  print("NO")
# Judge status: Accepted
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)'''
#import copy

#import numpy as np

l=int(input())
if l%3==0:
    print((l//3)**3)
elif l%3==1:
    print((l/3)**3)
else:
    print((l/3)**3)
# Judge status: Accepted
#!/usr/bin/env python3
s = input()
n = len(s)
n_0 = s.count("0")
n_1 = s.count("1")
d = abs(n_0 - n_1)
print(n - d)
# Judge status: Accepted
from collections import deque
k=int(input())
stack = deque([1,2,3,4,5,6,7,8,9])

def lunlun():
    cnt=0
    while True:
        now = stack.popleft()
        cnt += 1
        if cnt == k: return now
        s = str(now)
        for i in range(-1,2):
            temp=int(s[-1]) + i 
            if temp>=0 and temp<10: 
                temp1=int(s + str(temp))
                stack.append(temp1)
print(lunlun())
# Judge status: Accepted
def base10to(n, r):
    ans = 0
    while n > 0:
        n //= r
        ans += 1
    return ans

N,R = map(int,input().split())
print(base10to(N, R))
# Judge status: Accepted
a,b = map(int,input().split())
min_mod = 2018

if b-a > 2019:
	min_mod=0

else:	
	for aa in range(a,b):
	   for bb in range(aa+1,b+1):
	       if aa < bb:
	           cc=aa*bb
	 
	           if min_mod > cc%2019:
	               min_mod = cc%2019

print(min_mod)
# Judge status: Wrong Answer
import sys; readline = sys.stdin.readline
from collections import deque

k, x = map(int, readline().split())

if k * 500 >= x:
    print('yes')
else:
    print('No')
# Judge status: Accepted
a=int(input())
b=list(map(int,input().split()))
b_max=b[0]
total=0
for i in range(1,a):
    if b[i]<=b_max:
        total+=1
        b_max=b[i]
print(total+1)
# Judge status: Wrong Answer
print('Bad' if len(set(list(input())))<4 else 'Good')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print("Yes") if a + b <= c else print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
ans = 0
for i in a[1:-n:2]:
    ans += i
print(ans)
# Judge status: Accepted
N = int(input())
print("0.5" if N % 2 == 0 else ((N//2)+1)/N)
# Judge status: Accepted
def last_alert(list_):
    iter_ = iter(list_)
    n = next(iter_)
    for i in iter_:
        yield n, False
        n = i
    yield n, True


N, X = map(int, input().split())
ans = 0
for i, is_last in last_alert(sorted(map(int, input().split()))):
    if is_last and X != i:
        break
    elif X < i:
        break
    X -= i
    ans += 1
print(ans)
# Judge status: Wrong Answer
s = input()
list1 = [str(x) for x in s]
print("A" + list1[0] + "C")
# Judge status: Accepted
import math
a,b,c,d = map(int,input().split())

t = math.ceil(c/b)
o = math.ceil(a/d)

if t <= o:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
H = int(input())
attack = 0
while(H != 1):
    H = H // 2
    attack = attack +1
#print(attack)

kill = 0

for i in range(attack+1):
    kill = kill + 2**i
    #print(i,kill)

print(kill)
# Judge status: Wrong Answer
N = int(input())
S = input()

max_count = 0
for i in range(0, N-1):
  X = S[0:i+1]
  Y = S[i+1:]

  X_set = set(X)
  Y_set = set(Y)
  print(X,Y,X_set)

  count = len(X_set & Y_set)
  if max_count < count:
    max_count = count

print(max_count)
# Judge status: Accepted
N = int(input())
S = list(input())
a = 0
b = 0
A = []
for i in range(N):
  if S[i] == '.':
    a += 1
  else:
    b += 1
  A.append(b-a)
A.sort()
ans = min(a, b, a+A[0])
print(ans)
# Judge status: Accepted
K = int(input())
A, B = map(int, input().split())
flag=0
for i in range(A,B+1):
  if i%K==0:
    print('OK')
    flag=1
    break
if flag==0:
	print('NG')
# Judge status: Accepted
n,a,b,c,d,e = map(int,open(0).read().split())
m = min(a,b,c,d,e)
ans = n//m+4
if n%m == 0:
  print(ans)
else:
  print(ans+1)
# Judge status: Accepted
n=input()
k=len(n)
if k==1:
    print(n);exit()
nn=int(n)
ans= nn//(10**(k-1))-1+9*(k-1)
print(max(ans, sum([int(i) for i in n]) ))
# Judge status: Accepted

x=int(input())

xi=x//11
if x%11==0:
    print(2*xi)
elif x%11<=6:
    print(2*xi+1)
else:
    print(2*xi+2)
# Judge status: Wrong Answer
S = input()

if S[2] == S[3]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N=int(input())
MOD=10**9+7
MAX=N+1
def powermod(base,ind):
  if ind==1:
    return base
  elif ind%2==0:
    return (powermod(base,ind//2)**2)%MOD
  else:
    return ((powermod(base,ind//2)**2)*base)%MOD

print(powermod(10,N)-2*powermod(9,N)+powermod(8,N))
# Judge status: Accepted
from collections import deque

K = int(input())

lunlun = deque([i for i in range(1,10)])

for i in range(K):
    x = lunlun.popleft()
    if x % 10 != 0:
        lunlun.append(x * 10 + (x % 10) - 1)
    lunlun.append(x * 10 + (x % 10))
    if x % 10 != 9:
        lunlun.append(x * 10 + (x % 10) + 1)

print(x)
# Judge status: Wrong Answer
S = input()

num_len = 999
for i in range(len(S)-2):
    X = int(S[i:i+3])
    print(X)
    num_len = min(num_len, abs(753-X))

print(num_len)
# Judge status: Accepted
N, M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
  a, b = map(lambda x: int(x)-1, input().split())
  G[a].append(b)

for v in G[0]:
  for nv in G[v]:
    if nv == N-1:
      print("POSSIBLE")
      exit()
print("IMPOSSIBLE")
# Judge status: Wrong Answer
N = int(input())
p = list(map(int, input().split()))
p.sort(reverse=True)
lst = p[:]
jdg = True
temp = p[:]
ans = 0
while temp:
    lst = []
    q = temp.pop()
    for i in temp:
        if i%q!=0: lst.append(i)
        if i==q:jdg=False
    if jdg:
        ans += 1
    temp = lst[:]

print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
print(sum(list(range(b-a)))-a)
# Judge status: Accepted
N, x = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
if A[0] > x:
    ans += A[0] - x
    A[0] = x

for i in range(1, N):
    if A[i]+A[i-1] > x:
        ans += A[i]+A[i-1]-x
        A[i] -= A[i]+A[i-1]-x

print(ans)
# Judge status: Wrong Answer
n = int(input())
s = input()

array = [c for c in s]
tmp1 = 0
for i in range(len(array) - 1, 0, -1):
    if array[i] == "." and array[i - 1] == "#":
        array[i - 1] = "."
        tmp1 += 1


array = [c for c in s]
tmp2 = 0
for i in range(len(array) - 1):
    if array[i] == "#" and array[i + 1] == ".":
        array[i + 1] = "#"
        tmp2 += 1

print(min(tmp1, tmp2))
# Judge status: Wrong Answer
N=int(input())
A=sorted(list(map(int, input().split())))
arr=[None]*N
for a in range(N):
  arr[A[a]-1]=a+1
print(*arr)
# Judge status: Accepted
n = int(input())
print(n + n**2 + n**3)
# Judge status: Wrong Answer
n = int(input())
s = input()
t = 0
for i in range(n):
  if s.count(s[i]) >= 2:
    t += 1
print(t)
# Judge status: Accepted
s = input()
ans = 0
if s[0] == "R":
    ans += 1
    if s[1] == "R":
        ans += 1
        if s[2] == "R":
            ans += 1
elif s[1] == "R":
    ans += 1
    if s[2] == "R":
        ans += 1
elif s[2] == "R":
    ans += 1
print(ans)
# Judge status: Wrong Answer
import sys
import numpy as np
import numba
from numba import jit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@jit
def main(n, a):
  ans = [None]*n
  for i, j in enumerate(a):
    ans[j-1] = i+1
  for i in a:
    print(i, end=' ')
  
  
  
n, *a = map(int,read().split())
print(main(n, a))
# Judge status: Wrong Answer
a,b,c = map(int, raw_input().split(' '))
print max(10*a + b+c, a+10*b + c)
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))
count = 1

for i in range(len(P)-1):
  if P[i] >= P[i+1]:
    count += 1

print(count)
# Judge status: Accepted
K, X = [int(x) for x in input().split(" ")]
print("Yes" if K*500 >= X else "No")
# Judge status: Wrong Answer
s = input()
s = s.replace('/','')
print(s)

result = int(s)
if result <= 20190430:
    print("Heisei")
else:
    print("TBD")
# Judge status: Wrong Answer
a,b=map(int,input().split())
ans=1
plag=a
while plag<b:
  ans+=1
  plag=plag+a-1
print(ans)
# Judge status: Wrong Answer
m,n=map(int,input().split())
if m==n:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
c1=input()
c2=input()

print('YES' if c1==c2[::-1] and c2==c1[::-1] else 'NO')
# Judge status: Wrong Answer
n = int(input())
ok = False
for i in range(1,n):
    ans = n//i
    sur = n%i
    if i > 9:
        break
    elif sur ==0 and 1<= ans <=9:
       #print(i,ans)
        ok = True
        break

if ok:print("Yes")
else:print("No")
# Judge status: Wrong Answer
n,m=map(int,input().split())
def perm(n):
    a=1
    for i in range(1,n+1):
        a=(a*i)%(10**9+7)
    return a

if n==m:
    print((perm(n)*4)%(10**9+7))
elif abs(n-m)==1:
    print((perm(n)*perm(m))%(10**9+7))
else:
    print(0)
# Judge status: Accepted
a,b=map(int,input().split())
s=input()
keep=0
for i in range(0,a):
  if not 48<=ord(s[i])<=57:
    keep=1
    break
if not s[a]=="-":
  keep=1
for j in range(a+1,a+b+1):
  if not 48<=ord(s[j])<=57:
    keep=1
    break
print(["No","Yes"][keep==0])
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if a>c:
    c,d,a,b=a,b,c,d
print(max(0,min(b-c,d-c)))
# Judge status: Wrong Answer
a, b = map(int, input().split())

if a == b == 1:
    print('Draw')
elif a == 1 or a > b:
    print('Alice')
elif b == 1 or a < b:
    print('Bob')
else:
    print('Draw')
# Judge status: Accepted
S = {}
S["a"] = input()
S["b"] = input()
S["c"] = input()
s = "a"
while S[s]:
    s0 = S[s][0]
    S[s] = S[s][1:]
    s = s0
print(s.upper())
# Judge status: Accepted
import numpy as np

if __name__ == "__main__":
  _n = int(input())
  _l = [int(i) for i in input().split()]

  check = set()
  for i in _l:
    if i in check:
      print("NO")
      exit(0)
    else:
      check.add(i)
  print("YES")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

for i in range(n-1):
    if a[i] >= 0:
        continue
    else:
        a[i] *= -1
        a[i+1] *= -1

ans = sum(a)
print(ans)
# Judge status: Accepted
x,a,b=map(int,input().split())
if b-a<=x:
    if b-a<=0:
        print('delicious')
    else:
        print('safe')
else:
    print('dangerous')
# Judge status: Wrong Answer
N, R = list(map(int, input().split()))

print(R if N >= 10 else R - (100 * (10 - N)))
# Judge status: Accepted
N, M = input().strip().split()
N, M = [int(N), int(M)]

# 2次元配列
ab = sorted(list(map(int, input().split())) for _ in range(N))
c=0
for a,b in ab:
    c+=b
    if c>=M:
        print(a)
        break
# Judge status: Accepted
x, y = map(int,input().split())
li = list(map(int,input().split()))

if (x-1)%(y-1) == 0:
    print((x-1)//(y-1))
else:
    print((x-1)//(y-1)+1)
# Judge status: Wrong Answer
n, k = [int(i) for i in input().split()]
xx = [int(i) for i in input().split()]

cost = float("inf")
for i in range(n-k+1):
  j = i + k - 1
  cost = min(cost, abs(xx[i] - 0) + abs(xx[j] - xx[i]))
print(cost)
# Judge status: Wrong Answer
n = int(input())
power = 1
for i in range(1,n+1):
    power *= i

print(power % (10 ^ 9 + 7))
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    A, B, C, K = map(int, input().split())

    ans = 0
    if A >= K:
        print(K)
        exit()
    ans += A
    K -= A
    if B >= K:
        print(ans)
        exit()
    K -= B
    if C >= K:
        ans -= K
    else:
        ans -= C
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
def kangaru(x):
    count = 0
    i = 1
    while count != x:
        if count + (i * 2 + 1) <= x:
            count += i
        elif count + i == x:
            count += i
        i += 1
    return i - 1

def main():
    x = int(input())
    print(kangaru(x))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n, m = map(int, input().split())
h = []
h = list(map(int, input().split()))
ans = [0]*n
for i in range(m):
  a, b = map(int, input().split())
  if h[a-1] > h[b-1]:
    ans[b-1] = 1
  if h[a-1] < h[b-1]:
    ans[a-1] = 1
  else:
    ans[a-1] = 1
    ans[b-1] = 1

print(ans.count(0))
# Judge status: Accepted
n,a,b =map(int,input().split())
s = input()
cnt = 0
p = 0
for i in range(n):
    if s[i] == 'a':
        if cnt <a+b:
            print('Yes')
            cnt +=1
        else:
            print('No')
    elif s[i] == 'b':
        p +=1
        if cnt <a+b and p <=b:
            print('Yes')
            cnt +=1
        else:
            print('No')
    else:
        print('No')
# Judge status: Accepted
s = input()
k = int(input())

for i in range(min(k, len(s))):
    if s[i] != '1':
        print(s[i])
        break
else:
    print('1')
# Judge status: Accepted
import itertools

n, m, q = map(int, input().split())
kumi = []
for i in range(q):
    kumii = list(map(int, input().split()))
    kumi.append(kumii)

ans = 0
for a in itertools.combinations_with_replacement(range(1, m+1), n):
    temp = 0
    for i in range(q):
        ai, bi, ci, di = kumi[i]
        ai, bi = ai-1, bi-1
        if a[bi] - a[ai] == ci:
            temp += di
    ans = max(ans, temp)

print(ans)