peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S = input().strip()

    n = S.count("N")
    s = S.count("S")
    w = S.count("W")
    e = S.count("E")

    if (n == 0 and s != 0) or (n != 0 and s == 0) or (w != 0 and e == 0) or (w == 0 and e != 0):
        print("No")
    else:
        print("Yes")


    
    
    
    

if __name__ == '__main__':
    main()
# Judge status: Accepted
sd = input()
t = input()
lsd = len(sd)
lt = len(t)
for i in range(lsd-lt,-1,-1):
  for j in range(lt):
    if sd[i+j] != "?" and sd[i+j] != t[j]:
      break
  else:
      print((sd[:i]+t+sd[i+lt:]).replace("?","a"))
      break
else:
  print("UNRESTORABLE")
# Judge status: Accepted
# C - GeT AC

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

# ABCACAA = 0000100のようなリストを作る。ACが出てきたら1
L = [0]*(N)
for i in range(1, N):
    if S[i-1]=='A' and S[i]=='C':
        L[i] = 1

# 累積和を取る
Lsum = [0]*(N+1)
for i in range(N):
    Lsum[i+1] = Lsum[i]+L[i]

for _ in range(Q):
    l, r = map(int, input().split())
    print(Lsum[r] - Lsum[l])
# Judge status: Accepted
w,a,b=map(int,input().split())
if (w+a)<b:
  print(b-w-a)
elif (b+w)<a:
  print(a-b-w)
else:
  print(0)
# Judge status: Accepted
# C - 100 to 105
def main():
    X = int(input())
    check = lambda x: x * 100 <= X <= x * 105
    is_possible = any(check(i) for i in range(X))
    print(int(is_possible))


if __name__ == "__main__":
    main()
# Judge status: Accepted
N=int(input())
works=[]
for _ in range(N):
    A,B=map(int,input().split())
    works.append([B,A])
n_works=sorted(works)
answer=0
number=0
for work in n_works:
    number+=work[1]
    if number>work[0]:
        answer=1
        break
if answer==0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
def main():
  if 'get_ipython' not in globals():  
    a,b = map(int,input().split())
  else:
    a,b = 3,11
    s = "test"
 
  def get(a,b, count, ans):
    if count == 0:
      return(ans)
    
    if a >= b:
      print(a, b, ans)
      return(get(a-1, b, count -1, ans + a))
    else:
      return(get(a, b-1, count -1, ans + b))
  
  print(get(a, b, 2, 0))
  
main()
# Judge status: Accepted
x, y = map(int, input().split())

flag = False
for i in range(x+1):
  v = i
  t = x - i
  f = 2 * v + 4 * t
  if f == y:
    flag = True

if flag:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N = int(input())
i = 0
result = 0
while i <= N:
    i += 1
    if i % 3 != 0 and i % 5 != 0:
        result += i
print(result)
# Judge status: Wrong Answer
s = input()
if s[3] == '8':
  print('Heisei')
elif s[5] == '0' and s[6] == '1' or s[6] == '2' or s[6] == '3' or s[6] == '4':
  print('Heisei')
else:
  print('TBD')
# Judge status: Accepted
N = int(input())
r = 1

for n in range(1, N + 1):
    r = (r * n) % ((10 ** 9) + 7)
print(r)
# Judge status: Wrong Answer
n,k = map(int,input().split())
if k >= n:
    print(k%n)
else:
    print(n%k)
# Judge status: Accepted
N, M = map(int, input().split())
s = -1
t = N+1
for i in range(M):
    l,r =map(int, input().split())
    s = max(s, l)
    t = min(t, r)
    
print(max(0, t-s+1))
# Judge status: Accepted
x, y = map(int, input().split())

ans = 0
while x <= y:
    x *= 2
    ans += 1
print(ans)
# Judge status: Wrong Answer
queue=list(map(int,input().split()))
queue.sort()
if queue[0]==5 and queue[1]==5 and queue[2]==7:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
import copy
#x = int(input())
a, b, c = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

k = int(input())

d = 0
while (True):
    if b > a:
        break
    else:
        b *= 2
        d += 1

while (True):
    if c > b:
        break
    else:
        c *= 2
        d += 1

if d <= k:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
XY = [tuple(map(int,input().split())) for i in range(n)]
for jun in itertools.permutations(range(n),n):
  cost = 0
  for i in range(1,n):
    cost += math.sqrt((XY[jun[i]][0]-XY[jun[i]-1][0])**2+(XY[jun[i]][1]-XY[jun[i]-1][1])**2)
  ans += cost
