peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())
i=1
tmp=1
while True:
  if i**2<=n:
    tmp=i**2
  else:
    break
  i+=1
print(tmp)
# Judge status: Accepted
S, T = input().split()

result = T + S

print(result)
# Judge status: Accepted
n,k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(k, n):
    if a[i] > a[i-k]:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
N = int(input())
S = list(input())

ans = N

left_W = 0
right_E = S.count("E")

for n in range(N):
  if n == 0:
    if S[n] == "E":
      right_E -= 1
    ans = min(ans,left_W + right_E)
        
  elif n == N-1 :
    if S[n-1] == "W":
      left_W += 1
    ans = min(ans,left_W + right_E)
      
  else:
    if S[n] == "E":
      right_E -= 1
    if S[n-1] == "W":
      left_W += 1
    ans = min(ans,left_W + right_E)

print(ans)
# Judge status: Wrong Answer
n=int(input())
a=map(int,input().split())

num = 0
for i in a:
  if i % 2 == 0:
    if i % 3 != 0 or i % 5 != 0:
      num='DENIED'
    else:
      num='APPROVED'
  else:
    num='DENIED'
print(num)
# Judge status: Accepted
a=int(input())
ans=a*(a+1)//2
print(ans)
# Judge status: Accepted
d,t,s = map(int, input().split())
if d / s <= t:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
l = 0
r = max(a)

while l < r:
    m = (l + r) // 2
    cnt = 0
    for v in a:
        if m == 0:
            cnt += 2 * v
        else:
            cnt += (v + m - 1) // m - 1
    if cnt <= k:
        r = m
    else:
        l = m + 1

print(l)
# Judge status: Accepted
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

A, B = map(int, readline().split())

if A <= 0 and B >= 0:
    print("Zero")
elif A > 0:
    print("Positive")
else:
    print("Positive") if (B - A + 1) % 2 == 0 else print("Negative")
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()

if s == t:
	print(n)
	exit()

s = s[::-1]

i = 0
res = 0
while True:
	if s[i] != t[i]:
		break
	i += 1
	res += 1

print(2 * n - res)
# Judge status: Accepted
def main():
    k, n = map(int, input().split())
    dp = [0] * (k+1)
    dq = [0] * (k+1)
    pen = 0
    for i in range(n):
        p,q = input().split()
        p = int(p)
        if dp[p] == 0:
            if q == 'WA':
                dq[p] += 1
            elif q == 'AC':
                dp[p] = 1
                pen += dq[p]
    print(sum(dp), pen)

if __name__ == '__main__':
    main()
# Judge status: Accepted
#ord('A') , ord('Z') (65, 90)
n = int(input())
s = input()
#n = 2
#s = 'ABCXYZ'

ans = ''
for i in s:
  x = ord(i) + n
  if x > 90:
    x = 65 + x % 90 -1
  ans += chr(x)

print(ans)
# Judge status: Wrong Answer
N,M=map(int,input().split())
if N>=M:
    X=[int(i) for i in input().split()]
    print(0)
else:
    X=[int(i) for i in input().split()]
    a=sorted(X)
    d=[]
    for i in range(M-1):
        d.append(a[i+1]-a[i])
    k=sorted(d)
    del k[-(N-1):]
    print(sum(k))
# Judge status: Accepted
import math , sys

N = int( input() )
A = list( map( int, input().split() ))
A.sort()
Cs = [0 for _ in range(10**6+1)]
M = A[-1]
#print(A)
i=0
M = max(A)
for i in range(N):
    e = A[i]
    if Cs[e]==1:
        Cs[e]=2
    elif Cs[e]==0:
        Cs[e]=1

for i in range(len(Cs)):
    Cs[i] = Cs[i]%2

for e in A:
    i = 2
    while e*i <= M:
        Cs[e*i] = 0
        i+=1
ans = sum(Cs)
print(ans)
# Judge status: Wrong Answer
x = input()
if x == 0:
    print(1)
