Harryxun/stf_run huggingface dataset:
a, b = list(map(int,input().split()))

count = 0

for i in range(a, b + 1):
    work_i = i
    n = 1
    while work_i >= 10:
        n++ 
        work_i = int(work_i / 10)

    flag = True
    for j in range(int(n/2)):
        if int(i / 10**j) % 10 != int(i / 10**(n-j-1)) % 10:
            flag = False

    if flag:
        count++

### FIXED CODE ###

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

count = 0

for i in range(a, b + 1):
    work_i = i
    n = 1
    while work_i >= 10:
        n += 1
        work_i = int(work_i / 10)

    flag = True
    for j in range(int(n/2)):
        if int(i / 10**j) % 10 != int(i / 10**(n-j-1)) % 10:
            flag = False

    if flag:
        count += 1

print(count)
import numpy as np
'''
K = 2
H, W = 5, 5
a = np.array([
	[0, 0, 0, 0, 1],
	[0, 0, 0, 1, 1],
	[0, 0, 1, 1, 1],
	[0, 1, 1, 1, 1],
	[1, 1, 1, 1, 1]
])
'''

def conv(c):
	return int(c=='#')
H, W, K = map(int, input().split())
a = np.array([map(conv, input().split()) for _ in range(H)])

count = 0
for i in range(2 ** H - 1):
	b = np.delete(a.copy(), [j for j in range(H) if ((i >> j) & 1)], 0)
	for i in range(2 ** W - 1):
		c = np.delete(b.copy(), [j for j in range(H) if ((i >> j) & 1)], 1)
		#print(np.sum(c))
		if K==np.sum(c):
			count += 1
print(count)
print()

### FIXED CODE ###

import numpy as np
'''
K = 2
H, W = 5, 5
a = np.array([
	[0, 0, 0, 0, 1],
	[0, 0, 0, 1, 1],
	[0, 0, 1, 1, 1],
	[0, 1, 1, 1, 1],
	[1, 1, 1, 1, 1]
])
'''

def conv(c):
	#print(c)
	return int(c=='#')
H, W, K = map(int, input().split())
a = np.array([list(map(conv, input())) for _ in range(H)])
count = 0
for i in range(2 ** H - 1):
	b = np.delete(a.copy(), [j for j in range(H) if ((i >> j) & 1)], 0)
	blen = b.shape[1]
	for i in range(2 ** W - 1):
		c = np.delete(b, [j for j in range(blen) if ((i >> j) & 1)], 1)
		#print(np.sum(c))
		if K==np.sum(c):
			count += 1
print(count)
print()
#D
from collections import deque
Str = str(input())
Q = int(input())
S = deque()
S.append(Str)
A = 0
B = []
C = []

for i in range(Q):
    a = list(map(str, input().split()))
    if a[0] == '1':
        if A%2==0:
            if len(B)>1:
                B_=B.reverse()
                S.extendleft(B_)
                B = []
            else:
                S.extendleft(B)
                B = []
            S.extend(C)
            C = []
        else:
            if len(C)>1:
                C_=C.reverse()
                S.extendleft(C_)
                C = []
            else:
                S.extendleft(C)
                C = []
            S.extend(B)
            B = []
        A += 1
    elif a[1] == '1':
        B.append(a[2])
    else:
        C.append(a[2])

if a[0] != '1':
    if A%2==0:
        if len(B)>1:
            B_=B.reverse()
            S.extendleft(B_)
            B = []
        elif len(B)==1:
            S.extendleft(B)
            B = []
        S.extend(C)
        C = []
    else:
        if len(C)>1:
            C_=C.reverse()
            S.extendleft(C_)
            C = []
        elif len(C) == 1:
            S.extendleft(C)
            C = []
        S.extend(B)
        B = []

if A%2 != 0:
    S.reverse()
print(''.join(S))

### FIXED CODE ###

#D
from collections import deque
Str = str(input())
Q = int(input())
S = deque(list(Str))
#S.append(list(Str))
#上の方法ではダメ
A = 0
B = []
C = []