print(ans/math.factorial(n))
# Judge status: Wrong Answer
N,L = map(int,input().split())
a = []
for i in range(N):
  a.append(L+i-1)
b = []
for i in a:
  b.append(abs(i))
for i in range(N):
  if abs(L+i-1) == min(b):
    print(sum(a)-L-i+1)
# Judge status: Accepted
# C 白昼夢

s = input()[::-1]

cnt = 0
while cnt < len(s):
  if not s[cnt:cnt+7] == "remaerd":
    if not s[cnt:cnt+6] == "resare":
      if not s[cnt:cnt+5] in ["maerd", "esare"]:
        print("NO")
        exit()
      else:
        cnt += 5
    else:
      cnt += 6
  else:
    cnt += 7
print("YES")
# Judge status: Accepted
import sys
x, y, a, b, c = map(int, sys.stdin.readline().split())
p = map(int, sys.stdin.readline().split())
q = map(int, sys.stdin.readline().split())
r = map(int, sys.stdin.readline().split())

p = sorted(p, reverse=True)[:x]
q = sorted(q, reverse=True)[:y]
r = sorted(r, reverse=True)
final = p + q + r
final = sorted(final, reverse=True)
print(sum(final[:x+y]))
# Judge status: Accepted
N, A, B = map(int, input().split())
S = list(input())

x = 0 # 予選の通過人数
b = 1 # 海外勢の予選の通過人数

