peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import math
f = True
N = int(input())
for i in range(N+1):
    if math.floor(i*1.08) == N:
        print(i)
        f = False
        break
if f:
    print(":(")
# Judge status: Accepted
s = input()
Answer = min(s.count('0'),s.count('1'))*2
print(Answer)
# Judge status: Wrong Answer
import numpy as np
n = int(input())
for i in range(n, 1, -1):
    if np.sqrt(i) % 1 == 0:
        print(i)
        break
# Judge status: Accepted
_ = input()
S = input()

print(max(len(set(S[:i]) & set(S[i:])) for i in range(len(S))))
# Judge status: Accepted
N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]
cnt = 0
for i in range(N-1,-1,-1):
    a = (-A[i][0]-cnt)%A[i][1]
    cnt += a
print(cnt)
# Judge status: Accepted
n,k = map(int,input().split())

s = list(input())
t = ''
for j,i in enumerate(s):
    if j == k-1:t += i.lower()
    else:t+=i
print(t)
# Judge status: Accepted
import sys
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())

Q, H, S, D = MAP()
N = INT()

l = [(Decimal(0.25), Q, 0.25/Q), (Decimal(0.5), H, 0.5/H), (1, S, 1/S), (2, D, 2/D)]
l.sort(key=lambda x:x[2], reverse=True)
ans = 0
idx = 0
while N != 0:
	n = N//l[idx][0]
	ans += l[idx][1]*n
	N -= l[idx][0]*n

	idx += 1

print(ans)
# Judge status: Accepted
d,n=map(int, input().split())
if n != 100:
    print(n*100**d)
else:
    print(101*100**d)
# Judge status: Wrong Answer
def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)
      
def lcm(a,b):
  return a*b//gcd(a,b)

n = int(input())
t = []
for i in range(n):
  t.append(int(input()))
  
answer = 0
for index, tt in enumerate(sorted(t)):
  if index + 1 == len(t):
    continue
  lc = lcm(tt, t[index+1])
  if lc > answer:
    answer = lc
print(answer)
# Judge status: Wrong Answer
import math
a,b,h,m = map(int,input().split())
deg = h*30+m*0.5-m*60
if deg <0:
    deg = -deg
elif deg>180:
    deg = 360-deg
bb = b*math.sin(math.radians(deg))
aa = a-b*math.cos(math.radians(deg))
print(math.sqrt((aa**2)+(bb**2)))
# Judge status: Accepted
n, r = map(int, input().split())
if n <= 10:
    print(r + 100 * (10 - n))
else:
    print(r)
# Judge status: Accepted
import math
N, M = map(int, input().split())

if N == 1:
  print(M)
  exit()

ans = 1

for a in range(1, int(math.sqrt(M))+1):
  b = M // a
  if M % a != 0:
    continue

  if a * N <= M:
    ans = max(ans, a)
  
  if b * N <= M:
    ans = max(ans, b)

