peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
# coding: utf-8
# Your code here!
cost=list(map(int,input().split()))

for i in range(4):
    cost[i]/=2**(i-2)

N=int(input())

if min(cost)==cost[3]:
    print(((N//2*2)*cost[3]+(N%2)*min(cost[:3])))
else:
    print((min(cost)*N))
# Judge status: Accepted
n = int(input())
mod = 10**9 + 7
a = (10**n + 8**n - 2*9**n)
print(a%mod)
# Judge status: Accepted
N=int(input())

ans_list=[]
sgn=1
for i in range(100):
  if N%2==1:
    ans_list.append("1")
    N-=sgn
  else:
    ans_list.append("0")
    
  N//=2
  sgn*=-1
  if N==0:
    break
  
print("".join(reversed(ans_list)))
# Judge status: Accepted
N, K = list(map(int, input().split(' ')))
count = 1
com_val = K
while com_val <= N:
    count += 1
    com_val = pow(K, count)
print(count)
# Judge status: Accepted
# -*- coding: utf-8 -*-


#----------
n = int(input().strip())
a_list = list(map(int, input().rstrip().split()))
#----------
a_list.sort()
a2_list = a_list[n:]

sum=0
for i in range( 0,len(a2_list),2 ):
    sum += a2_list[i]

print(sum)
# Judge status: Wrong Answer
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    print(yp[i][1])
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))
# Judge status: Wrong Answer
N,a,b=input().split()
N=int(N)
a=int(a)
b=int(b)

LIM=10**9+7

hana=0
C=N
for i in range(1,N+1):
  #print(i, C%LIM, hana)
  if(i==a or i==b):
    C=C*(N-i)//(i)
    continue
  else:
    if(hana > LIM):
      hana = hana % LIM
    hana += hana + C%LIM
    C=C*(N-i)//(i)

if(hana > LIM):
  hana = hana % LIM
print(hana)
# Judge status: Accepted
N,K=map(int,input().split())
count=0
while N!=0:
    N=N//K
    count+=1
print(count)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print("YES" if a < b < c else "NO")
# Judge status: Accepted
T = input()
T = T.replace("?","D")

print(T)
# Judge status: Wrong Answer
a=list(map(int,input().split()))
a.sort()
print(a[0]*2+a[1])
# Judge status: Accepted
N,P = map(int,input().split())
A = list(map(int,input().split()))
if all(a%2==0 for a in A):
    print(0 if P else 2**N)
else:
    print(2**(N-1))
# Judge status: Accepted
n = int(input())
dic = {}
for i in range(n):
    a = int(input())
    dic[i] = a-1
already = set()
already.add(0)
cur = 0
count = 0
while True:
    cur = dic[cur]
    count += 1
    if cur == 1:
        print(count)
        break
    if cur in already:
        print(-1)
        break
    already.add(cur)
# Judge status: Accepted
# -*- coding: utf-8 -*-
a, b, h = map(int, open(0))


print((a + b) * h >> 1)
# Judge status: Wrong Answer
r, g, b = map(int, input().split(" "))

n = 100 * r + 10 * g + b

if n % 4 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n=int(input())
A=list(map(int,input().split()))
ans=2
if len(set(A))==1:
    print(A[0])
else:
    for a in A:
        if a%2==1:
            ans=1
    print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
Py = []
for i in range(m):
    py = list(map(int, input().split()))
    Py.append(py+[i])
Py = sorted(sorted(Py, key = lambda x: x[1]))
tmp = -1
ans = []
for i in range(m):
    out = str(Py[i][0]).zfill(6)
    cnt = cnt + 1 if Py[i][0] == tmp else 1
    out += str(cnt).zfill(6)
    tmp = Py[i][0]
    ans.append([Py[i][2], out])
ans.sort()
for i in range(m):
    print(ans[i][1])
# Judge status: Wrong Answer
x = int(input())
y = x % 11
if y > 0:
    cnt = 1
    if y > 6:
        cnt += 1
else:
    cnt = 0
    
print(x // 11 + cnt)
# Judge status: Wrong Answer
list=[int(input()) for i in range(5)]
sum=0
max=0
for x in list:
  y = -(-x//10)*10
  sum+=y
  max=(y-x, max)
# Judge status: Accepted
a = list(map(int,input().split()))
print(a[2]*60+a[3]-a[0]*60-a[1]-a[4])
# Judge status: Accepted
n,m=map(int,input().split())
G=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)

for g in G:
    island_1=False
    island_n=False
    for gg in g:
        if gg==0:
            island_1=True
        if gg==n-1:
            island_n=True
    if island_1==True and island_n==True: 
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')
# Judge status: Accepted
a,b,x = map(int,input().split())

if a <= x <= a + b:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
#Small and Large Integers
A,B,K = map(int,input().split())
L = []
for i in range(K):
    if A+i <= B: 
        L.append(A+i)
    if A <= B-i:
        L.append(B-i)

S = set(L)
L = list(S)
for i in range(len(L)):
    print(L[i])
# Judge status: Accepted


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    S = input()
    if 'RRR' in S:
        return 3
    if 'RR' in S:
        return 2
    if 'R' in S:
        return 1
    return 0


if __name__ == '__main__':
    print(solve())
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

# dp table
INF = float('inf')
dp = [INF]*N
dp[0] = 0
inc, dec = 0, 0

for i in range(1,N):
    if A[i] >= A[i-1]:
        inc += 1
    else:
        inc = 1
    if A[i] <= A[i-1]:
        dec += 1
    else:
        dec = 1
    dp[i] = min(dp[i-inc] + 1, dp[i-dec] + 1)
print(dp[N-1])
# Judge status: Accepted
N = int(input())
a = [int(input()) for i in range(N)]
now = 1
ans = -1
for k in range(N):
    now = a[now-1]
    if now ==2:
        ans = k +1
        break
    
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
ans=0
for i in range(n):
    if ans+1==a[i]:
        ans+=1
if ans==0:
    ans=n+1
print(n-ans)
# Judge status: Wrong Answer
s = input()
for i in range(1, len(s), 2):
    a = s[:-i]
    if a[:len(a)//2]==a[len(a)//2:]:
        print(len(a))
        exit()
# Judge status: Accepted
a, b = map(int, input().split())
print(((a+b)+1)//2)
# Judge status: Accepted
import math
n,d = map(int,input().split())
l = []
for i in range(n):
  r = list(map(int,input().split()))
  l.append(r)
f = []
for i in range(n-1):
  for j in range(i+1,n):
    e = []
    for k in range(d):
      e.append((l[i][k]-l[j][k])**2)
    f.append(sum(e))
count = 0
for i in f:
  if math.sqrt(i).is_integer():
    count += 1
print(count)
# Judge status: Wrong Answer
a=int(input())
i=100
f=0
while i/a<=1:
  i=int(i*1.01)
  f=f+1
  if a/i>10000000000000000:
    i=i*1004291331219645824
    f=f+3760
print(f)
# Judge status: Wrong Answer
n,c,k=[int(x) for x in input().rstrip().split()]
t=[]
for i in range(n):
  T = int(input())
  t.append([T,T+c])

t=sorted(t,key=lambda x :x[0])

# print(t)
right=0
ans=0
cnt=0
i=0
for s,e in t:
  if s<= right<=e:
    cnt+=1
    if cnt==c:
      ans+=1
      right=e
      cnt=0
  else:
    ans+=1
    right=e
  i+=1
print(ans)
# Judge status: Accepted
H,M,h,m,K=map(int,input().split())
X=(h*60+m)-(H*60+M)
print(X-K)
# Judge status: Accepted
k =  int(input())

a = [i+1 for i in range(9)]

while(1):
    if k <= len(a):
        print (a[k-1])
        break

    b = []
    k = k - len(a)
    x = a
    a = b
    b = x

    for x in b:
        for i in [-1,0,1]:
            d =  x%10  + i
            if d < 0 or d > 9: continue
            a.append( x*10 + d)
# Judge status: Accepted
s = list(input())
a = [0] * (len(s) + 1)

for i in range(len(s)):
    if s[i] == "<":
        a[i+1] = a[i] + 1
for i in range(len(s)-1, -1, -1):
    if s[i] == ">":
        a[i] = max(a[i+1]+1, a[i])
print(sum(a))
# Judge status: Accepted
A,B,C = map(int,input().split())
ans = (A * B) // 2
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

def gcd(x,y):
  while y:
    x, y = y, x%y
  return x

if n < 3:
  print(max(a))
else:
  ll, lr = [0]*n, [0]*n
  ll[0], lr[n-1] = a[0], a[n-1]
  for i in range(1,n):
    ll[i] = gcd(ll[i-1], a[i])
    lr[n-i-1] = gcd(lr[n-i], a[n-i-1])
  print(max(ll[n-1], lr[1], *[gcd(l,r) for l,r in zip(ll[:n-1], lr[2:])]))
# Judge status: Accepted
N=int(input())
c=input()
R=c.count('R')
W=0
ans=[R,c.count('W')]
for i in range(N):
    if c[i]=='W':
        W+=1
    else:
        R-=1
    ans.append(max(R,W))
print(min(ans))
# Judge status: Accepted
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

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


def function(n,x):
    if (n>=0):
        return n//x+1
    else:
        return 0

ans = function(b,x) - function(a-1,x)

print(ans)
# Judge status: Accepted
a, b =map(int,input().split())
A = 0
B = 0
for i in range(b):
    A += a*(10**i)
    
for i in range(a):
    B += b*(10**i)

if a < b:
    print(A)
elif a >b:
    print(B)
else:
    print(min(A,B))
# Judge status: Accepted
l=list(map(int,input().split()))
n=l[0]
w=l[1]
va=[0]*n
wa=[0]*n
for i in range(n):
        
    x=list(map(int,input().split()))
    wa[i]=x[0]
    va[i]=x[1]
dp=[[0 for i in range(w+1)] for j in range(n+1)]
for i in range(1,n+1):
  for j in range(1,w+1):
    if wa[i-1]>j:
      dp[i][j]=dp[i-1][j]
    else:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-wa[i-1]]+va[i-1])
print(dp[-1][-1])
# Judge status: Accepted
S = input()
ans = []
for s in S:
    if s == 'B':
        if len(ans) >= 1:
            ans.pop()
        else:
            continue
    else:
        ans.append(s)

ans = ''.join(ans)
print(ans)
# Judge status: Accepted
N,K = map(int,input().split())
S = input()
ans = ""

for i in range(len(S)):
    if i+1 == K:
        ans += str.lower(S[i])
    else:
        ans += S[i]

print(ans)
# Judge status: Accepted
import itertools
def main():
  a,b = map(int,input().split())
  mm = a
  if a > b:
    mm -=1
  print(mm)
if __name__ == '__main__':
  main()
# Judge status: Accepted
N = int(input())
ans = [2,1]

for i in range(2,87):
    tmp = ans[i-2] + ans[i-1]
    ans.append(tmp)

print(ans[N])
# Judge status: Wrong Answer
x,y,z = map(int,input().split())
people = 0
while x-y >0:
  x = x-y
  people += 1
  x -= z 
print(people)
# Judge status: Accepted
n, k = map(int, input().split())

s = list(map(int, input().split()))
s.sort()

cost=0
for i in range(k):
    cost+=s[i]
    
print(cost)
# Judge status: Wrong Answer
from collections import Counter

N=int(input())
s=[input() for i in range(N)]
M=int(input())
t=[input() for i in range(M)]

S=list(set((s)))
T=list(set((t)))
n=len(S)
ans=0
for i in range(n):
  if s.count(s[i])-t.count(s[i])>ans:
    ans=s.count(s[i])-t.count(s[i])
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

S = input()
if S == 'ABC':
    print('ARC')
else:
    print('ABC')
# Judge status: Accepted
s = str(input())
ans = 0
j = len(s)-1
for i in range(len(s)):
  if s[i] != s[j]:
    ans += 1
  j -= 1
  
print(int(ans/2))
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for i in range(n)]

cnt = 0
ans = 0
for i in range(1,n):
  if a[i] <= a[i-1]:
    cnt += 1
  else:
    cnt = 0
    ans = max(ans, cnt)
ans = max(ans, cnt)
print (ans + 1)
# Judge status: Accepted
A=int(input())
B=set([A])
for i in range(1000000):
    if A%2==0:
        A=A//2
    else:
        A=3*A+1
    if A in B:
        print(len(B)+1)
        exit()
    else:
        B.add(A)
# Judge status: Accepted
N = int(input())
S = input()
print('Yes' if S[:(N//2)] == S[(N//2):] else 'No')
# Judge status: Accepted
N=int(input())
A=[]
B=[]
for i in range(N):
  A.append(input())
M=int(input())
for i in range(M):
  B.append(input())
ans=0  
for i in set(A):
  s=0
  s+=A.count(i)-B.count(i)
  ans=max(ans,s)
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = sorted([int(i) for i in input().split()])

amin = A[0]
multi = True
even = True
for i in range(N):
    if A[i] % amin != 0:
        multi = False
    if A[i] % 2 != 0:
        even = False

if multi: print(amin)
elif even: print(2)
else: print(1)
# Judge status: Wrong Answer
import math

a,b,x = map(int,input().split())
if (a**2)*b <= 2*x:
    print(math.degrees(math.atan(2*((a**2)*b-x)/a**3)))
else:
    print(math.degrees(math.atan(a*(b**2)/2*x)))
# Judge status: Accepted
S = list(input())
for i in range(len(S)//2):
    flag =0
    _ = S.pop(-1)
    _ = S.pop(-1)
    bf = S[:len(S)//2]
    af = S[len(S)//2:]
    for i in range(len(bf)):
        if bf[i] != af[i]:
            flag = 1
            break
    if flag ==0:
        break
print(len(S))
# Judge status: Accepted
import math
import fractions
import collections
import itertools
import pprint
N=int(input())
a=list(map(int,input().split()))
ex=a[0]
for i in range(1,N):
    ex=ex^a[i]
l=[]
for i in range(N):
    l.append(ex^a[i])
print(*l)
# Judge status: Wrong Answer
H, N = map(int, input().split())
A = list(map(int, input().split()))

if H <= sum(A):
    print ("Yse")
else:
    print ("No")
# Judge status: Accepted
A, B, C= map(int, input().split())
if A*C <= B:
  print(C)
elif A <= B:
  print(B//A)
else:
  print(0)
# Judge status: Accepted
X,Y,Z = map(int,input().split())

print(str(Z) + " " + str(X) + " " + str(Y))
# Judge status: Accepted
n,k,s = map(int,input().split())

for i in range(n):
    if i < k:
        print(s,end="")
    else:
        if s!=10**9:
            print(10**9,end="")
        else:
            print(10**9-1,end="")
    print(" ",end="")
print()
# Judge status: Accepted
a, b, c, d = map(int, input().split())
ans = max(a * c, a * d, b * c, b * d)
print(ans)
# Judge status: Wrong Answer
s = input()
print('2017' + s[4:])
# Judge status: Accepted
# C Many Requirements

from itertools import combinations_with_replacement as com

N, M, Q = map(int, input().split())

C = []
for q in range(Q):
  C.append(tuple(map(int, input().split())))

As = com([i for i in range(1, M+1)], N)

ans = 0
for A in As:
  point = 0
  for Ci in C:
    if A[Ci[1]-1] - A[Ci[0]-1] == Ci[2]:
      point += Ci[3]
  ans = max(ans, point)

print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
N = int(input())
items = [list(map(int, input().split())) for i in range(N)]
items = sorted(items, key=lambda x:x[0]+x[1])
res = 0
bf =  -10**9
for x, l in items:
    if bf <= x - l:
        res += 1
        bf = x + l
print(res)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
#print(A)
a=[]
l=[]
for i in range(N):
    a.append([A[i],i+1])
a.sort(key=lambda x:x[0])
for i in range(N):
    l.append(a[i][1])
print(*l, sep=" ")
# Judge status: Accepted
import sys
from bisect import bisect_left
from collections import deque


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a = [int(input()) for _ in range(n)]
    pile = deque()
    for i in range(n):
        index = bisect_left(pile, a[i])
        if index == 0:
            pile.appendleft(a[i])
        else:
            pile[index - 1] = a[i]
    print(len(pile))


if __name__ == "__main__":
    main()
# Judge status: Accepted
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

x = ni()
print("Yes" if x >= 30 else "No")
# Judge status: Wrong Answer
import string
b = string.ascii_letters
a = int(input())
c = []
while(a!=0):
  c.append(b[a%26-1])
  a//=26
  
print(''.join(c))
# Judge status: Accepted
import heapq
import math

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

    res = 0
    max_a = A[0]
    for a in A[1:]:
        if max_a > a:
            res += (max_a - a)
        else:
            max_a = a

    print(res)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import math
N=int(input())
count=0
for k in range(2,int(math.sqrt(N)+1)) :
  if N%k == 0:
    N=N/k
    count+=1
if count==0 and N!=1:
  print(1)
else:
  print(count)
# Judge status: Accepted
A,B,C=map(int, input().split())
if A&1 and B&1 and C&1:
    print(min(A*B,B*C,C*A))
else:
    print(0)
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
sum=0
for i in range(n+1):
     wa = int((i / 1000) % 10) + int((i / 100) % 10) + int((i / 10) % 10)  + int(i % 10)
     if a <= wa and wa<=b:
         sum += i
print(sum)
# Judge status: Accepted
K, X = map(int, input().split())
print('Yes' if K*500 >= X else 'No')
# Judge status: Accepted
import sys
#import numpy as np
#from collections import defaultdict
#import math
#from collections import deque

input = sys.stdin.readline



def main():


    N = int(input())
    H = list(map(int,input().split()))
    H = [10**6] + H
    dp= [0] *(N+1)

    for i in range(2,N+1):
        dp[i]= min(dp[i-2]+abs(H[i]-H[i-2]),dp[i-1]+abs(H[i]-H[i-1]))

    print(dp[N])





if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
L = list(input().split())
L = [int(L[i]) for i in range(N)]

if max(L) < sum(L) - max(L):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# input
s = input()

# define
bw = 0
wb = 0

# main
for i in range(len(s)):
  if int(s[i]) % 2 == i % 2:
    bw += 1
  else:
    wb += 1

# output
print(min(bw, wb))
# Judge status: Wrong Answer
X = int(raw_input())

print(X/500 + (X%500)/5)
# Judge status: Accepted
import numpy as np

card = np.array([list(map(int, input().split())) for i in range(3)])

n = int(input())

number = [int(input()) for i in range(n)]

hit = np.vectorize(lambda x: x in number)(card)

row = hit.all(axis=0).any()
col = hit.all(axis=1).any()

diag1 = hit[0][0] and hit[1][1] and hit[2][2]
diag2 = hit[0][2] and hit[1][1] and hit[2][0]

print('Yes' if row or col or diag1 or diag2 else 'No')
# Judge status: Accepted
d, t, s = map(int, input().split())

if d / s <= t:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, Q = map(int, input().split())
S = str(input())
cnt = 0
L = []
L.append(0)

for i in range(N-1):
    A = S[i]
    B = S[i + 1]
    if A == "A" and B == "C":
        cnt += 1
    L.append(cnt)

for x in range(Q):
    f, r = map(int, input().split())
    print(L[r-1] - L[f-1])
# Judge status: Accepted
x,k,d=map(int,input().split())
x=abs(x)
ans=10**15
r=x//d
if x>=d*k:
  ans=x-d*k
else:
  k-=r
  if k%2==0:
    ans=abs(x-d*r)
  else:
    ans=abs(x-d*(r+1))
print(ans)
# Judge status: Accepted
x,y=map(int,input().split())

for i in range(x+1):
    j=x-i
    if 2*i+4*j==y:
        print('Yes')
        break
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
s = input()
from collections import Counter
c = dict(Counter(s))
ans = 0
for i in c:
    ans *= c[i]+1
    ans += c[i]
print(ans)
# Judge status: Wrong Answer
import numpy as np

n, w = list(map(int, input().split()))
wv = np.array([list(map(int, input().split(' '))) for _ in range(n)])

dp = np.zeros((w + 1, n))
dp[wv[0, 0]:, 0] = np.full(dp[wv[0, 0]:, 0].shape, wv[0, 1])
for i in range(1, n):
    dp[:, i] = dp[:, i - 1]
    wNew, vNew = wv[i, 0], wv[i, 1]
    dp[wNew:, :] = np.fmax(dp[wNew:, :], vNew + dp[:-wNew, :])

print(dp[w, n - 1])
# Judge status: Wrong Answer
import math

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

if n == k:
    print(1)
else:
    print(math.ceil(n/(k-1)))
# Judge status: Wrong Answer
# 入力された文字列をすべてxで置き換える

# 文字列の標準入力
s = input()
sLength = len(s)
hoge = []

for i in range(sLength):
    c = s[i]
    c = "x"
    hoge.append(c)

print(hoge)
print(''.join(map(str,hoge)))
# Judge status: Wrong Answer
import heapq

n,k = map(int,input().split())
l1 = list(map(int,input().split()))
l2 = heapq.nsmallest(3, l1)
print(sum(l2))
# Judge status: Accepted
line = input().split(' ')
N = int(line[0])
L = int(line[1])
List = []
for i in range(N):
  List.append(input())
List.sort()
for i in List:
  print(i,end="")
# Judge status: Wrong Answer
a, b = map(int, input().split())
ans = 0
 
if a<b:
    ans += b
    b -= 1
else:
    ans += a
    a -= 1
 
if a<b:
    ans += b
    b -= 1
else:
    ans += a
    a -= 1
# Judge status: Accepted
n,m = map(int, input().split())

wa_l = [0]*(n+1)
ac_l = [False]*(n+1)
for _ in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'WA' and not ac_l[p]:
        wa_l[p] += 1
    elif s == 'AC':
        ac_l[p] = True


ans_a = 0
ans_w = 0
for wa,ac in zip(wa_l,ac_l):
    if ac:
        ans_a+=1
        ans_w += wa

print(ans_a,ans_w)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a < b:
    print(a)
else:
    print(b)
# Judge status: Accepted
N = input()
print("Yes" if N[0]==N[1]==N[2] or N[1]==N[2]==N[3] or N[0]==N[1]==N[2]==N[3] else "No")
# Judge status: Accepted
import math
import sys
from itertools import permutations
input = sys.stdin.readline

N=int(input())
arr=list(map(int,input().split()))
arr.sort(reverse=True)

cur=2
ans=arr[0]
for i in range(1,N):
    if cur>=N:
        break
    ans+=arr[i]
    cur+=1

    if cur>=N:
        break
    ans+=arr[i]
    cur+=1

print(ans)
# Judge status: Accepted
def main():
    from collections import defaultdict
    import sys
    input=sys.stdin.readline
    n=int(input())
    a=list(map(int,input().split()))
    ap=defaultdict(int)
    am=defaultdict(int)
    for i in range(n):
        ap[a[i]+i]+=1
        am[i-a[i]]+=1
    ans=0
    for k,v in ap.items():
        if k in am:
            ans+=v*am[k]
    print(ans)
if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
T = input()
if(T[:len(S)] == S):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, m = map(int, input().split())

total_ac = 0
total_wa = 0
results = {}
for _ in range(m):
  pi, si = input().split()
  if results.get(pi) == None:
    results[pi] = {
      "AC": False,
      "CumWA": 0
    }
  if not results[pi]["AC"] and si == "AC":
    results[pi]["AC"] = True
    total_ac += 1
    total_wa += results[pi]["CumWA"] 
  elif not results[pi]["AC"] and si == "WA":
    results[pi]["CumWA"] += 1

print(total_ac , total_wa )
# Judge status: Accepted
A, B, N = map(int, input().split())


def f(x):
    global A, B
    return (A * x) // B - A * (x // B)


if N < B:
    print(f(N))
else:
    print(f(B - 1))
# Judge status: Accepted
from sys import stdin
import math

if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    X = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    yen = 100
    cnt = 0
    while (yen<X):
        yen = math.floor(yen*1.01)
        cnt += 1
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)
# Judge status: Accepted
N, M, X, Y = [int(i) for i in input().split()]
x_list = [int(i) for i in input().split()]
y_list = [int(i) for i in input().split()]

x_max = max(x_list)
y_min = min(y_list)

ans = "War"
for Z in range(X+1, Y+1):

    if x_max < Z <= y_min:
        ans = "No War"
        break

print(ans)
# Judge status: Accepted
N = int(input())
S = input()

Sum = 0
Max = 0

for s in S:
    Sum += (-1)**(s == 'D')
    Max = max(Sum, Max)

print(Max)
# Judge status: Wrong Answer
N=int(input())
a=0
b=0
l=[]
for i in range(1,100//4+1):
    l.append(i*4)
for i in range(1,100//7+1):
    l.append(i*7)
for i in range(1,100//11+1):
    l.append(i*11)

#l.sort()
#print(l)
if N in l:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a = list(input())
b = list(input())
c = list(input())

now = a.pop(0)
while True:
    if eval('%s' % now):
        now = eval(str(now)).pop(0)
    else:
        print(now.upper())
        exit()
# Judge status: Accepted
s=input()
for i in range(len(s)-2,0,-2):
    s1=s[:i:]
    #print(s1,s1[:i//2],s1[i//2:])
    if s1[:i//2]==s1[i//2:]:
        print(i)
        exit()
# Judge status: Accepted
s=input().split();
x=int(s[0])
y=int(s[1])
list1=[2]
list2=[4,6,9,11]
list3=[1,3,5,7,8,10,12]
ans=0;
if((x in list1) and (y in list1)): ans=1
elif((x in list2) and (y in list2)):ans=1
elif((x in list3) and (y in list3)):ans=1
if(ans==1):print("Yes")
else:print("No")
# Judge status: Accepted
cur = []

def recur(n):
    if n > 10 ** 10:
        return
    cur.append(n)
    for i in range(10):
        if abs(n % 10 - i) <= 1:
            recur(10 * n + i)

for i in range(1, 10):
    recur(i)
cur.sort()
n = int(input())
print((cur[n - 1]))
# Judge status: Accepted
A = list(map(int, input().split()))

print((A[2]*60+A[3])-(A[0]*60+A[1])-A[4])