for i in range(Q):
    a = list(map(str, input().split()))
    if a[0] == '1':
        if A%2==0:
            if len(B)>1:
                S.extendleft(B)
                B = []
            elif len(B) == 1:
                S.extendleft(B)
                B = []
            if len(C) > 0:
                S.extend(C)
                C = []
        else:
            if len(C)>1:
                S.extendleft(C)
                C = []
            elif len(C) == 1:
                S.extendleft(C)
                C = []
            if len(B) > 0:
                S.extend(B)
                B = []
        A += 1
    elif a[1] == '1':
        B.append(a[2])
    else:
        C.append(a[2])

if a[0] != '1':
    if A%2==0:
        if len(B)>1:
            S.extendleft(B)
            B = []
        elif len(B) == 1:
            S.extendleft(B)
            B = []
        if len(C) > 0:
            S.extend(C)
            C = []
    else:
        if len(C)>1:
            S.extendleft(C)
            C = []
        elif len(C) == 1:
            S.extendleft(C)
            C = []
        if len(B) > 0:
            S.extend(B)
            B = []

if A%2 != 0:
    S.reverse()
print(''.join(S))
import math
N, a, b = map(int,input().split())
p = pow(10,9) + 7
a_c = 1
b_c = 1
a_m = 1
b_m = 1
for i in range(a):
  a_c = a_c * (N-i) % p
  a_m = a_m * (i+1) % p
m_a = a_c * pow(a_m, p-2, p) % p
for j in rnage(b):
  b_c = b_c * (N-j) % p
  b_m = b_m * (j+1) % p
m_b = b_c * pow(b_m,p-2,p) % p
print((pow(2,N, p) - 1 - m_a - m_b) % p)


### FIXED CODE ###

N, a, b = map(int,input().split())
p = pow(10,9) + 7
def comb(n,r):
  bunshi = 1
  for i in range(n-r+1, n+1):
    bunshi =bunshi * i % p
  bunbo = 1
  for i in range(1, r+1):
    bunbo = bunbo * i % p
  return bunshi * pow(bunbo, p-2, p)
print((pow(2,N, p) - 1 - comb(N,a) - comb(N,b)) % p)
def zen(s):
    ans=0
    for i in range(len(s)-1):
        if s[i]==s[i+1]:
            ans+=1
        if len(s)-1==ans:
            return True
        else:
            return False