for S in S:
    if S == "a" and x < A + B:
        x += 1
        print("Yes")
    elif S == "b" and x < A + B and b <= B:
        b += 1
        x += 1
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
N = int(input())
prev, ans = 2, 1
for _ in range(N - 1):
    prev, ans = ans, ans + prev
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))
print((n+(k-1)-1-1)//(k-1))
# Judge status: Accepted
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
while m>0:
  a[0]//=2
  for i in range(1, m):
    if i<n and a[i] >= a[0]:
      a[i]//=2
    else:
      a.sort(reverse=True)
      m-=i
      break
  else:
    break
print(sum(a))
# Judge status: Accepted
K=int(input())
S=input()

if len(S) > K:
  S = S[:K] + "..."
  
print(S)
# Judge status: Accepted
import numpy as np
import sys
import math

n=int(input())
W=[input() for i in range(n)]
if len(W)!=len(set(W)):
    print('No')
    sys.exit()
ans='Yes'
for i in range(n-1):
    if W[i][-1]!=W[i+1][0]:
        ans='No'
        break
print(ans)
# Judge status: Accepted
import heapq


def main():
    n, m = map(int, input().split())
    alist = map(int, input().split())
    heap = []
    for a in alist:
        heapq.heappush(heap, a * -1)
    for _ in range(m):
        v = heapq.heappop(heap)
        heapq.heappush(heap, int(v / 2))
    print(int(-1 * sum(heap)))


main()
# Judge status: Wrong Answer
s=input()
st=set(s)
print(st)
if len(st)==2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A,B,C,D = map(int, input().split())
from fractions import gcd

cd = C*D//gcd(D,C)
f = lambda x: B//x - ((A-1)//x)
print(B - A + 1 - (f(C) + f(D) - f(cd)))
# Judge status: Accepted
a, b = map(int, input().split())
sub = b - a - 1
n = sub * (sub + 1) // 2
print(n - a)
# Judge status: Accepted
import math
n=int(input())
_n=int(math.sqrt(n))
m=10**18
for i in range(1,_n+1):
    if n % i ==0:
        m=min(i+n//i,m)
print(m-2)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
cnt = 0
for i in range(n-1):
    if i+1==a[i]:
        a[i],a[i+1]=a[i+1],a[i]
        cnt += 1
if a[-1]==n: cnt += 1
print(cnt)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,read().split())

answer = 'Yes' if N == M else 'No'
print(answer)
# Judge status: Wrong Answer
n = int(input())
a = [int(x) for x in input().split()]


x=0
for i in range(n):
    x = x + a[i]- (i+1)

b = abs(x // n) 

y = 0
for i in range(n):
    y = y + abs(a[i] - (i+1 - b))

print(y)
# Judge status: Accepted
import collections
from itertools import accumulate
from operator import add
import bisect

N = int(input())

def primef(n):
  i = 2
  p_nums = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      p_nums.append(i)
    i += 1
  if n > 1:
    p_nums.append(int(n))
  return p_nums

ans = primef(N)
ans = dict((collections.Counter(ans)))
con = 0

acadd = list(accumulate(range(1,30),add))

for k in ans.values():
  con += bisect.bisect_right(acadd,k)
    
print(con)
# Judge status: Accepted
a=int(input())
print("Yes" if [4*x+7*y for x in range(101) for y in range(101)].count(a) else "No")
# Judge status: Accepted
N, K = map(int, input().split())
l = input().split()
l2 = [int(i) for i in l]

line1, line2 = 0, 10**9

while (line2-line1 > 1):
  x = int((line1 + line2) / 2)
  def f(x):
    now = 0
    for i in range(N):
      now += int((l2[i]-1)/x)
    return now <= K
  if f(x)==True:
    line2 = x
  else:
    line1 = x
    
print(line2)
# Judge status: Accepted
a,b,c,d = map(int,input().split())

delta = min(b,d)-max(a,c)

if delta < 0:
  print(0)
else:
  print(delta)
# Judge status: Wrong Answer
#!/usr/bin/env python3
s = int(input())
if s <= 10**9:
    print(s, 0, 0, 0, 0, 1)
else:
    print(10**9, 1, 10**9 - int(str(s)[-9:]), s // 10**9 + 1)
# Judge status: Accepted
print(eval(input().replace(*' +'))+1>>1)
# Judge status: Accepted
N, D = map(int, input().split())

ans = -(-N // (2*D+1))

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

print((L/3)**3)
# Judge status: Wrong Answer
N, M = map(int, input().split())
graph = [[] for i in range(N)]
for i in range(M):
    A, B = map(lambda x: int(x) - 1, input().split())
    graph[A].append(B)
    graph[B].append(A)

from collections import deque

dist = [-1] * N
prev = [-1] * N
dist[0] = 0
queue = deque([0])
while queue:
    tmp = queue.popleft()
    for i in graph[tmp]:
        if dist[i] != -1:
            continue
        dist[i] = dist[tmp] + 1
        prev[i] = tmp
        queue.append(i)


print("Yes")
for i in dist[1:]:
    print(i)
# Judge status: Accepted
N, M, K = map(int, input().split())
ok = False
for i in range(N+1):
    for j in range(M+1):
        if N*M - i*j - (N - i)*(M - j) == K:
            ok = True
if ok:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import math

n = int(input())

def N(n, i, j):
    num = 0
    for x in range(1,n+1):
        low = int(x%10)
        high = int(x/(pow(10, int(math.log10(x)))))
        if((high == i)and(low == j)):
            num = num + 1
    return num

s = 0
for i in range(1,10):
    s = s + pow(N(n, i, i), 2)

for i in range(2,10):
    for j in range(1,i):
        s = s + 2*N(n, i, j)*N(n, j, i)

print(s)
# Judge status: Accepted
a,b,c,d=map(int,input()) #1行で連続して入力

if a==b==c or b==c==d or a==b==c==d:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
D, N = map(int, input().split())
print(int(str(N) + '00' * D) if N != 100 else int(str(N + 1) + '00' * D))
# Judge status: Accepted
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

import math

n = ni()
nn = n
mn = 10**12
nums = [1]

i=2
while i<=math.ceil(math.sqrt(n)+1):
  if n%i==0:
    nums.append(i)
  i+=1

for num in nums:
  other = nn//num
  mn = min(mn, num+other-2)

print(mn)
# Judge status: Accepted
s = input().split()[1];
print("A%sC" % s[0])
# Judge status: Accepted
# https://atcoder.jp/contests/abc058/tasks/abc058_b

O = input()
E = input()

len_E = len(E)
len_O = len(O)

E_count = 0
O_count = 0

total_len = len_E + len_O

ans = ''

for t in range(1, total_len + 1):
    if t % 2 == 0:
        ans = ans + E[E_count]
        E_count += 1
    else:
        ans = ans + O[O_count]
        O_count += 1

print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 09:15:46 2020

@author: black
"""
def check(x):
    div = [1]
    for j in range(1, x):
        if (x)%(j+1) == 0:
            div.extend([j+1])
    return len(div)




N = int(input())
ans = []

for x in range(1, N+1):
    if x%2 == 1:
        if check(x) == 8:
            ans.extend([x])


print(len(ans))
# Judge status: Accepted
W=str(input())
cnt=[0 for i in range(26)]
ans="Yes"
for i in range(len(W)):
    for j in range(26):
        if ord(W[i])==97+j:
            cnt[j]+=1

for s in range(26):
    if cnt[s]%2!=0:
        ans="No"
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
x = [list(map(int,input().split())) for i in range(m)]
y = []
z = []

for k in range(m):
    y = y + x[k]

for l in range(1,n+1):
    z = z + [y.count(l)]
    
for p in z:
    print(p)
# Judge status: Wrong Answer
N = int(input())
if N % 2 == 0:
  print(2/N)
else:
  print(3/N)
# Judge status: Wrong Answer
t = list(input())
a = 0
b = 0

for i in range(len(t)):
    if i == 0 and t[i] == '?':
        t[i] = 'D'
    
    if 0 < i < len(t) - 1 and t[i] == '?':
        if t[i-1] == 'P':
            t[i] = 'D'
        else:
            t[i] = 'P'

    if i == len(t) -1 and t[i] == '?':
        t[i] = 'D'

print(''.join(t))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a<=b and b<=c:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
from fractions import gcd


n = int(input())
a = int(input())
for i in range(n-1):
    b = int(input())
    a = a * b/ gcd(a, b)
print(int(a))
# Judge status: Accepted
from collections import deque
n = int(input())
al = list(map(int,input().split()))

b = deque()

if n % 2 == 0:
    for i in range(n):
        if i % 2 != 0:
            b.appendleft(str(al[i]))
        else:
            b.append(str(al[i]))
else:
    for i in range(n):
        if i % 2 == 0:
            b.appendleft(str(al[i]))
        else:
            b.append(str(al[i]))

print(' '.join(b))
# Judge status: Wrong Answer
n=input()
if n.find("9") > 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A, B = map(int, input().split())
for i in range(1, 1001):
    if (i * 0.08) // 1 == A and (i * 0.1) // 1 == B:
        print(i)
        exit(0)

print(-1)
# Judge status: Accepted
a,b,c = map(int,input().split())
print('Yes' if (a<=c<=b or b<=c<=a) else 'No')
# Judge status: Accepted
s=list(input())
c=list(reversed(s))
n=len(s)
t=list(s[:int((n-1)/2)])
a=list(reversed(t))
u=list(s[int((n+3)/2)-1:])
b=list(reversed(u))
#print(b)
if t==a and u==b and s==c:
    print("Yes")   
else:
    print("No")
# Judge status: Accepted
from math import atan, pi

a, b, x = map(int, input().split())
if a * a * b > 2 * x:
    ans = atan(a * b * b / 2 / x)
else:
    ans = atan((2 * a * a * b - 2 * x) / a / a / a)

ans *= 180 / pi
print(ans)
# Judge status: Accepted
a,b = map(int,input().split())
c = a*b
if c%2 == 0:
    print('Even')
else :
    print('Odd')
# Judge status: Wrong Answer
year=int(input())

if year==3 or year==5:
  print("YES")
# Judge status: Accepted
n,m = map(int,input().split())
high = list(map(int,input().split()))
num = []
for i in range(m):
  mountain = list(map(int,input().split()))
  if high[mountain[0] - 1] < high[mountain[1] - 1]:
    num.append(mountain[0])
  elif high[mountain[0] - 1] == high[mountain[1] - 1]:
    num.append(mountain[0])
    num.append(mountain[1])
  else:
    num.append(mountain[1])
ans = [0]*n
for i in num:
  ans[i -1] = 1
cnt = 0
for i in ans:
  if i == 0:
    cnt += 1
print(cnt)
# Judge status: Wrong Answer
a, b = input().strip().split()
a, b = [int(a), float(b) * 1000]
x = (a * b) // 1000
print(int(x))
# Judge status: Accepted
N, A, B = list(map(int, input().split()))
C = A+B
x = list(input())
for i in x:
  if i == "c":
    print("No")
  elif i == "a" and C > 0:
    print("Yes")
    C -= 1
  elif i == "b" and C> 0 and B > 0:
    print("Yes")
    C -= 1
    B -= 1
  else:
    print("No")
# Judge status: Accepted
N = int(input())

res = [0] * N


for x in range(1, 102):
    for y in range(1, 102):
        for z in range(1, 102):
            t1 = (x + y + z) ** 2

            if t1 > 15000:
                break

            n = t1 - x * y - y * z - z * x - 1
            
            if n >= N or n < 0:
                break
            res[n] += 1

for o in res:
    print(o)
# Judge status: Wrong Answer
s=input()
if s[0]==s[1] or s[0]==s[2] or s[0]==s[3]:
  print("Yes")
elif s[1]==s[2] or s[1]==s[3]:
  print("Yes")
elif s[2]==s[3]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N=int(input())
C=[];S=[];F=[]
for i in range(N-1):
    c,s,f=map(int,input().split())
    C.append(c);S.append(s);F.append(f)
for i in range(N-1):
    tim=0
    for j in range(i,N-1):
        if(tim<=S[j]):
            tim=S[j]+C[j]
        elif(tim%F[j]==0):
            tim+=C[j]
        elif(tim%F[j]!=0):
            tim+=C[j]+(F[j]-(tim%F[j]))
    print(tim)
print(0)
# Judge status: Wrong Answer
N,M = map(int,input().split())
H = list(map(int,input().split()))
counter = [1] * N
for i in range(M):
    A,B = map(int,input().split())
    if H[A-1] > H[B-1]:
        counter[B-1] = 0
    if H[A-1] < H[B-1]:
        counter[A-1] = 0
    else:
        counter[A-1] = 0
        counter[B-1] = 0
print(sum(counter))
# Judge status: Wrong Answer
import math
N,P=map(int,input().split())
A=list(map(int,input().split()))
l=[]
c=0
cnt=0
even=0
odd=0
for i in range(0,N):
    if A[i]%2==0:
        even=even+1
    else:
        odd=odd+1
if P==0:
    print(pow(2,even)*int(pow(2,odd-1)))
else:
    print(pow(2,even)*math.floor(pow(2,odd-1)))
# Judge status: Accepted
N,K = map(int,input().split())
S = input()
print(S[:K-1]+S[K-1].lower()+S[K:])
# Judge status: Wrong Answer
K, S = [int(n) for n in input().split(" ")]
 
cnt = 0
 
for x in range(K+1):
  for y in range(K+1):
    for z in range(S-x-y):
      if x+y+z == S:
        cnt +=1
 
print(cnt)
# Judge status: Accepted
x, y = map(int, input().split())
a = [0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0]
print('Yes' if a[x - 1] == a[y - 1] else 'No')
# Judge status: Accepted
N=int(input())
An=list(map(int,input().split()))
mod=10**9+7
s=sum(An)
S=0
num = 0
for i in range(N):
    num += An[i]
    S += (An[i]*(s-num))
print(S%mod)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
l.sort()

print("Yes" if l[-1]<sum(l[:n-1]) else "No")
# Judge status: Accepted
N = int(input())

ans = [0 for _ in range(N)]

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            n = x**2+y**2+z**2+x*y+y*z+z*x
            if n <= N:
                ans[n-1] += 1


print(*ans, sep="\n")
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
s = input()
for i in range(a, max(c, d)):
    if s[i-1:i+1] == "##":
        print("No")
        exit()
if c < d:
    print("Yes")
    exit()
for i in range(b-1, d):
    if s[i-1:i+2] == "...":
        print("Yes")
        exit()
print("No")
# Judge status: Accepted
S = str(input())

def judge(s):
    if len(s)%2 == 1:
        return 0
    else:
        for i in range(int(len(s)/2)):
            if s[i]!=s[int(len(s)/2)+i]:
                return 0
        return 1

    
x = len(S)
for i in range(1,len(S)):
    S = S[:-1]
    if judge(S)== 1:
        print(x-i)
        break
# Judge status: Accepted
A, B, C = map(int, input().split())
if A+B >= C:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, R = map(int, input().strip().split())

if N < 10:
    tmp = 100 * (10 - N)
    print(R + tmp)
else:
    print(R)
# Judge status: Accepted
a = list(input())

n = len(a)

c = 0

for i in range(n):
    if (i % 2 == 0 and a[i] == "0") or (i % 2 == 1 and a[i] == "1"):
        c += 1

print(min(c, n-c))
# Judge status: Accepted
li=[]
for i in range(5):
    li.append(int(input()))

min=9

min_f=0

for i in range(5):
    if min> li[i]%10 >0:
        min=li[i]%10
        min_f=i

cnt=0

for i in range(5):
    if i==min_f:
        continue
    if li[i]%10==0:
        cnt+=li[i]
    else:
        cnt+=li[i]+10-li[i]%10
print(cnt+li[min_f])
# Judge status: Accepted
N = int(input())
d = [int(x) for x in input().split()]

d.sort()
a = d[N // 2 - 1]
b = d[N // 2]

print(b - a)
# Judge status: Accepted
n, m = map(int, input().split())
if m <= 2 * n:
    print(m // 2)
else:
    print(n + (m - 2 * n) // 4)
# Judge status: Accepted
import math
a, b = map(int, input().split())
print(1+math.ceil((b-a)/(a-1)))
# Judge status: Wrong Answer
n,a,b = map(int,input().split())
s= input()

all_cnt = 0
for_cnt = 0
for i in range(n):
    if s[i] == "a":
        if all_cnt < a+b:
            print("Yes")
            all_cnt += 1
        else:
            print("No")
    elif s[i] == "b":
        if all_cnt < a+b and for_cnt < b:
            print("Yes")
            all_cnt += 1
            for_cnt += 1
        else:
            print("No")
# Judge status: Accepted
a = sorted(list(map(int,input().split())))
x = int(str(a[2]) + str(a[1]))
print(x + a[0])
# Judge status: Accepted
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,k = inpl()
a = [inp() for _ in range(n)]
a.sort()
res = INF
for i in range(n-k+1):
    res = min(res, a[i+k-1] - a[i])
print(res)
# Judge status: Accepted

r = int(input())

en = r**2
ans = en//1
print(ans)
# Judge status: Wrong Answer
N = input()
A = set(input().split())

if len(A) == N:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
from itertools import product
a,b,c,d=list(input())
for o,p,q in product("-+",repeat=3):
    if eval(a+o+b+p+c+q+d)==7:
        print(a+o+b+p+c+q+d+"=7")
        break
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    a[i]-=1
ans=0
flg=True
for i in range(1,n):
    if a[i]==i and a[i-1]==i-1 and flg:
        if flg:
            ans-=1
            flg=False
        else:
            flg=True
    else:
        flg=True
for i in range(n):
    if a[i]==i:
        ans+=1
print(ans)
# Judge status: Wrong Answer
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
lst1 = []
for i in range(n):
    lst1.append(int(readline()))

ans = 0
lst2 = []
for i in lst1:
    ans += i//2
    lst2.append(i%2)

flag = 0
for i in lst2:
    if flag and i == 1:
        ans += 1
        flag = 0
    elif i == 1:
        flag = 1
    else:
        flag = 0

print(ans)
# Judge status: Wrong Answer
n, k = map(int, input().split())
N = n//k
m = n%k
print(0 if m==0 else N-m)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
a = A.copy()
for i in range(N):
    a[i] = a[i] -i-1
B = sorted(a)
# print(a)
if N%2==1:
    med = B[N//2]
else:
    med = (B[N//2]+B[N//2-1])//2

    
# print(med)
ans = 0
for i in range(N):
    ans += abs(a[i]-(med))
print(ans)
# Judge status: Wrong Answer
n, x, y = map(int, input().split())
X = min(x,y)
Y = max(x,y)
x =X
y = Y
sum = x +y +1
dist = x+1
for i in range(2,dist):
	sum += dist//i
dist = n+1-y
for j in range(2,dist):
	sum += dist//j
dist = y+1-x
sum+= dist
for k in range(2,dist):
  sum += dist//k
sum+= y-n+2
# Judge status: Accepted
if __name__ == '__main__':
	S = input()
	S = [s.split()[0] for s in S]
	ans = []
	for i in range(0,len(S)):
		if S[i] == 'B' and len(ans)>0:
			ans.pop()
		elif S[i] != 'B':
			ans.append(S[i])

	ans = ''.join(ans)
	print(ans)
# Judge status: Accepted
A,B,C = map(int,input().split())
if A <= C <= B:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from sys import stdin

(n, a, b) = stdin.readline().rstrip().split()
n = int(n)
a = int(a)
b = int(b)

total=0
POW_MAX=4

for i in range(1, n+1):
    sub_total=0
    for j in range(0, len(str(i))):
        #sub_total = sub_total + math.floor(i / (10 ** j) )
        #sub_total = sub_total + i // (10 ** j)
        sub_total = sub_total + int(str(i)[j])
    if a <= sub_total and sub_total <= b:
        #print("n:%d sub_total:%d" % (i, sub_total))
        total = total + i

print(total)
# Judge status: Accepted
N = int(input())
A = tuple(map(lambda n: int(n) - 1, input().split()))

rem = 0
bk = 0
for a in A:
    if a == rem:
        rem += 1
    else:
        bk += 1

if bk == N:
    print(-1)
else:
    print(bk)