elif x == 1:
    print(1)
else:
    pass
# Judge status: Accepted
import collections
n = int(input())
a = []
while n % 2 == 0:
    a.append(2)
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        a.append(f)
        n //= f
    else:
        f += 2
if n != 1:
    a.append(n)
c = collections.Counter(a)
l = list(c.values())

def func(n):
    i = 2
    counter = 1
    while counter <= n:
        counter += i
        i += 1
    return i-2

print(sum(map(func, l)))
# Judge status: Accepted
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    N, M = map(int, input().split())

    res = N * (N-1) // 2 + M * (M-1) // 2
    print(res)


if __name__ == '__main__':
    main()
# Judge status: Accepted
x=int(input())
y=list(map(int, input().split()))
y.sort()

a=y[len(y)//2]
b=y[(len(y)//2)-1]

if a==b:
	print(0)
else :
	print(a-b)
# Judge status: Accepted
a = input()
if a =='a' or a == 'e' or a == 'i' or a == 'o' or a == 'u':
    print('vowel')
else:
    print('consonant')
# Judge status: Accepted
def c_id():
    from collections import defaultdict
    N, M = [int(i) for i in input().split()]
    Cities = [[int(i) for i in input().split()] for j in range(M)]

    dic = defaultdict(list)
    # 県毎に市をまとめる
    for p, y in Cities:
        dic[p].append(y)
    # 市の認識番号を (座標) 圧縮
    for p, lst in dic.items():
        dic[p] = {v: k for k, v in enumerate(sorted(lst), 1)}
    return '\n'.join(['{0:06d}{1:06d}'.format(p, dic[p][y]) for p, y in Cities])

print(c_id())
# Judge status: Accepted
N,D=map(int,input().split())
XY=[]
ans=0
for i in range(N):
    x,y=map(int,input().split())
    if D>=(x**2+y**2)**0.5:
        ans+=1
print(ans)
# Judge status: Accepted

def resolve():
    import sys
    input = sys.stdin.readline

    s = input().rstrip()
    r = 0
    b = 0
    for c in s:
        if c == "0":
            r += 1
        else:
            b += 1

    print(min(r, b) * 2)


if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
S = input()

max_length = 0
length = 0
for s in S:
    if s in ["A", "C", "G", "T"]:
        length += 1
    else:
        if length > max_length:
            max_length = length
        length = 0
print(max_length)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        w=list(input())
        w.sort()
        if len(w)%2!=0:
            return 'No'
        else:
            for i in range(0,len(w)-1,2):
                if w[i]!=w[i+1]:
                    return 'No'
            return 'Yes'
    print(main())
resolve()
# Judge status: Accepted
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
a_right = [i+ai for i,ai in enumerate(a,1)]
a_left  = [i-ai for i,ai in enumerate(a,1)]

a_right_count = Counter(a_right)
a_left_count  = Counter(a_left)

ans = 0
for k,v in a_right_count.items():
    ans += v * a_left_count.get(k,0)

print(ans)
# Judge status: Accepted
n=int(input())-1;print(n*(n+1)//2)
# Judge status: Accepted
import math
N, D = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(N)]
cnt = 0
for x, y in p:
    if D >= math.sqrt(x**2 + y**2):
        cnt += 1
print(cnt)
# Judge status: Accepted
a, b, x = map(int, input().split())
if a <= x <= a+b:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
import math
n,m = map(int, input().split())
if n==m+1 or n==m-1:
    ans = math.factorial(n)*math.factorial(m)
elif n==m:
    ans = math.factorial(n)*math.factorial(m)*2
else:
    ans = 0
print(ans%(10**9+7))
# Judge status: Accepted
n, k = map(int, input().split())
A = list(map(int, input().split()))

ans = float('inf')
for L in range(n-k+1):
    R = L + k
    if A[L] < 0 and A[R-1] < 0:
        ans = min(ans, abs(A[L]))
    elif A[L] < 0 and 0 <= A[R-1]:
        ans = min(ans, min(abs(A[L]), abs(A[R-1]))*2 + max(abs(A[L]), abs(A[R-1])))
    else:
        ans = min(ans, abs(A[R-1]))
print(ans)
# Judge status: Wrong Answer
S = input()

l = len(S)

max_cnt = 0
for i in range(l):
    for j in range(i, l):
        max_cnt = max(sum([1 if s == "A" or s == "C" or s == "G" or s == "T" else 0 for s in S[i : j + 1]]), max_cnt)
print(max_cnt)
# Judge status: Accepted
n=int(input())
cnt=0
for i in range(int(n//4)+1):
  for j in range(int(n//7)+1):
    if i*4+7*j==n:
      cnt+=1
if cnt>0:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
from bisect import bisect_right
a = int(input())
dp = [1]
t = 1

while t**2<=10000:
    dp.append(t**2)
    t+=1
    if dp[-1]==a:
        print(dp[-1])
        exit()
    elif dp[-1] > a:
        print(dp[-2])
        exit()
print(dp[bisect_right(dp,a)-1])
# Judge status: Wrong Answer
N, M = map(int, input().split())
work = [[]]*M

for i in range(N):
    a, b = map(int, input().split())
    if a <= M:
        work[a-1] = work[a-1] + [b]

max = 0
num = []
for i in range(M):
    num=sorted(num+work[i],reverse=True)
    if len(num)>0:
        max+=num[0]
        num=num[1:]
        if N-i < len(num):
            num = num[0:N-i]

print(max)
# Judge status: Wrong Answer
K = int(input())
A, B = map(int, input().split())
 
l = 0
result = 'NG'
while l <= B:
  l+=K
  if l >= A:
    result = 'OK'
  
print(result)
# Judge status: Accepted
n, x = map(int, input().split())
ns = list(map(int, input().split()))
ttl = 0
if ns[0] >= x:
    ttl += ns[0] - x
    ns[0] = x
for i in range(n - 1):
    eat = max(0, ns[i]+ns[i+1]-x)
    ttl += eat
    ns[i + 1] -= eat
print(ttl)
# Judge status: Wrong Answer
a,b,c,k=map(int,input().split())
if abs(a-b)<=10**18:
  print(abs(a-b))
else:
  print("Unfair")
# Judge status: Accepted
n,k = map(int,input().split())

if n % k == 0:
    print(0)
else:
    print(1)
# Judge status: Accepted
from decimal import Decimal
from math import floor

def main():
    a, b = map(Decimal,input().split())
    
    print(floor(a*b))
    
main()
# Judge status: Wrong Answer
a,b,c = map(str, input().split())

d = a+b
e = int(d)

f = b+c
g = int(f)


dic = []
dic.append(e+int(c))
dic.append(int(a)+g)
print(max(dic))
# Judge status: Wrong Answer
import numpy as np
n, k = map(int, input().split())
arr = np.array([0] + list(map(int, input().split())) + [0] * 100)

INF = 1 << 60
dp = np.full(arr.shape[0] + 100, INF)

dp[1] = 0

for i in range(1, n + 1):
    dp[i: i + k + 1] = np.minimum(dp[i: i + k + 1], dp[i] + np.abs(arr[i: i + k + 1] - arr[i]))

print(dp[n])
# Judge status: Accepted
a, b, c = map(int, input().split())

if 4*a*b < (c-a-b)**2 and (c-a-b)>0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10**6)
n,k = map(int,input().split())
h = list(map(int, input().split()))

dp = [0] * n
if n > k:
     for i in range(k):
          dp[i]=abs(h[0]-h[i])
     for i in range (k,n):
          for j in range(1,k):
               dp[i] = min(dp[i-k]+abs(h[i-k]-h[i]),dp[i-k-1]+abs(h[i-k-1]-h[i]))

     print(dp[n-1])
else:
     print(min([abs(h[0]-h[i]) for i in range(n)]))
# Judge status: Wrong Answer
#配列準備
N = 3
A = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    A.append(array)

#番号準備
N = int(input())
B = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    B.append(array)

#確認
print("yes")
# Judge status: Accepted
X,A,B = map(int,input().split())

if B-A>=X+1:
  print('dangerous')
elif B-A<=X and A<B:
  print('safe')
elif B<=A:
  print('delicious')
# Judge status: Accepted
N = int(input())
results = ['AC', 'WA', 'TLE', "RE"]
d = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}

for _ in range(N):
	r = input()
	d[r] += 1

for i in range(4):
	print(results[i] + ' x ' + str(d[results[i]]))
# Judge status: Wrong Answer
#45 C - Scc Puzzle
N,M = map(int,input().split())

for i in range(M//2+1):
    if M//N < 2:
        M += 2
        N -= 1
        break   
    M -= 2
    N += 1
if M<2:
    print(0)
else:
    print(N-1)
# Judge status: Wrong Answer
_=int(input())
a=list(map(int,input().split()))

n=max(a)

rc=float('inf')
rd=0
r=0
for i in a:
  if rc>abs(i-n/2):
    r=i
  rc=min(rc,abs(i-n/2))
  
print(n,r)
# Judge status: Wrong Answer
s = list(input())
a, b, c = s.count("a"), s.count("b"), s.count("c")
if abs(a - b) > 1 or abs(a - c) > 1 or abs(b - c) > 1:
    print("No")
else:
    print("YES")
# Judge status: Accepted
A, B, K = map(int, input().split())

A = A - K
if A>=0:
  print(A, B)
  exit()

B = B + A
A = 0

print(A, max(B, 0))
# Judge status: Accepted
N=int(input())
D1,D2=[],[]
for i in range(N):
    d1,d2=map(int,input().split())
    D1.append(d1)
    D2.append(d2)

flag=False
for i in range(2,N):
    if D1[i-2]==D2[i-2] and D1[i-1]==D2[i-1] and D1[i]==D2[i]:
        flag=True
        break

if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import queue

q = [1]
N, M = map(int, input().split())

ans = [-1 for i in range(N+1)]
path = [[] for i in range(N+1)]

for i in range(M):
  A, B = map(int, input().split())
  path[A].append(B)
  path[B].append(A)
COUNTER = 0
while len(q)>0 :
  now = q.pop(0)
  for p in path[now]:
    if ans[p]==-1:
      ans[p]=now
      q.append(p)
      #print(COUNTER, now,p)
      COUNTER+=1
      
print("Yes")
for i in ans[2:]:
  print(i)
# Judge status: Accepted
import sys
input = sys.stdin.readline
def main():
    S = input().rstrip("\r\n")
    T = input().rstrip("\r\n")
    if S == T[:-1] and len(S) + 1 == len(T):
        print("Yes")
    else:
        print("No")
if __name__ == "__main__":
    main()
# Judge status: Accepted
_ = input()
*l, m = sorted(map(int, input().split()))
print("Yes" if sum(l) > m else "No")
# Judge status: Accepted
A=[int(input()) for z in range(6)]
if 2*(2*A[4]+A[3]-A[1]-2*A[0])<5*A[5]:
    print('Yay!')
else:
    print(':(')
# Judge status: Wrong Answer
S = sorted(input())
 
if S == "abc":
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
def comTime(x):
  return (x//10)*10 + 10

def solve(_l):
  s = 0
  l =sorted(_l, key=lambda x: x % 10 if x % 10 != 0 else 10)
  s += sum(map(comTime,l[1:])) + l[0]
  return s
  
_l = [int(input()) for _ in range(5)]
print(solve(_l))
# Judge status: Accepted
n, m = list(map(int, input().split()))
xy = [list(map(int, input().split())) for i in range(m)]

ans = [1] * (n)
ans[0] = 1
ball = [False] * (n)
ball[0] = True
for i in range(m):
    x, y = xy[i]
    ans[y-1] += 1
    ans[x-1] -= 1
    if ball[x-1]:
      ball[y-1] = True
    if ans[x-1] == 0:
      ball[x-1] = False
      
cnt = 0
for i in ball:
  if i:
    cnt += 1

print(cnt)
# Judge status: Wrong Answer
N,K = map(int,input().split())
A = list(map(int,input().split()))

dic = {}

for i in range(N):
    if A[i] in dic:
        dic[A[i]] += 1
    else:
        dic[A[i]] = 1

ks = list(dic.keys())
vs = list(dic.values())

vs.sort()

B = (len(ks))
cnt = 0

for i in range(len(vs)):
    if B > K:
        B -= vs[i]
        cnt += vs[i]
    else:
        break

print(cnt)
# Judge status: Accepted
import math
n,x,t = map(int,input().split())
c = math.ceil(n/x)
print(t*c)
# Judge status: Accepted
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

N=int(input())
# A=list(map(int,input().split()))
A=[int(i) for i in input().split()]

m=0
for a in A:
    m=gcd(a,m)
print(m)
# Judge status: Wrong Answer
A, B =map(int, input().split())
if A==1:
    A=14
if B==1:
    B=14
print("Alice" if A>B else "Bob" if B<A else "Draw")
# Judge status: Accepted
import math
import itertools
import numpy as np

def solve():
    a, b, c, x, y = map(int, input().split())
    case1 = a * x + b * y
    case2 = x * 2 * c + max(0, (y - x) * b)
    case3 = max(0, (x - y) * a) +  y * 2 * c
    case4 = max(x, y) * 2 * c
    print(min(case1, case2,case3,case4))
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
A, B, C = map(int, input().split())

if B//A < C:
  print(B//A)
else:
  print(C)
# Judge status: Accepted
n = int(input())
r = 0
for p in range(2, int(n**0.5)+1):
    e = 0
    while n%p == 0:
       e += 1
       n /= p
    i = 1
    while e >= i:
        e -= i
        r += 1
        i += 1
if n != 1:
    r += 1
print(r)
# Judge status: Accepted
import numpy as np


n = int(input())
A = np.array(list(map(int, input().split())))

res = []
for num in range(-100, 101):
    candidate = (A-num)**2
    res.append(candidate.sum())

print(min(res))
# Judge status: Accepted
N = int(input())

alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',  'i', 'j']

def dfs(st, n, k):
    if n == N:
        print(st)
    else:
        for i in range(k+1):
            if i < k:
                dfs(st + alph[i], n+1, k)
            else:
                dfs(st + alph[i], n+1, k+1)

dfs("", 0, 0)
# Judge status: Accepted
def func(x, n):
  res = 1
  for _ in range(n):
    res = res * x % MOD
  return res

n = int(input())
MOD = 10**9 + 7

ans = func(10, n) - func(9, n) - func(9, n) + func(8, n)
ans %= MOD
print(ans)
# Judge status: Wrong Answer
k,n = map(int,input().split())
a = list(map(int,input().split()))
l = []
l.append(abs(k-abs(a[0]-a[n-1])))
for i in range(n-1):
	l.append(abs(a[i]- a[i+1]))
print(l)
# Judge status: Accepted
n = int(input())
a_list = [int(x) for x in input().split()]
if n % 2 == 0:
    b_list = a_list[n-1::-2] + a_list[0::2]
else:
    b_list = a_list[n-1::-2] + a_list[1::2]
print(*b_list)
# Judge status: Accepted
n,*a=map(int,open(0).read().split());t,w=sum(a),1;w=1;print(sum([1]+[exit(print(-1)) if(w:=min(2*(w-q),t:=t-q))<0 else w for q in a]))
# Judge status: Wrong Answer
n, k = map(int, input().split())
h = list(map(int, input().split()))

if n <= k:
    print(0)
elif k == 0:
    print(sum(h))
else:
    h.sort()
    print(h[:-k])
    print(sum(h[:-k]))
# Judge status: Accepted
a = input()

c = len(a) // 2
if len(a) % 2 == 0:
    x = a[:c]
    y = a[c :]
    z = y[::-1]

else:
    x = a[:c]
    y = a[c + 1:]
    z = y[::-1]

ans = 0

for i in range(len(a)//2):
    if x[i] != z[i]:
        ans += 1

print(ans)
# Judge status: Accepted
N = int(input())
S = input()
if(len(S)%2==0):
    if(S[:len(S)//2]==S[len(S)//2:]):
        print('Yes')
    else:
        print('No')
else:
    print('No')
# Judge status: Wrong Answer
import sys

input = sys.stdin.readline


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

    ans = float("inf")
    for A in range(1, N - 2):
        B = N - A
        total = sum(int(s) for s in str(A)) + sum(int(s) for s in str(B))
        if total < ans:
            ans = total

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
import sys
N, M, K = map(int,input().split())

for m in range(N+1):
  for n in range(M+1):
    if m*M + n*N - 2*m*n == K:
      print("Yes")
      sys.exit()
print("No")
# Judge status: Accepted
n, m = map(int, input().split())
a = list()
for _ in range(n):
    a.append(str(input()))
b = list()
for _ in range(m):
    b.append(str(input()))

for H in range(n if m == 1 else n-m+1):
    for W in range(n if m == 1 else n-m+1):
        cnt = 0
        for M in range(m):
            if a[H+M][0+W:m+W] == b[M]:
                cnt+=1
        if cnt==m:
            print('Yes')
            exit()

print('No')
# Judge status: Accepted
from collections import deque

n,m = map(int, input().split())
dic = {} 

for i in range(m):
  a,b = map(int,input().split())
  
  dic.setdefault(a,[])
  dic.setdefault(b,[])

  dic[a].append(b)
  dic[b].append(a)

array = [-1] * (n+1)

d = deque()
d.append(1)

while len(d) != 0:
  tmp = d.popleft()
  arr = dic.get(tmp, [])
  
  for v in arr:
    if array[v] == -1:
      array[v] = tmp
      d.append(v)
      
print('Yes')
for i in range(2,n+1):
  print(array[i])
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ans = []
a.sort(reverse=True)
key = a[0]
i = 1
while True:
    if i > n-1:
        break
    if len(ans) == 2:
        break
    if a[i] == key:
        i += 1
        ans.append(key)
        if i > n-1:
            break
        key = a[i]
    else:
        key = a[i]
    i += 1


if len(ans) != 2:
    print(0)
else:
    print(ans[0]*ans[1])
# Judge status: Accepted
import math

count = 0
L,R,d = list(map(int,input().split()))
c = math.ceil(L/d)
p = math.floor(R/d)
print(p-c+1)
# Judge status: Accepted
N, M = map(int, input().split())

S = N
c = M // 2

print(min((S + c) // 2, c))
# Judge status: Accepted
s=input()
print("Yes" if s[2]==s[3] and s[4]==s[5] else "No")
# Judge status: Accepted
MAX = 35
N = int(input())
ans = 1
for i in range(2,MAX+1):
  t = i*i
  while t <= N:
    ans = max(ans,t)
    t *= i
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A = map( lambda x:x//400, A)
A = list(map( lambda x:x if x<8 else 8, A))
cnt8 = A.count(8)
A = list(sorted(set(A)))
if 8 in A:
    A.remove(8)
sum = len(A)
if sum > cnt8:
    print(sum, end=' ')
else:
    print(cnt8, end=' ')
sum += cnt8
if sum > 8:
    print(8)
else:
    print(sum)
# Judge status: Wrong Answer
n = int(input())
A = []
maximum = 0
maximum_idx = 0
for i in range(n):
    a = int(input())
    A.append(a)
    if a > maximum:
        maximum = a
        maximum_idx = i

for i in range(n):
    if i != maximum_idx:
        print(maximum)
    else:
        print(sorted(A)[1])
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for _ in range(n)]

dp = [0] * n
dp[0] = a[0] // 2
for i in range(1, n):
    if dp[i] < dp[i-1] + a[i] // 2:
        dp[i] = dp[i-1] + a[i] // 2
    if dp[i] < min(a[i-1], a[i]):
        dp[i] = min(a[i-1], a[i])
        a[i] -= min(a[i-1], a[i])

print(dp[-1])
# Judge status: Wrong Answer
import sys

n, a, b = map(int, input().split())

if a >= b:
	print(0)
	sys.exit()
if n < 2:
	print(0)
	sys.exit()

print((b-a)*(n-2)+1)
# Judge status: Wrong Answer
s = input()
length = len(s)

maxlen = 0
for i in range(length//2-1):
  if s[0:(i+1)] == s[(i+1):2*(i+1)]:
    maxlen = 2*i
    
print(maxlen)
# Judge status: Accepted
if __name__ == '__main__':
    s = input()
    for i in range(1,len(s)):
        s2 = s[:len(s)-i]
        count =0
        if len(s2) % 2 ==0:
            for j in range(len(s2)// 2):
                if s2[j] == s2[len(s2)// 2 + j]:
                    count+=1


            if count == len(s2)//2:
                print(len(s2))
                break
# Judge status: Accepted
n = int(input())
s = input()
count = 0
ans = 0
for i in range(0, n - 1):
    x = list(s[:i + 1])
    y = list(s[i + 1:])
    for c in range(ord('a'), ord('z') + 1):
        if chr(c) in x and chr(c) in y:
            count += 1
    if ans < count:
        ans = count
    count = 0
print(ans)
# Judge status: Accepted
d =int(input())
c = list(map(int, input().split())) 
s = []
t = []

d_l = []
score = 0
soft = 0

for i in range(d):
    s.append(0)
    s[i] = list(map(int, input().split()))

for i in range(26):
    d_l.append(0)
    
for i in range(d):
    t_max = max(s[i])
    t = s[i].index(t_max)
    print(t + 1)
# Judge status: Wrong Answer
n = int(input())
X = [list(map(int,input().split())) for _ in range(n)]
X.sort()
right = X[0][0]+X[0][1]
ans = n
for i in range(1,n):
    left = X[i][0]-X[i][1]
    if left < right:
        ans -= 1
    else:
        right = left
print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
A.sort(reverse=True)
if (A[M-1] * 4 * M) < S:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
A,B=map(int,input().split())
S=input()
num=[str(k) for k in range(10)]

for i in range(A):
  if S[i] not in num:
    print('No')
    exit()
    
if S[A]!='-':
  print('No')
  exit()
  
for j in range(A+1,A+B):
  if S[j] not in num:
    print('No')
    exit()
    
print('Yes')
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[15]:


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


# In[17]:


total = sum(A)
ans = total
left = 0
for i in A:
    left += i
    right = total - left
    ans = min(ans, abs(left - right))
#     print(left, right, ans)
print(ans)


# In[ ]:
# Judge status: Accepted
a,b = map(int,input().split())


if  a < 10 and b < 10:
    print(a*b)
else:
    print(-1)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from math import floor
def main():
    x = int(readline())
    a = 100
    i = 0
    while a < x:
        a =  floor(a*(1.01))
        i+=1
    print(i)
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
k,a,b = map(int,input().split())
dif = b-a
if b<=2:
  print(k)
else:
  ans = dif*(k//2)
  ans += (k%2==1)
  print(ans)