s=input()
k=int(input())
a=s*2
cnt=[0]*len(s)
cnt2=[0]*len(a)
l=0
m=0
ans=0
j=True
if zen(s):
    print(len(s)*k//2)
else:
    for i in range(len(s)-1):
        if s[i]==s[i+1]:
            if i==0:
                j=False
            cnt[l]+=1
        elif cnt[l]!=0:
            l+=1
    for i in range(len(a)-1):
        if a[i]==a[i+1]:
            cnt2[m]+=1
        elif cnt2[m]!=0:
            m+=1
    ans=0
    p=1
    while cnt[p]!=0:
        ans+=(cnt2[p]+1)//2
        p+=1
    if j:
        ans+=(cnt[0]+1)//2
    ans*=k-1
    for i in range(p):
        ans+=(cnt[i]+1)//2
    print(ans)

### FIXED CODE ###

def is_all(t):
    for i in range(len(t)-1):
        if t[i]!=t[i+1]:
            return False
    return True

s=input()
n=len(s)
k=int(input())
cor=[1]
ans=0
c=1
if is_all(s):
    print(n*k//2)
    exit()
i=0
while i<n-1:
    if s[i]==s[i+1]:
        cor[0]+=1
        i+=1
    else:
        i+=1
        break
while i<n-1:
    if s[i]==s[i+1]:
        cor.append(1)
        while i<n-1:
            if s[i]==s[i+1]:
                cor[-1]+=1
                i+=1
            else:
                break
    i+=1
#print(cor)
if s[0]==s[-1]:
    for i in range(1,len(cor)-1):
        ans+=cor[i]//2
    ans*=k
    ans+=(cor[0]+cor[-1])//2*(k-1)
    print(ans+cor[0]//2+cor[-1]//2)
else:
    for i in range(len(cor)):
        ans+=cor[i]//2
    print(ans*k)
def judge():
    count = 0
    for _ in range(n):
        d1, d2 = map(int, input().split(""))
        if d1 == d2:
            count += 1
        else:
            count = 0
        
        if count == 3:
            return True

    return False

n = int(input())

if judge():
    print("yes")
else:
    print("no")


### FIXED CODE ###

def judge():
    cnt = 0  # 今何連続でゾロ目が出ているか記録しておきます

    for _ in range(N):
        x, y = map(int, input().split())
        if x == y:
            # ゾロ目ストリークが1増えました
            cnt += 1
        else:
            # ゾロ目ストリークが切れました
            cnt = 0

        if cnt == 3:
            # 3連続になった瞬間、return True していいです
            return True

    # ダメでした
    return False

N = int(input())

if judge():
    # judge() で Trueが返ってくるとこっちに進みます
    print("Yes")
else:
    # Falseだとこっちです
    print("No")
s = input()

if len(set(s)) == 2 and l.count(s[0]) == 2:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()

if len(set(s)) == 2 and s.count(s[0]) == 2:
  print('Yes')
else:
  print('No')
a, b = map(int, raw???input().split())

if a<b :
   print a<b
elif a>b :
   print a>b
elif a == b :
   print a=b

### FIXED CODE ###

a, b = map(int, raw_input().split())
  
if a>b:
  print 'a > b'
elif a<b:
  print 'a < b'
elif a==b:
  print 'a == b'
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
old, check = 0, 0
if len(A) % 2 is 1:
    if A[0] is not 0 or A[1] is not 2:
        print(0)
        exit()
    else:
        for i in range(1, N):
            if old is A[i] and check <= 1:
                check += 1
            elif old + 2 is A[i] and check <= 1:
                old = A[i]
                check = 0
            else:
                print(0)
                exit()

        print(2 ** ((N - 1) // 2))
else:
    old = -1
    for i in range(N):
        if old is A[i] and check <= 1:
            check += 1
        elif old + 2 is A[i] and check <= 1:
            old = A[i]
            check = 0
        else:
            print(0)
            exit()
    print(2 ** (N // 2))


### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
A.sort()


def solve(i, num):
    while i < len(A):
        if A[i] == num:
            if A[i + 1] == num:
                i += 2
                num += 2
            else:
                break
        else:
            break
    if i >= len(A):
        print(2 ** (N // 2) % mod)
    else:
        print(0)


if len(A) % 2 is 0:
    solve(0, 1)
else:
    if A[0] is 0:
        solve(1, 2)
    else:
        print(0)
n = int(input())
words = dict()
count = 0
for i in range(n):
  s = sorted(input())
  if s in words:
    count += words[s]
    words[s] += 1
  else:
    words[s] = 0
print(count)

### FIXED CODE ###

n = int(input())
words = dict()
count = 0
for i in range(n):
  s = ''.join(sorted(input()))
  if s in words:
    count += words[s]
    words[s] += 1
  else:
    words[s] = 1
print(count)
#coding: utf-8

n, m, l = (int(i) for i in input().split())
nm = [[0 for i in range(m)] for j in range(n)]
ml = [[0 for i in range(l)] for j in range(m)]
nl = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
    nm[i] = input().split()

for i in range(n):
    for j in range(m):
        nm[i][j] = int(nm[i][j])

for i in range(m):
    ml[i] = input().split()

for i in range(m):
    for j in range(l):
        ml[i][j] = int(ml[i][j])


for i in range(n):
    for j in range(l):
        for k in range(m):
            nl[j][i] += nm[i][k] * ml[k][j]

for i in range(n):
    for j in range(l):
        print(nl[j][i], end = ' ' if j != l-1 else '\n')


### FIXED CODE ###

#coding: utf-8

n, m, l = (int(i) for i in input().split())
nm = [[0 for i in range(m)] for j in range(n)]
ml = [[0 for i in range(l)] for j in range(m)]
nl = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
    nm[i] = input().split()

for i in range(n):
    for j in range(m):
        nm[i][j] = int(nm[i][j])

for i in range(m):
    ml[i] = input().split()

for i in range(m):
    for j in range(l):
        ml[i][j] = int(ml[i][j])


for i in range(n):
    for j in range(l):
        for k in range(m):
            nl[i][j] += nm[i][k] * ml[k][j]

for i in range(n):
    for j in range(l):
        print(nl[i][j], end = ' ' if j != l-1 else '\n')
N, A, B, C, D = map(int, input().split())
S = list(input())

A -= 1
B -= 1
C -= 1
D -= 1

if S[C] == '#' or S[D] == '#':
    print("No")
    exit()

stone = 0
road = 0
c = False
l = []

for i in range(B + 1, D):
    if S[i] == '#':
        stone += 1
        road = 0
        if c:
            l.append(i - 1)
            c = False
        if stone > 1:
            print("No")
            exit()
    else:
        road += 1
        stone = 0
        if road > 2:
            c = True

stone = 0
road = 0

count = 0

# B放置でゴールできるか
if S[B - 1] == '#' or S[B + 1] == '#':
    count += 1
# Bがゴールしているとゴールできるか
if D < C:
    if S[D - 1] == '#' or S[D + 1] == '#':
        count += 1

if count > 1:
    if len(l) == 0:
        print("No")
        exit()

# Bが避難しているときBはAを通したあとゴールできるか
if C < D:
    if l[-1] < C:
        if S[C - 1] == '#' or S[C + 1] == '#':
            count += 1

if count > 2:
    print("No")
    exit()

print("Yes")


### FIXED CODE ###

N, A, B, C, D = map(int, input().split())
S = input()

A -= 1
B -= 1
C -= 1
D -= 1

if '##' in S[A:C] or '##' in S[B:D]:
    print("No")
    exit()
if C > D:
    if  '...' not in S[B-1:D+2]:
        print("No")
        exit()
print("Yes")
N = int(input())
A = list(map(int, input().split()))

table = {}
answer = 'Yes'
for i in range(0, len(A) + 1):
# for(let i = 0; i < A.length; i++):
    Ai = A[i]
    count = table.get(Ai) + 1 if table.get(Ai) else 1
    table[Ai] = count

    if table.get(Ai) >= 2:
        answer = 'No'
        break

print(answer)


### FIXED CODE ###

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

table = {}
answer = 'YES'
for i in range(0, len(A)):
    Ai = A[i]
    count = table.get(Ai) + 1 if table.get(Ai) else 1
    table[Ai] = count

    if table.get(Ai) >= 2:
        answer = 'NO'
        break

print(answer)
import math
a, b, c = map(int, input().split())

# 容器に入っている水が半分以下の場合に困る
if a**2*b > 2 * c:
    h = (2*c)/(a**2)
    print(math.degrees(math.acos(h/a)))
else:
    h = 2*(a**2*b-c)/(a**2)
    print(math.degrees(math.atan(h/a)))


### FIXED CODE ###

from math import atan, degrees
a, b, x = map(int, input().split())

if 2*x >= a*a*b:
    h = 2*(a*a*b-x)/(a*a)
    print(degrees(atan(h/a)))
else:
    l = 2*(a*a*b-x)/(a*b) - a
    print(degrees(atan(b/(a-l))))
input=[input().split() for i in range(2)]
length=int(input[0][0])
list=[]
for i in range(length):
    list.append(int(input[1][i]))
ret=0
list.sort()
for i in range(length):
    flg=True
    num=list[i]
    if list.count(num)==1:
        for j in range(i):
            if i!=j and num%list[j]==0:
                flg=False
                break
        if flg:
            ret=ret+1
print(ret)

### FIXED CODE ###

input=input()
x = input.split()
for i in range(5):
    if(x[i]=='0'):
        print(i+1)
        break
r,g,b = input()
if int(g+b)%4==0: print("YES")
else: print("NO")

### FIXED CODE ###

r,g,b = (i for i in input().split())
if int(g+b)%4==0: print("YES")
else: print("NO")
N = input()

while len(N) > 1:
    M = sum(int(N[i]) for i in range(len(N)))
    N = str(M)

if M == 9 or M == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = input()

if int(N) % 9 == 0:
    print('Yes')
else:
    print('No')
N = input()
v_list = list(map(int,input().split()))
c_list = list(map(int,input().split())
diff_list = [v_list[i]-c_list[i] for i in range(n) if v_list[i] - c_list[i] > 0]
print(diff_list)
diff_list.append(0)
print(diff_list)
print(sum(diff_list))

### FIXED CODE ###

n=int(input())
v_list=list(map(int,input().split()))
c_list=list(map(int,input().split()))

diff_list = [v_list[i]-c_list[i] for i in range(n) if v_list[i] - c_list[i] > 0]
diff_list.append(0)
print(sum(diff_list))
a,b,c = map(int, input().split())
 
if (c-a-b) **2 - 4*a*b > 0 and c-a-b > 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

L=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i','j']
L_ind = [i for i in range(10)]
N=int(input())
K=[]
for i in range(N):
    if i==0:
        K.append(str(L_ind[0]))
    else:
        K_ = []
        for j in K:
            for m in range(int(max(set(j)))+2):
                K_.append(j + str(L_ind[m]))
        K = K_
    
for k in K:
    ans = ''
    for i in k:
        ans += L[int(i)]
    print(ans)
n,t=map(int,input().split())

a=list(map(int,input().split()))
c=[]
d=[0]*(10**5)
if a[0]<a[1]:
    c.append([a[0],0])
else:
    d[0]=a[0]
for i in range(1,n-1):
    if a[i]>a[i+1] and a[i-1]<a[i]:
        d[i]=a[i]
    if a[i]<a[i+1] and a[i-1]>a[i]:
        c.append([a[i],i])
d[n-1]=a[n-1]
e=[0]*(10**5)
for i in c:
    E=max(d[i[1]:])-i[0]
    e[E]+=1
print(max(e))

### FIXED CODE ###

a,b=map(int,input().split())
k=list(map(int,input().split()))

sa=0
ans=1

n=k[a-1]

for i in range(a-2,-1,-1):
    if k[i]>n:
        n=k[i]
    tmp=n-k[i]
    if tmp>sa:
        sa=tmp
        ans=1
    elif tmp==sa:
        ans+=1

    

print(ans)
a=input()
print(a*a*a)

### FIXED CODE ###

a=int(input())
print(a*a*a)
'''def f(a, b):
    if a * b == 0:
        return 0
    res = f(min(a, b), max(a, b) % min(a, b)) + 2 * min(a, b) * (max(a,b)//min(a, b))
    if(max(a, b) % min(a, b) == 0):
        res -= 1
    return res'''
def f(a, b):
    minn = min(a, b)
    maxx = max(a, b)
    if(a - b == 0):
        return a
    if(a * b == 0):
        return 0
    return 2 * minn + f(minn, maxx - minn)

n, x = map(int, input().split())
res = n + f(n - x, x)
print(res)


### FIXED CODE ###

def f(a, b):
    if a * b == 0:
        return 0
    res = f(min(a, b), max(a, b) % min(a, b)) + 2 * min(a, b) * (max(a,b)//min(a, b))
    if(max(a, b) % min(a, b) == 0):
        res -= min(a, b)
    return res

n, x = map(int, input().split())
res = n + f(n - x, x)
print(res)
n=input()
p=input()
p=p.split()
q=[p[0]]
for i in range(int(n)):
    j=max(p[:i+1])
    if j>p[i]:
        q.append(p[i])
if p[int(n)-1]!=min(p):
    q.pop(-1)
print(len(q))

### FIXED CODE ###

a=input()
b=a.split()
if int(b[0])==int(b[1]):
  print('Yes')
else:
  print('No')
N = int(input())
A = list(map(int, input().split(" ")))
B = list(map(int, input().split(" ")))
C = list(map(int, input().split(" ")))
ans = B[A[0] - 1]
for i in range(1, N):
  ans += B[A[i] - 1]
  if A[i - 1] + 1 == A[i]:
    ans += C[A[i] - 1]
  
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split(" ")))
B = list(map(int, input().split(" ")))
C = list(map(int, input().split(" ")))
ans = B[A[0] - 1]
for i in range(1, N):
  ans += B[A[i] - 1]
  if A[i - 1] + 1 == A[i]:
    ans += C[A[i - 1] - 1]
  
print(ans)
'''
def main():
    N, D = map(int, input().split(" "))
    xy = []
    for i in range(N):
        xy.append(list(map(int, input().split(" "))))
    D2 = D **2
    cnt = 0
    for i in range(N):
        if xy[i][0] **2 + xy[i][1] **2 > D2:
            continue
        cnt += 1
    print(cnt)
'''
#if,contiueの使い方による実行時間の比較用
def main():
    N, D = map(int, input().split(" "))
    xy = []
    for i in range(N):
        xy.append(list(map(int, input().split(" "))))
    D2 = D **2
    cnt = 0
    for i in range(N):
        if xy[i][0] **2 + xy[i][1] **2 <= D2:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

### FIXED CODE ###


def main():
    N = int(input())
    L = list(map(int, input().split(" ")))
    cnt = 0
    for i in range(N-2):
        for j in range(i + 1, N-1):
            for k in range(j + 1, N):
                l1 = L[i]
                l2 = L[j]
                l3 = L[k]
                l_max = max(l1, l2, l3)
                if l1 == l2 or l2 == l3 or l3 == l1:
                    continue
                if (l1+l2+l3) - l_max <= l_max:
                    continue
                cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
num=0
A=[]
for i in range(N):
  A.append(list(map(int,input().split())))
D=[]
for j in range(N):
  sum=0
  D=A[j]
  for k in range(M):
    sum+=B[j]*D[j]
  if sum+C>0:
    num+=1
print(num)

### FIXED CODE ###

N,M,C=map(int,input().split())
B=list(map(int,input().split()))
num=0
A=[]
for i in range(N):
  A.append(list(map(int,input().split())))
D=[]
for j in range(N):
  sum=0
  D=A[j]
  for k in range(M):
    sum+=B[k]*D[k]
  if sum+C>0:
    num+=1
print(num)
A = list(input())
for i in range(len(A)//2)
  if A[i] != A[len(A)-1-i]:
    ans += 1
print(ans)
    

### FIXED CODE ###

S = list(input())
ans = 0
for i in range(len(S)//2):
 if S[i] == S[len(S)-1-i]:
   continue
 else:
   ans += 1
print(ans)
H,W,N = tuple(map(int,input().split()))

r,c = tuple(map(int,input().split()))

Ta = input()
Ao = input()

def convert(ch):
    if ch=="R":
        return (0,1)
    elif ch=="L":
        return (0,-1)
    elif ch=="U":
        return (1,0)
    else:
        return (-1,0)
# 青木くんのターンになったらやばいマップを逆方向に1動かして重ねた部分がやばくなる
import numpy as np
yabaiMap = np.zeros((H+2,W+2))
yabaiMap[1:-1,1:-1] = np.ones((H,W))

for idx,(t,a) in enumerate(zip(reversed(Ta),reversed(Ao))):
    if idx != 0:
        
        dy,dx = convert(a)
        # 動かした方向にやばくない場所があれば復帰する
        # つまり フィルタをかけてしまえばいいので，元の場所が0かつ動かした先が1であればよい，その場所を1にする
        yabaiMap[1:-1,1:-1] += (1-yabaiMap)[1:-1,1:-1] * yabaiMap[1+dy:H+1+dy,1+dx:W+1+dx]
        #print("A",a,yabaiMap)
    dy,dx = convert(t)
    yabaiMap[1:-1,1:-1] *= yabaiMap[1+dy:H+1+dy,1+dx:W+1+dx]
    if np.sum(yabaiMap) == 0:
        print("NO")
        quit()
print("YES" if yabaiMap[r,c] ==1 else "NO")

### FIXED CODE ###

H, W, N = tuple(map(int, input().split()))
r, c = tuple(map(int, input().split()))
r-=1
c-=1
Ta = input()
Ao = input()
L, R, U, D = -1, W, -1, H
for idx, (t, a) in enumerate(zip(reversed(Ta), reversed(Ao))):
    if idx != 0:
        if(a == "R"):
            L = max(L-1,-1)
        elif(a == "L"):
            R = min(R+1,W)
        elif(a == "U"):
            D = min(D+1,H)
        else:
            U = max(U-1,-1)
            
    #print("A{} L{} c{} R{} U{} r{} D{}".format(a,L,c,R,U,r,D))
    if(t == "R"):
        R = max(R-1,-1)
    elif(t == "L"):
        L = min(L+1,W)
    elif(t == "U"):
        U = min(U+1,H)
    else:
        D = max(D-1,-1)
    #print("T{} L{} c{} R{} U{} r{} D{}".format(t,L,c,R,U,r,D))
    if (R-L-1)*(D-U-1) <= 0:
        print("NO")
        quit()
print("YES" if L < c < R and U < r < D else "NO")
N, A, B = map(int, input().split())

blue = "b"*A
red = "r"*B
br = blue + red

# print(blue, red, br)

S = br*N
import collections

print(collections.Counter(S[:N])["b"])

### FIXED CODE ###

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


if N % (A+B) >= A:
    print((N // (A+B))*A + A)
else:
    print((N // (A+B))*A + N % (A+B))
import math
from sympy import isprime
N = int(input())

z = []

def judge(n):
    if isprime(n):
        return True
    for i in range(2, int(math.sqrt(n)+1)):
        if n % i == 0:
            n = n // i
            while n != 1:
                if n % i != 0:
                    return False
                n //= i
            return True
        return False


ans = 0
num = []
i = 2
while N != 1:
    
    if isprime(N):
        ans += 1
        break
    if N % i == 0 and judge(i): 
        N //= i
        ans += 1
        num.append(i)

    i += 1
    



print(ans)

### FIXED CODE ###

import math

N = int(input())

def judge(n):
    if n <= 1:
        return False
    for i in range(2, int(math.sqrt(n))+1):
        if n % i == 0:
            n //= i
            while n != 1:
                if n % i != 0:
                    return False
                n //= i
            return True
    return True


def get_prime(n):
    if n <= 1:
        return []
    prime = [2]
    limit = int(math.sqrt(n))

    data = [i + 1 for i in range(2, n, 2)]
    while limit > data[0]:
        prime.append(data[0])
        data = [j for j in data if j % data[0] != 0]
    return prime + data

ans = 0
i = 2
limit = int(math.sqrt(N))
while N != 1:
    
    if i > limit:
        if N > i:
            ans += 1
        break
    if N % i == 0 and judge(i): 
        N //= i
        ans += 1
        
    i += 1
    
print(ans)
from networkx import*
_,*s=open(i:=0)
g=[]
for t in s:
 i+=1;j=0
 for u in t:g+=[(k:=i*20+j,k+20)]*(u>'#'<(s+['#'*k])[i][j])+[(k,k+1)]*(u>'#'<t[j:=j+1])
print(max(t[i]for _,t in shortest_path_length(Graph(g))for i in t))

### FIXED CODE ###

from scipy.sparse import*
e=enumerate
h,*s=open(0)
h,w=map(int,h.split())
r,c=[],[]
for i,t in e(s):
  for j,u in e(t):
    if u>'#'<t[j+1]:r+=i*w+j,;c+=i*w+j+1,
    if(i<h-1)*u>'#'<s[i+1][j]:r+=i*w+j,;c+=j-~i*w,    
print(int((csgraph.johnson(csr_matrix(([1]*len(r),(r,c)),[h*w]*2),0).clip(0,999)%999).max()))
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
BC = [list(map(int,input().split())) for _ in range(M)]
BC.sort(key=lambda x: x[1], reverse=True)
j = 0
for i in range(N):
    if A[i] >= BC[j][1]:
        break
    else:
        A[i] = BC[j][1]
        BC[j][0] -= 1
        if BC[j][0] == 0:
            j += 1
print(sum(A))

### FIXED CODE ###

N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
BC = [list(map(int,input().split())) for _ in range(M)]
BC.sort(key=lambda x: x[1], reverse=True)
j = 0
for i in range(N):
    if A[i] >= BC[j][1]:
        break
    else:
        A[i] = BC[j][1]
        BC[j][0] -= 1
        if BC[j][0] == 0:
            j += 1
        if j >= M:
            break
print(sum(A))