Harryxun/stf_run huggingface dataset:
S, A, B = map(int,input().split())

bis = 1
while K > 0:
  if(bis+1 > B):
    bis += 1
    K -= 1
  else:
    if(bis%A == 0):
      bis = 0
    else:
      bis //= A
    bis += B*max(bis//A, 1)
    K -= 2
print(bis)

### FIXED CODE ###

K, A, B = map(int,input().split())

if(A >= B-1 or 1+K <= A):
  print(K+1)
else:
  print((K-(A-1))//2*(B-A)+A+(K-(A-1))%2)
A, B = list(map(int, input().split()))

if A >=13:
	print(B)
elif A>=6:
	print(1nt(B/2))
else:
	print(0)

### FIXED CODE ###

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

if A >=13:
	print(B)
elif A>=6:
	print(int(B/2))
else:
	print(0)
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()


N=int(input())
X=input()
C=X.count("1")

lst=[]
lstcount=[]
for x in [C-1,C+1]:
    flg=0
    if C<=0:
        lst.append(0)
        lstcount.append(0)
    else:
        Z=0
        p=1
        for i in range(N):
            if X[-i-1]=="1":
                Z+=p
            p*=2
            if Z>=x:
                Z%=x
                flg=1
            if flg:
                p%=x
        lst.append(Z)
        lstcount.append(flg)

#print(lst)
fac1=[1]
fac2=[1]
C1=C-1
C2=C+1
for i in range(N):
    fac1.append(fac1[-1]*2%C1)
    fac2.append(fac2[-1]*2%C2)

for i in range(N):

    _C=C+(1 if X[i]=="0"  else -1 )
    if _C==0:
        print(0)
        continue
    if  X[i]=="0":
        lstidx=1
    else:
        lstidx=0

    idx=(N-1-i)

    value=lst[lstidx]+(fac2[idx] if  X[i]=="0" else fac1[idx])
    #print(lst[lstidx],value,_C)
    count=lstcount[lstidx]-1
    while value:
        count+=1
        value%=_C
        _C=0
        bit=value
        while bit:
            _C+=bit&1
            bit>>=1
    print(count)


### FIXED CODE ###

from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()


N=int(input())
X=input()
C=X.count("1")

lst=[]
lstcount=[]
for x in [C-1,C+1]:
    flg=0
    if x<=0:
        lst.append(0)
        lstcount.append(0)
    else:
        Z=0
        p=1
        for i in range(N):
            if X[-i-1]=="1":
                Z+=p
            p*=2
            if Z>=x:
                Z%=x
                flg=1
            if flg:
                p%=x
        lst.append(Z)
        lstcount.append(flg)
#print(lst)
fac1=[1]
fac2=[1]
C1=max(C-1,1)
C2=max(C+1,1)
for i in range(N):
    fac1.append(fac1[-1]*2%C1)
    fac2.append(fac2[-1]*2%C2)

for i in range(N):

    _C=C+(1 if X[i]=="0"  else -1 )
    if _C==0:
        print(0)
        continue
    if  X[i]=="0":
        lstidx=1
    else:
        lstidx=0

    idx=(N-1-i)

    value=lst[lstidx]+(fac2[idx] if  X[i]=="0" else -fac1[idx])
    #print(value,X[i]=="0",lst,C-1,C+1)
    bit=value
    count=0
    while value and _C:
        count+=1
        value%=_C
        _C=0
        bit=value
        while bit:
            _C+=bit&1
            bit>>=1
    print(max(count,1))
N,W = map(int,input().split())
dp = [[0] * (W + 1) for i in range(N + 1)]
for n in range(1,N + 1):
	w,v = map(int,input().split())
	if w > W:
		continue
	for m in range(w):
		dp[n][m] = dp[n - 1][m]
	for m in range(w,W + 1):
		dp[n][m] = max(dp[n - 1][m - w] + v, dp[n - 1][m])
print(max(dp[-1]))


### FIXED CODE ###

def f1():
	L.sort(key = (lambda x: - x[1]//(x[0] - w1 + 40)))
	ans = 0
	w2 = 0
	i = 0
	while i < N:
		w2 = w2 + L[i][0]
		if w2 > W:
			break
		ans = ans + L[i][1]
		i = i + 1
	
	return ans
	
def f3():
	L.sort(key = (lambda x: - x[1]//x[0]))
	ans = 0
	w2 = 0
	i = 0
	while i < N:
		w2 = w2 + L[i][0]
		if w2 > W:
			break
		ans = ans + L[i][1]
		i = i + 1
	
	return ans
def f2():
	dp = [[0] * (W + 1) for i in range(N + 1)]
	for n in range(1,N + 1):
		w,v = L[n - 1]
		if w > W:
			continue
		for m in range(w):
			dp[n][m] = dp[n - 1][m]
		for m in range(w,W + 1):
			dp[n][m] = max(dp[n - 1][m - w] + v, dp[n - 1][m])
	return max(dp[-1])
	
N,W = map(int,input().split())
L = [list(map(int,input().split())) for i in range(N)]
w1 = L[0][0]
if w1 > 10000000:
	print(f1())
elif W > 10000000:
	print(f3())
else:
	print(f2())
import math


n = int(input())
candidates = {}


for _ in range(n):
    inp = input()
    if inp in candidates:
        candidates[inp] += 1
    else:
        candidates[inp] = 1


max_votes = -math.inf
for candidate, votes in candidates.items():
    if votes >= max_votes:
        max_votes = votes

for candidate, votes in sorted(candidates.items()):
    if votes == max_votes:
        print(candidate)

### FIXED CODE ###

n = int(input())
dic = {}
for i in range(n):
    s = input()
    try:
        dic[s] += 1
    except:
        dic[s] = 1
high=max(dic.values())
val= sorted(dic.items())
for i in val:
    if(i[1]==high):
        print(i[0])
H, W = map(int, input().split())
S = ['.'*(W+2)] + [['.'] + input() + ['.'] for _ in range(H)] + ['.'*(W+2)]
flg = False
for i in range(1, H+1):
  for j in range(1, W+1):
    if S[i][j] == '#':
      cnt = 0
      if S[i][j-1] == '.':
        cnt += 1
      if S[i][j+1] == '.':
        cnt += 1
      if S[i-1][j] == '.':
        cnt += 1
      if S[i+1][j] == '.':
        cnt += 1
      flg = (cnt == 4)
if flg:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

H, W = map(int, input().split())
S = ['.'*(W+2)] + ['.' + input() + '.' for _ in range(H)] + ['.'*(W+2)]
flg = False
for i in range(1, H+1):
  for j in range(1, W+1):
    if S[i][j] == '#':
      cnt = 0
      if S[i][j-1] == '.':
        cnt += 1
      if S[i][j+1] == '.':
        cnt += 1
      if S[i-1][j] == '.':
        cnt += 1
      if S[i+1][j] == '.':
        cnt += 1
      flg = (cnt == 4)
      if flg:
        break
  if flg:
    break
if flg:
  print("No")
else:
  print("Yes")
def edit_distance(s, t):
 s = raw_input()
 t = raw_input()
 dp = {}
 for i in range(len(s) + 1):
  dp[i] = {0: i}
 for j in range(len(t) + 1):
  dp[0][j] = j
 for i in range(1, len(s) + 1):
  for j in range(1, len(t) + 1):
   if (s[i-1] == t[j-1]): 
    d = 0
   else:
    dp[i][j] = min(dp[i-1][j] + 1, dp[i][j-1] + 1, dp[i-1][j-1] + d)
 return dp[len(s)][len(t)]
n = input()
for p in range(n):
    print edit_distance()

### FIXED CODE ###

def edit_distance():
 s = raw_input()
 t = raw_input()
 a = len(s)
 b = len(t)
 x = [0 for i in range(b+1)]
 for i in range(a):
   q = s[i]
   x2 = x+[]
   for j in range(b):
    if (q ==t[j]):
     x[j+1] =x2[j]+1
    elif (x[j+1]<x[j]):
     x[j+1] =x[j]
 return x[-1]

n = input()
for i2 in range(n):
 print edit_distance()
n=input()
s=[]
s.append(2)
s.append(1)
if n==0:
    print('2')
    exit()
elif n==1:
    print('1')
    exit()
else:
    for i in range(2,86):
        k = s[i-2]+s[i-1]
        s.apend(k)
        if i==n-1:
            print(s[i])
            exit()


### FIXED CODE ###

n=int(input())
s=[]
s.append(2)
s.append(1)
if n==1:
    print('1')
    exit()
else:
    for i in range(2,87):
        k = s[i-2]+s[i-1]
        s.append(k)
        if i==n:
            print(s[i])
            exit()
N = int(input())
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
l = [format(i, 'b').zfill(10) for i in range(1, 2 ** 10)]
ans = []

for i in l:
    c = [0] * 
    for j in range(10):
        if i[j] == '1':
            for k in range(N):
                if F[k][j] == 1:
                    c[k] += 1
                else:
                    continue
        else:
            continue
    temp = 0
    for j in range(N):
        temp += P[j][c[j]]
    ans.append(temp)

print(max(ans))

### FIXED CODE ###

N = int(input())
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
l = [format(i, 'b').zfill(10) for i in range(1, 2 ** 10)]
ans = []

for i in l:
    c = [0] * N
    for j in range(10):
        if i[j] == '1':
            for k in range(N):
                if F[k][j] == 1:
                    c[k] += 1
                else:
                    continue
        else:
            continue
    temp = 0
    for j in range(N):
        temp += P[j][c[j]]
    ans.append(temp)

print(max(ans))
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    V=100
    W=[1 for i in range(V+1)]
    # Eratosthenes sieve (O(VloglogV))
    S=[1]*(V+1)
    S[0]=0; S[1]=0
    for p in range(2,V):
        if S[p]==0: continue
        W[p]*=1-p
        for k in range(2*p,V+1,p):
            W[k]*=1-p
            S[k]=0
    W=[W[i]/i if i else 0 for i in range(V+1)]
    n,k=map(int,input().split())
    ans=0
    for d in range(1,k+1):
        if k%d==0:
            ans+=d*W[d]*(n//d)*(n//d+1)//2%MOD
    print(round(ans)*k%MOD)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=998244353
input=lambda:sys.stdin.readline().rstrip()

class modfact(object):
    def __init__(self,n):
        fact=[1]*(n+1); invfact=[1]*(n+1)
        for i in range(1,n+1): fact[i]=i*fact[i-1]%MOD
        invfact[n]=pow(fact[n],MOD-2,MOD)
        for i in range(n-1,-1,-1): invfact[i]=invfact[i+1]*(i+1)%MOD
        self.__fact=fact; self.__invfact=invfact

    def inv(self,n):
        assert(n>0)
        return self.__fact[n-1]*self.__invfact[n]%MOD

    def fact(self,n):
        return self.__fact[n]

    def invfact(self,n):
        return self.__invfact[n]

    def comb(self,n,k):
        if(k<0 or n<k): return 0
        return self.__fact[n]*self.__invfact[k]*self.__invfact[n-k]%MOD

    def perm(self,n,k):
        if(k<0 or n<k): return 0
        self.__fact[n]*self.__invfact[k]%MOD

def prime(n):
    if n<=1: return []
    S=[1]*(n+1)
    S[0]=0; S[1]=0
    for i in range(2,n):
        if(S[i]==0): continue
        for j in range(2*i,n+1,i): S[j]=0
    return [p for p in range(n+1) if(S[p])]

def resolve():
    n=int(input())
    A=list(map(int,input().split()))
    V=max(A)
    C=[0]*(V+1)
    for a in A: C[a]+=1

    P=prime(V)
    W=[1]*(V+1)
    for p in P:
        for i in range(p,V+1,p):
            W[i]*=(1-p)
    mf=modfact(V)
    for i in range(1,V+1):
        W[i]=(W[i]*mf.inv(i))%MOD

    ans=0
    for d in range(1,V+1):
        s=0 # 和(後に2乗する)
        t=0 # 2乗の和
        for i in range(d,V+1,d):
            s+=i*C[i]
            t+=(i**2)*C[i]
        ans+=W[d]*(s**2-t)//2
        ans%=MOD
    print(ans)
resolve()
s =str(input())
ans = 0
aa = []
for i in range(1,len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        if s[i-1] in ['A', 'C', 'G', 'T']:
            ans += 1
        else:ans = 1
    else:
        aa.append(ans)
        ans = 0
print(max(aa))

### FIXED CODE ###

s =str(input())
ans = 0
aa = []
if s[0] in ['A', 'C', 'G', 'T']:
    ans =1
for i in range(1,len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        if s[i-1] in ['A', 'C', 'G', 'T']:
            ans += 1
        else:ans = 1
    else:
        aa.append(ans)
        ans = 0
aa.append(ans)
print(max(aa))
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/C-RemainderMinimization.py
#
import math
a, b, c, d = map(int, input().split())
cd_lcm = (c * d) // math.gcd(c, d)
ab_c = b//c - (a-1)//c
ab_d = b//d - (a-1)//d
ab_cd_both = b//cd_lcm - (a-1)//cd_lcm
ab_cd_either = ab_c + ab_d - ab_cd_both
ab_cd_neither = b-a+1 - ab_cd_either
# print("cd_lcm ab_cd_either {} {}".format(cd_lcm, ab_cd_either))

print(ab_cd_neither)


### FIXED CODE ###

#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/C-RemainderMinimization.py
#
# import math
from fractions import gcd
a, b, c, d = map(int, input().split())
# cd_lcm = (c * d) // math.gcd(c, d)
cd_lcm = (c * d) // gcd(c, d)
ab_c = b//c - (a-1)//c
ab_d = b//d - (a-1)//d
ab_cd_both = b//cd_lcm - (a-1)//cd_lcm
ab_cd_either = ab_c + ab_d - ab_cd_both
ab_cd_neither = b-a+1 - ab_cd_either

print(ab_cd_neither)
from collections import *
from heapq import *
from itertools import *
from fractions import gcd
import sys
from decimal import *
import copy
from bisect import *
input=lambda :sys.stdin.readline().rstrip()


X,Y,A,B,C=map(int,input().split())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
R=list(map(int,input().split()))
lst=[]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort()

while len(P)>X:
    P.pop()
while len(Q)>Y:
    Q.pop()

flag=1
while flag:
    if not R:
        break

    flag=0
    if P and R:
        if P[-1]<Q[-1]:
            if P[-1]<R[-1]:
                P.pop()
                lst.append(R.pop())
                flag=1
        else:
            if Q[-1]<R[-1]:
                Q.pop()
                lst.append(R.pop())
                flag=1
    else:
        if P:
            if P[-1]<R[-1]:
                P.pop()
                lst.append(R.pop())
                flag=1
        elif R:
            if Q[-1]<R[-1]:
                Q.pop()
                lst.append(R.pop())
                flag=1
for i in range( X+Y-(len(P)+len(Q)+len(lst))):
    if R:
        lst.append(R.pop())
print(sum(P)+sum(Q)+sum(lst))


### FIXED CODE ###

from collections import *
from heapq import *
from itertools import *
from fractions import gcd
import sys
from decimal import *
import copy
from bisect import *
input=lambda :sys.stdin.readline().rstrip()


X,Y,A,B,C=map(int,input().split())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
R=list(map(int,input().split()))
lst=[]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort()

while len(P)>X:
    P.pop()
while len(Q)>Y:
    Q.pop()

flag=1
while flag:
    if not R:
        break

    flag=0
    if P and Q:
        if P[-1]<Q[-1]:
            if P[-1]<R[-1]:
                P.pop()
                lst.append(R.pop())
                flag=1
        else:
            if Q[-1]<R[-1]:
                Q.pop()
                lst.append(R.pop())
                flag=1
    else:
        if P:
            if P[-1]<R[-1]:
                P.pop()
                lst.append(R.pop())
                flag=1
        elif Q:
            if Q[-1]<R[-1]:
                Q.pop()
                lst.append(R.pop())
                flag=1

for i in range( X+Y-(len(P)+len(Q)+len(lst))):
    if R:
        lst.append(R.pop())
    else:
        break
print(sum(P)+sum(Q)+sum(lst))
import sys
input = sys.stdin.readline
N,Q = map(int, input().split())
ki = [[] for i in range(N+1)]
val = [0 for _ in range(N+1)]
 
for _ in range(N-1):
    a,b = map(int, input().split())
    ki[a].append(b)
for _ in range(Q):
    p,x = map(int, input().split())
    val[p] += x

touched = []
def add_num(p):
  touched.append(p)
  for k in ki[p]:
    if (k!=p)&(k not in touched):
      val[k] += val[p]
      add_num(k)

add_num(1)
print(*val[1:])

### FIXED CODE ###

N,Q = map(int, input().split())
ki = [[] for i in range(N+1)]
val = [0 for _ in range(N+1)]

for _ in range(N-1):
  a,b = map(int, input().split())
  ki[a].append(b)
  ki[b].append(a)
for _ in range(Q):
  p,x = map(int, input().split())
  val[p] += x

q = [(1,0)]
while q:
  c,p = q.pop()
  val[c] += val[p]
  for x in ki[c]:
    if x==p:
      continue
    q.append((x,c))
print(' '.join(map(str, val[1:])))
n = input()
a = list(map(int, input().split()))
cnt = 0
while all(i%2 == 0 for i in a):
    a = [i % 2 for i in  a]
    cnt += 1
print(cnt)

### FIXED CODE ###

print(input().count("1"))
x,y = map(int,input().split())
a=y-x
b=a*(a-1)/2
print(round(b-x))


### FIXED CODE ###

n=int(input())
if n<=999:
    print('ABC')
else:
    print('ABD')
from math import gcd
n,p = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
m = make_divisors(p)
x = []
i = 1
while p != 1:
    if p % m[i] == 0:
        x.append(m[i])
        p = p // m[i]
    else:
        i += 1
print(gcd(x[0],x[-1]))

### FIXED CODE ###

from math import sqrt
from math import floor
n,p = map(int,input().split())
l = [p]
for i in range(2,floor(sqrt(p))+1):
    if p % i == 0:
        l.append(i)
        l.append(p//i)
l.sort()
s = [1]
i = 0
while p > 1:
    if p % l[i] == 0:
        s.append(l[i])
        p = p // l[i]
    else:
        i += 1
ans = 1
x = s[0]
y = 1
for i in s[1:]:
    if x == i:
        y += 1
    else:
        while y >= n:
            ans *= x
            y -= n
        x = i
        y = 1
while y >= n:
    ans *= x
    y -= n
print(ans)
a,b=input().split()
a=int(a)
b=int(float(b*100))
print(a*b//100)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=b.replace(".","")
b=int(b)
print(a*b//100)
A , B = map ( int , input ( ).split ( ) )
print ( int ( A ) * int ( B ) , end = " " )
print ( 2 * ( int ( A ) + int ( B ) ) )

### FIXED CODE ###

A , B = map ( int , raw_input ( ).split ( ) )
print A*B , 2* ( A + B )
#ABC084D
def main():
    import sys
    Q = int(sys.stdin.readline())
    LR = [tuple(map(int, sys.stdin.readline().split())) for _ in range(Q)]
    #print(LR)
    
    check = [1 for _ in range(10**5+1)]
    check[0], check[1] = 0, 0
    for i in range(2, 10**5+1):
        if check[i] ==0:
            continue
        elif check[i] ==1:
            for j in range(2*i, 10**5+1, i):
                check[j] =0
    check2 = check.copy()
    for i in range(2, 10**5+1):
        if check[i]==1:
            #print((i+1)/2, check[(i+1)//2])
            if (i+1)%2==0 and check[(i+1)//2] ==1:
                continue
            else:
                check2[i] = 0
    
    #print(check)
    for lr in LR:
        #print(lr[0], lr[1])
        print(check2[lr[0]:lr[1]+1].count(1))
                


if __name__ =='__main__':
    main()


### FIXED CODE ###

#ABC084D
def main():
    import sys
    Q = int(sys.stdin.readline())
    LR = [tuple(map(int, sys.stdin.readline().split())) for _ in range(Q)]
    #print(LR)
    
    def calc(N):
        import math
        for i in range(3, int(math.sqrt(N))+1):
            while N % i==0:
                N =N//i
                return 0
        else:
            num = (N+1)//2
            #if num ==2:
                #return N
            for j in range(2, int(math.sqrt(num)+1)):
                while num % j==0:
                    num = num//j
                    return 0
            else:
                return N
    
     
    L = []
    for i in range(3, 10**5+1, 2):
        tmp = calc(i)
        if tmp !=0:
            L+=[tmp]
    #print(L)
    import bisect
    
    for row in LR:
        l = bisect.bisect_left(L, row[0])
        r = bisect.bisect_right(L, row[1])
        print(r-l)

if __name__=='__main__':
    main()
from string import*;from itertools import*
b=ascii_lowercase;r=s=input();d=l=len(s);t=s[::-1]
if l>25:d=-[p*len(list(k))for p,k in groupby([i<j for i,j in zip(s[::-1],s[-2::-1])])][0]-2;s,b,o=s[:d],s[d+1:],1
print(-(d<-26)or s+sorted(set(b)-set([s,b[:ord(s[d])-97]][o]))[0])

### FIXED CODE ###

#!/usr/bin/env python3
from string import*
from itertools import*
b = ascii_lowercase
s = input()
l = len(s)
if l < 26:
    print(s + sorted(set(b) - set(s))[0])
else:
    t = s[::-1]
    a = [(p, len(list(k))) for p, k in groupby([i < j for i, j in zip(t, t[1:])])][0]
    d = - a[0]*a[1] - 2
    print(-(d < -26) or s[:d] + sorted(set(s[d+1:]) - set(b[:ord(s[d]) - 97]))[0])
import bisect

n = int(input())
a = [int(i) for i in input().split()]
a.sort()
max_a = a[n-1]
a.remove(max_a)
result = bisect.bisect_left(a, max_a // 2)
print(max_a, a[result])



### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
a.sort()
max_a = a[-1]
print(max_a, min(a, key=lambda x: abs(max_a - 2*x)))
N = int(input())
A = [0, 0] + [int(input()) for _ in range(N - 1)]

child = [[] for _ in range(N + 1)]
for i, a in enumerate(A):
    child[a].append(i)

def depth(i):
    if not child[i]:
        return 0

    childDepth = [depth(to) for to in child[i]]
    childDepth.sort(reverse=True)
    ret = 0
    for j, d in enumerate(childDepth, start=1):
        ret = max(j + d, ret)
    return ret

ans = depth(1)
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = [0, 0] + [int(input()) for _ in range(N - 1)]

child = [[] for _ in range(N + 1)]
for i, a in enumerate(A):
    child[a].append(i)

def depth(i):
    if not child[i]:
        return 0

    childDepth = [depth(to) for to in child[i]]
    childDepth.sort(reverse=True)
    ret = 0
    for j, d in enumerate(childDepth, start=1):
        ret = max(j + d, ret)
    return ret

ans = depth(1)
print(ans)
def main():
    R,G,B,N=map(int,input().split())
    cnt=0
    for i in range(N//R+1):
        cnt+=sum([1 for j in range((N-i*R)//G+1) if i*R + j*G +((N-p-j*G)//B)*B==N])
    print(cnt)

main()

### FIXED CODE ###

R,G,B,N=map(int,input().split())
cnt=0
for i in range(N//R+1):
    for j in range((N-i*R)//G+1):
            if i*R + j*G +((N-i*R-j*G)//B)*B==N:
                cnt+=1
print(cnt)
A,B = input().split()
A = int(A)
B = replace(".","")

B = int(B) * 100

print(A*B/100)

### FIXED CODE ###

import math
A,B = input().split()
A = int(A)
B = B.replace(".","")
 
B = int(B)
print(math.floor(A*B//100))
from numba import njit

@njit("i8(i8)")
def solve(n):
    s = [1] * (n+1)
    ans = 1
    for i in range(2,n+1):
        for j in range(i,n+1,i):
            s[j] += 1
        ans += (i * s[i])
	return ans
n = int(input()) 
print(solve(n))


### FIXED CODE ###

a = int(input())
print(a + pow(a, 2) + pow(a,3))
a,b = map(int(),input().split())
print(a*b,2*(a+b))


### FIXED CODE ###

a,b = map(int,input().split())
print(a*b,2*(a+b))
S = input()
T = input()
count = 0
while S !=T:
    if count > len(S):
        ans = "No"
        break
    else:
        S = S[-1:] + S[:-1]
        ans = "Yes"
        count +=1
print(ans)

### FIXED CODE ###

S = input()
T = input()
count = 0
ans = "Yes"
while S !=T:
    if count > len(S):
        ans = "No"
        break
    else:
        S = S[-1:] + S[:-1]
        ans = "Yes"
        count +=1
print(ans)
from collections import Counter
def solve(N, XY):
    XY = sorted(XY)
    cnt = Counter()
    d = []
    for (x0, y0), (x1, y1) in zip(XY, XY[1:]):
        d.append((x0 - x1, y0 - y1))
    m = Counter(d).most_common()[0]
    return len(XY) - m[1]

def main():
    N = int(input())

    XY = []
    for i in range(N):
        XY.append(tuple([int(x) for x in input().split()]))

    print(solve(N, XY))

main()



### FIXED CODE ###

from collections import Counter
def solve(N, XY):
    if N == 1:
        return 1
    XY = sorted(XY)
    cnt = Counter()
    d = []
    for x0, y0 in XY:
        for x1, y1 in XY:
            if x0 == x1 and y0 == y1:
                continue
            d.append((x0 - x1, y0 - y1))
    m = Counter(d).most_common()[0]
    return len(XY) - m[1]

def main():
    N = int(input())

    XY = []
    for i in range(N):
        XY.append(tuple([int(x) for x in input().split()]))

    print(solve(N, XY))

main()
n = int(input())

ans = []
for i in range(1, 10):
    if 1000 * i - n >= 0:
        ans.append(1000*i - n)

print(min(ans))


### FIXED CODE ###

n = int(input())

ans = []
for i in range(11):
    if 1000 * i - n >= 0:
        ans.append(1000*i - n)

print(min(ans))