print(ans)
# Judge status: Accepted
n, a, b = map(int, input().split())
if a % 2 == b % 2:
    print(abs(a-b)//2)
else:
    print(min(a-1, n-b)+1+((b-a)//2))
    # print(min(a-1, n-b))
    # print(1)
    # print(((b-a)//2))
# Judge status: Accepted
a,b,c = [int(i) for i in input().split()]

if (b-a) == (c-b):
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
import heapq
n , m = map(int, input().split())
ab=[[] for i in range(10**5)]

for i in range(n):
    a , b = map(int, input().split())
    ab[a-1].append(b*(-1))

que=[]
c=0
while que==[] and c<m:
    if ab[c]!=[]:
        que=ab[c]
    c+=1

heapq.heapify(que)
ans = 0
for i in range(m):
    if i>=c:
        que=list(heapq.merge(que,ab[i]))
    if que:
        ans+=heapq.heappop(que)
print(ans*(-1))
# Judge status: Accepted
a, b = map(int, input().split())

amari = a * b % 2

if amari == 0:
  print('Even')
else:
  print('Odd')
# Judge status: Accepted
N = int(input())
paper = set()
A = 0
for _ in range(N):
    A = int(input())
    if A in paper:
        paper.discard(A)
    else:
        paper.add(A)
print(len(paper))
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n, k = map(int, input().split())
    a = 0
    while n > 0:
        a += 1
        n /= k
    print(a)
    return


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n, x = map(int, input().split())
a = list(map(int, input().split()))

r = 0
for i in range(1, n):
  if a[i] + a[i-1] > x:
    r += abs(a[i]+a[i-1] - x)
  a[i] = a[i] - r  
  if a[i] < 0:
    a[i-1] += a[i]
    a[i] = 0
    
print(r)
# Judge status: Accepted

a = input()
l = list(map(int,input().split()))
ans = 1
if 0 in l:
    print(0)
    exit()
for i in l:
    ans *= i
    if ans>10**18:
        print(-1)
        exit()
if ans > 10**18:
    ans=-1
print(ans)
# Judge status: Accepted
#

import sys
input=sys.stdin.readline

def main():
    num="0123456789"
    A,B=map(int,input().split())
    S=input()
    sn=S[:A]+S[A+1:A+B+1]
    y=1
    for i in sn:
        if not i in num:
            y=0
            break
    if S[A]!="-":
        y=0
    if y==1:
        print("Yes")
    else:
        print("No")
    
if __name__=="__main__":
    main()
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
cnt4 = 0
cnt2 = 0
other = 0
for a in A:
    if a % 4 == 0:
        cnt4 += 1
        continue
    if a % 2 == 0:
        cnt2 += 1
    else:
        other += 1
if cnt4+1 >= cnt2 + other or cnt4 >= other:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n-1):
    if p[i] - 1 == i:
        count += 1
        p[i] ,p[i + 1] = p[i + 1], p[i]
if p[n - 1] - 1 == n - 1:
    count += 1
print(count)
# Judge status: Wrong Answer
N = int(input())
X_s = tuple(map(int,input().split()))
MIN = 10**5
for i in range(1,101):
  SUM = sum(tuple(map(lambda x:(x-i)**2, X_s)))
  if MIN > SUM:
    MIN = SUM
print(MIN)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
x = 0
for a_i in a:
  x ^= a_i
for a_i in a:
  print(x ^ a_i)
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A-2*B >=1 and  (A-2*B)%2==0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
h = int(input())
w = int(input())
n = int(input())

for i in range(1, 100000):
    if h * i >= n or w * i >= n:
        print(i)
        exit()
# Judge status: Accepted
a = list(map(int,input().split()))
print(a[2],a[0],a[1],sep=" ")
# Judge status: Wrong Answer
from heapq import heappush, heappop, heapify
import numpy as np
N, M = map(int,input().split())
A = list(map(int,input().split()))
A = np.array(A)
A = -A
A = list(A)
for _ in range(M):
    heapify(A)
    s = heappop(A)
    heappush(A, -(-s // 2))
    print(s)
A = np.array(A)
print(-int(np.sum(A)))
# Judge status: Accepted
h1, m1, h2, m2, k = map(int, input().split())
if m1 > m2:
    print(((h2 - 1) - h1) * 60 + (m2 + 60 - m1) - k) 
else:
    print((h2 - h1) * 60 + (m2 - m1) - k)
# Judge status: Accepted
N,X,T = map(int, input().split())

if N%X == 0:
    print(N//X*T)
else:
    print((N//X+1)*T)
# Judge status: Wrong Answer
#a = input()
a, b, c, d, e = map(int, input().split())
# get a string
#s = raw_input()
# output
start = a*60+b
end = c*60+d
result = end - start
print(result)
# Judge status: Accepted
from math import sqrt

N, D = map(int, input().split())
X = []
for _ in range(N):
    x = list(map(int, input().split()))
    X.append(x)

ans = 0
for i in range(0, N):
    for j in range(i + 1, N):
        res = 0
        for x1, x2 in zip(X[i], X[j]):
            res += (x1 - x2) ** 2
        res = sqrt(res)
        if (res == round(res)):
            ans += 1

print(ans)
# Judge status: Accepted
X, A, B = map(int, input().split())
if B - A <= 0:
  print('delicious')
elif X >= B - A > 0:
  print('safe')
else:
  print('dangerous')
# Judge status: Accepted
def solve(a,k):
    curr_char = a[0]
    curr_len = 0
    segs = 1
    for x in a:
        if x==curr_char:
            curr_len += 1
        else:
            segs += 1
            curr_len = 1
            curr_char = x
    return len(a)-max(1,segs-2*k)
n,k = map(int,input().split())
print(solve([1 if c=='L' else 0 for c in input()],k))
# Judge status: Wrong Answer
# coding: utf-8
if __name__ == '__main__':
    dic = dict()
    n = int(input())
    for i in range(n):
        val = input()
        if val in dic.keys():
            dic[val]+=1
        else:
            dic[val]=1
    max_keys = max(dic.values())
    values_of_max_key = [val for val in dic if dic[val] == max_keys]
    for s in values_of_max_key:
        print(s)
# Judge status: Wrong Answer
n, m = map(int, input().split())

ab = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    ab[a-1].append(b)
    ab[b-1].append(a)

for i in ab[0]:
    if n in ab[i-1]:
        print('POSSIBLE')
        exit()
print('INPOSSIBLE')
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
s=max(a,b,c)
m=3*s-(a+b+c)
if m%2:print(m//2+1)
else:print(m//2)
# Judge status: Accepted
n = int(input())
t=0
x=0
y=0
ans ="Yes"
for i in range(n):
  tt,xx,yy = map(int,input().split())
  dif = abs(x-xx)
  dif +=abs(y-yy)
  if dif>(tt-t) or dif%2 !=(tt-t)%2:
    ans = "No"
    break;
  t=tt
  x=xx
  y=yy
print(ans)
# Judge status: Accepted
#!/usr/bin/env python

def main():
    k, s = list(map(int, input().split()))

    ans = 0
    for x in range(k+1):
        for y in range(k+1):
            z = s - x - y
            if z >= 0 and z <= k:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
s=input().strip()
flg=True

s=s[:-2]
while len(s)>=2:
    for i in range(len(s)//2):
        if s[i]!=s[len(s)//2+i]:
            flg=False
    if flg:
        print(s)
        exit()
    s=s[:-2]
    flg=True
# Judge status: Wrong Answer
#133 b
import itertools
n,d=map(int,input().split())
N=[i for i in range(n)]
k=[i*i for i in range(2,100)]
x=[]
for i in range(n):
    a=list(map(int,input().split()))
    x.append(a)
ans=0
kumi=itertools.combinations(N,2)

for a,b in kumi:
    s=0
    for j in range(d):
        s+=(x[a][j]-x[b][j])**2
    if s in k:
        ans+=1
print(ans)
# Judge status: Wrong Answer
N,D = map(int, input().split())
count = 0
i = 0
while i < N:
  i += 2*D+1
  count +=1
print(count+1)
# Judge status: Accepted
N, x = map(int,input().split())
a = list(map(int,input().split()))
res = 0
if a[0]>x:
    res += a[0]-x
    a[0] = x
if a[-1]>x:
    res += a[-1]-x
    a[-1] = x

for i in range(1,N):
    tmp = a[i]+a[i-1]
    if tmp>x:
        res += tmp-x
        a[i] -= tmp-x
print(res)
# Judge status: Accepted
x = input()
st = [ 'Sunny' , 'Cloudy' , 'Rainy' ]
print(st[(st.index(x) + 1) % 3])
# Judge status: Accepted
S = input()

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]: print('Bad')
else: print('Good')
# Judge status: Accepted
n, t = map(int, input().split())
ans = 2000

for i in range(n):
    ci, ti = map(int, input().split())
    if ti <= t:
        ans = min(ans, ci)

if ans == 2000:
    print("TLE")
else:
    print(ans)
# Judge status: Accepted
from operator import mul
from functools import reduce
mod = 10**9+7
    
def nCr(n, r, mod):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
    

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

ans = pow(2, n, mod) - 1

print((ans - nCr(n, a, mod) - nCr(n, b, mod)) % mod)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))

ans = 0
for i in range(n-1):
    if p[i] == i+1 or p[i+1] == i+2:
        p[i],p[i+1] = p[i+1],p[i]
        ans += 1
if p[n-1] == n:
    p[n-1],p[n-2] = p[n-2],p[n-1]
print(ans)
# Judge status: Accepted
n = int(input())
s = list(input())
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r * g * b
for i in range(n-2):
    for j in range(i+1,n-1):
        if (j - i) + j < n:
            k = (j - i) + j
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans -= 1
print(ans)
# Judge status: Wrong Answer
# https://atcoder.jp/contests/abc133/tasks/abc133_c

l, r = map(int, input().split())

dp = [0] * 2019 
for i in range(2019 * 3):
    n = l + i
    if n <= r:
        m = n % 2019
        dp[m] += 1
    else:
        break

ans = 1
c = 0
i = 0
while i < len(dp):
    if dp[i]:
        ans *= i
        dp[i] -= 1
        c += 1
    else:
        i += 1
    if c == 2:
        break
print(ans)
# Judge status: Accepted
k = int(input())
a, b = map(int, input().split())
if a % k == 0 or b % k == 0:
    print("OK")
else:
    if b // k - a // k > 0:
        print("OK")
    else:
        print("NG")
# Judge status: Accepted
#6
N = int(input())
a = sorted(list(map(int, input().split())))
Alice_list = []
Bob_list = []
for i in range(1, N+1):
    if i%2==1:     
        Alice_list.append(a[-i])
    else:
        Bob_list.append(a[-i])
print(sum(Alice_list)-sum(Bob_list))
# Judge status: Wrong Answer
a,b,k = map(int,input().split(" "))

count = 0
for i in range(101,1,-1):
    if a%i == 0 and b%i ==0:
        count += 1
    if count == k:
        print(i)
        break
# Judge status: Wrong Answer
import math
f = math.factorial
_, *a = map(int, open(0).read().split())
a.sort()
n = a.pop(-1)
r = sorted((abs(n/2 - i), i) for i in a)[0][1]
print(f(n) // (f(n-r) * f(r)))
# Judge status: Accepted
w,a,b = list(map(int,input().split()))

ans = b-(a+w) if a <= b else a-(b+w)
print(ans if ans >= 0 else 0)
# Judge status: Accepted
import math

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

mi = min(A)
cnt = A.count(mi)
print(math.ceil((n-cnt)/(k-1)))
# Judge status: Accepted
a,b,c,d = map(int,input().split())


while(1):
    c -= b
    if(c <= 0):
        print('Yes')
        exit()
    a -= d
    if(a <= 0):
        print('No')
        exit()
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]

dp=[1]+['']*n

for i in a:
  dp[i]=0

if dp[1]=='':
  dp[1]=1
  

for i in range(2,n+1):
  if dp[i]=='':
    dp[i]=dp[i-1]+dp[i-2]

print(dp[-1])
# Judge status: Accepted
n=str(input())
print("YES" if n in "753" else "NO")
# Judge status: Wrong Answer
n,d  = list(map(int,input().split()))
print(n//(d+d+1))
# Judge status: Accepted
n, m = map(int, input().split())
homework_cost = list(map(int, input().split()))
sum = 0
for i in range(len(homework_cost)):
    sum += homework_cost[i]
if n - sum >= 0:
    print(n - sum )
else:
    print(-1)
# Judge status: Accepted
n = int(input())
b = list(map(int, input().split()))

ans = b[0] + b[n-2]
for i in range(n-2):
    ans += min(b[i], b[i+1])
print(ans)
# Judge status: Wrong Answer
from sys import stdin
input = stdin.readline

X, K, D = map(int, input().split())

m = X % D
l = X // D

if D - m < m:
    m = D - m
    l += 1

if l > K:
    print(abs(X) - D * K)
else:
    if (K - l) % 2 == 0:
        print(m)
    else:
        print(D - m)
# Judge status: Accepted
sx,sy,tx,ty = map(int,input().split())
U,D,L,R = 'U','D','L','R'
dx,dy = tx-sx,ty-sy
ans = R*dx+U*dy + L*dx+D*(dy+1) + R*(dx+1)+U*(dy+1)+L +U+L*(dx+1)+D*(dy+1)+R
print(ans)
# Judge status: Accepted
l,r = map(int,input().split())
cnt = 0
mod_list = []
if r- l >=2019:
    print(0)
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            mod_list.append(i*j%2019)
    print(min(mod_list))
# Judge status: Wrong Answer
x,y=map(int,input().split())
print(x if x!=y else 0)
# Judge status: Accepted
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    s = IS()
    minv = 10**5
    for i in range(len(s)-2):
        d = int(s[i:i+3])
        minv = min(minv, abs(753-d))
    print(minv)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
sum = 0

for i in range(1,n+1,1):
  if(i%3 == 0 or i%5 == 0):
    continue
  sum += i
  
print(sum)
# Judge status: Accepted
a,b,c,d = map(int,input().split())
A = set()
B = set()
A.add(a)
A.add(b)
B.add(c)
B.add(d)
for i in {-1,0,1}:
    A.add(i)
    B.add(i)

o = set()
for j in A:
    for k in B:
        if a <= j <= b and c <= k <= d:
            o.add(j*k)
print(max(o))
# Judge status: Accepted
N, M = map(int,input().split())
ans = [0 for i in range(N)]

for i in range(M):
    ab = list(map(int,input().split()))
    ans[ab[0]-1] += 1
    ans[ab[1]-1] += 1

for i in range(N):
    print(ans[i])
# Judge status: Wrong Answer
import numpy as np
from decimal import *
getcontext().prec = 6
a,b,c = map(int,input().split())
if Decimal(a**0.5)+Decimal(b**0.5) < Decimal(c**0.5):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#https://atcoder.jp/contests/abc085/tasks/abc085_d
import math
N, H = map(int, input().split(' '))
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split(' '))
    A.append(a)
    B.append(b)
max_A = max(A)
B = sorted(B, reverse=True)
ans = H
for k in range(N):
    H -= B[k]
    if H > 0:
        cnt = math.ceil(H / max_A) + (k + 1)
    else:
        cnt = k + 1
    ans = min(ans, cnt)
print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()

ruisekisa = [0]*(M-1)
for i in range(0,M-1,1):
    ruisekisa[i]=X[i+1]-X[i]

ruisekisa.sort()
print(sum(ruisekisa[0:max(M-N,0)]))#負方向のout index が変な挙動するのよ
# Judge status: Accepted
X,N = map(int,input().split())

if N == 0:
  print(X)
elif N == 100:
  if X > 50:  
    print(101)
  else:
    print(0)
else:
  List = list(map(int,input().split()))
  List.sort()

  c = 10 ** 10
  ans = 1000

  for i in range(-100,200):
    if not i in List:
      if abs(i - X) < c:
        c = abs(i-X)
        ans = i
      
  print(int(ans))
# Judge status: Accepted
sx,sy,tx,ty = map(int,input().split())

S = ""
for k in range(2):
    if k == 1:
        S += "L"
    for i in range(ty-sy+k):
        S += "U"
    for i in range(tx-sx+k):
        S += "R"
    if k == 1:
        S += "DR"
    for i in range(ty-sy+k):
        S += "D"
    for i in range(tx-sx+k):
        S += "L"
    if k == 1:
        S += "U"

print(S)
# Judge status: Wrong Answer
n = int(input())
print(int(n * (n - 1) / 2))
# Judge status: Wrong Answer
import re
s = input().replace('?', '.')
t = input()
for i in range(len(s)-len(t)+1):
  if re.match(s[i:i+len(t)], t):
    print(s[:i].replace('.','a')+t+s[i+len(t):].replace('.','a'))
    break
else:
  print('UNRESTORABLE')
# Judge status: Accepted
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
x,y = map(int,input().split())
if (x in a and y in a) or (x in b and y in b):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
A,B,C=map(int, input().split()) #1 2 3

if (A == B and A != C) or (A != B and A == C):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
a,b,k=map(int,input().split())
if b-a>=k*2-1:
    for i in range(k):
        print(a+i)
    for i in range(k):
        print(b+1-(k-i))
else:
    for j in range(a,b+1):
        print(j)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math


def main():
    N = int(input())
    print(2**int(math.log2(N)))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 6)

def main():
    S = input()
    T = input()
    same = set()
    for i in range(len(S)):
        if S[i] == T[i]:
            same.add(S[i])

    for i in range(len(S)):
        if S[i] != T[i]:
            if S[i] in same or T[i] in same:
                print('No')
                exit()
    
    print('Yes')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
S = list(input())

if S[0] == 'A':
  isC = 0
  for i in S[2:len(S)]:
    if i == 'C':
      isC += 1
  else:
    if isC == 1:
      for i in range(len(S)):
        if S[i] == 'A' or S[i] =='C' or S[i].islower():
          pass
        else:
          print('WA')
          break
      else:
        print('AC')
    else:
      print('WA')
else:
  print('WA')
# Judge status: Accepted
n = list(map(int,input().split()))
print(n.index(0)+1)
# Judge status: Wrong Answer
from math import ceil

N,K=map(int,input().split())
*A,=map(int,input().split())

def C(x):
  return sum([A[i]//x for i in range(N)]) <= K
  
def binary_search2(func, n_min, n_max):
    left,right=n_min,n_max
    y_left, y_right = func(left), func(right)
    while True:
        middle = (left+right)//2
        y_middle = func(middle)
        if y_left==y_middle: left=middle
        else: right=middle
        if right-left==1:break

    return left
  
print(binary_search2(C, 1, max(A))+1)
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
print(a-k,b) if a>=k else print(0-b-k+a) if k<=a+b else print(0,0)
# Judge status: Wrong Answer
s=input()
c=0
for i in range(0, 3):
    if s[i]=="1":
        c+=1

print(c)
# Judge status: Accepted
[a,b] = [int(i) for i in input().split()]
print(a*b)
# Judge status: Accepted
from functools import lru_cache
N = int(input())
@lru_cache(86)
def lucas(x):
  if x == 0:
    return 2
  if  x ==1:
    return 1
  else:
  
    return lucas(x-1) + lucas(x-2)
print(lucas(N))
# Judge status: Accepted
n = int(input())
lis = list(map(int, input().split()))

lis  =sorted(lis)

t1 = sum(lis[n:2*n])
#print(sum(t1))

nlis = lis[::-1]

t2 = 0
for i in nlis[1:2*n:2]:
    t2 += i


print(max(t1, t2))
# Judge status: Wrong Answer
n=int(input())
ma=2
mi=10**9
mu=2
me=10**9
for i in range(n):
    x,y=map(int,input().split())
    l=x+y
    s=-x+10**9+y
    ma=max(ma,l)
    mi=min(mi,l)
    mu=max(mu,s)
    me=min(me,s)
print(max(ma-mi,mu-me))
# Judge status: Accepted
import sys
N, K = map(int, input().split())
As = [0] + list(map(int, input().split()))
# print(As)
d = [-1]*(N+1)
i = 1
step = 1
while step <= K:
	# print("step: {}, idx: {}".format(step,i))
	next_i = As[i]
	if d[next_i] != -1:
		freq = step - d[next_i]
		step = step + ((K - step) // freq)*freq
	d[next_i] = step
	step += 1
	i = next_i
 
print(i)
# Judge status: Accepted
N = int(input())
A = int(input())

if N%500 <= A:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    n=len(s)
    A=[0]*(n+1)
    for i in range(0,n):
        if s[i]=="<":
            A[i+1]=A[i]+1
    for i in range(n,1,-1):
        if s[i-1]==">":
            A[i-1]=max(A[i-1],A[i]+1)
    print(sum(A))

if __name__=='__main__':
    main()
# Judge status: Accepted
s = list(set(input()))
l = [["N","S"], ["W","E"], ["N", "S", "W", "E"]]
if len(s) != 2 and len(s) != 4:
    print("No")
    exit()
for i in l:
    x = 0
    for j in s:
        if j in i:
            x += 1
    if x == len(i):
        print("Yes")
        exit()
print("No")
# Judge status: Wrong Answer
def test_if(X):
  40 >= X >= -40
  if X <= 29:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
a, b = map(int, input().split())
s = []
for i in range(1, 999+1):
  s.append(i * (i + 1) // 2)

i = 1
while True:
  if s.count(a + i) == 1:
    print(i)
    exit()
  i += 1
# Judge status: Wrong Answer
a, b = map(int, input().split())
x = [i  *(i + 1) // 2 for i in range(1, 1000)]
for i in x:
    if a <  i < b and i - a == b - i:
        print(i - a)
        break
# Judge status: Accepted
A, B = map(int, input().split())
print(A + B if A + B < 24 else A + B - 24)
# Judge status: Accepted
# A - Red or Not

# 整数 a の入力
a = int(input())

# 文字列 s の入力
s = input()

# print(a)
# print(s)

if a >= 3200:
    print(s)
else:
    print('red')
# Judge status: Accepted
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    N = NI()
    D = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
    for i in range(N):
        D[SI()] += 1
    for x, y in D.items():
        print("{0} x {1}".format(x, y))


if __name__ == "__main__":
    main()
# Judge status: Accepted
print("bust" if sum(map(int, input().split())) > 21 else "win")
# Judge status: Accepted
n=int(input())
s=input()
ans,p=0,0
for i in range(n-1):
    sets=list(set(s[:i+1]))
    if ans>p:
        p=ans
    ans=0
    for j in range(len(sets)):
        if sets[j] in s[i+1:]:
            ans+=1
        
print(p)
# Judge status: Accepted
N, L = map(int,input().split())
S=[]
for i in range(N):
    s=input()
    S.append(s)

S=sorted(S)
ans=S[0]
for j in range(1,N):
    ans+=S[j]

print(ans)