Harryxun/stf_run huggingface dataset:
#n = int(input())
#a,b = map(int,input().split())
#a_L = list(map(int,input().split()))
a_L = []
for _ in range(4):
    a_L.append(int(input()))
print(min(a_L[0]+a_L[1])+min(a_L[2]+a_L[3]))

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b)+min(c,d))
N, K = map(int, input().split())
c = 0
n = 1
for i in range(K):
  List = list(map(int, input().split()))
for I in range(N):
  if n in List:
  else:
    c = c+1
  n = n+1
print(c)

### FIXED CODE ###

def resolve():
    N, K = map(int, input().split())
    A = []
    for i in range(K):
        d = int(input())
        a = list(map(int, input().split()))
        A.extend(a)
    print(N - len(set(A)))
resolve()
n=int(input())
m=int(input())
if n == m:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n,m=map(int,input().split())
if n == m:
    print("Yes")
else:
    print("No")
MAX_D = 10**9
def solve():
    N,M = map(int, input().split())
    d = [[MAX_D]*N for _ in range(N)]
    edges = [[False]*N for _ in range(N)]
    base_edge = {}
    for _ in range(M):
        a,b,c = map(int, input().split())
        edges[a-1][b-1] = True
        edges[b-1][a-1] = True
        d[a-1][b-1] = c
        d[b-1][a-1] = c
        base_edge[(a-1,b-1)] = c
        base_edge[(b-1,a-1)] = c
        
    # ワーシャルフロイド法
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if i != j and d[i][j] > d[i][k]+d[k][j]:
                    # print(i+1,k+1,j+1, d[i][j], d[i][k], d[k][j])
                    edges[i][j] = False
                    if base_edge[(i,k)] == d[i][k]: edges[i][k] = True
                    if base_edge[(k,j)] == d[k][j]: edges[k][j] = True
                    d[i][j] = d[i][k]+d[k][j]
                    
    # print(edges)
    print(M - sum(map(sum, edges))//2)
    
solve()

### FIXED CODE ###

MAX_D = 10**9
def solve():
    N,M = map(int, input().split())
    d = [[MAX_D]*N for _ in range(N)]
    edges = [[False]*N for _ in range(N)]
    base_edge = {}
    for _ in range(M):
        a,b,c = map(int, input().split())
        edges[a-1][b-1] = True
        edges[b-1][a-1] = True
        d[a-1][b-1] = c
        d[b-1][a-1] = c
        base_edge[(a-1,b-1)] = c
        base_edge[(b-1,a-1)] = c
        
    # ワーシャルフロイド法
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if i != j and d[i][j] > d[i][k]+d[k][j]:
                    # print(i+1,k+1,j+1, d[i][j], d[i][k], d[k][j])
                    edges[i][j] = False
                    if (i,k) in base_edge and base_edge[(i,k)] == d[i][k]: edges[i][k] = True
                    if (k,j) in base_edge and base_edge[(k,j)] == d[k][j]: edges[k][j] = True
                    d[i][j] = d[i][k]+d[k][j]
                    
    # print(edges)
    print(M - sum(map(sum, edges))//2)
    
solve()
def get_verteces_in_subtree(vertex):
    children = tree_dictionary[vertex]
    if len(children) == 0:
        return [vertex]
    return [vertex] + sum([get_verteces_in_subtree(child) for child in children], [])
  
N, Q = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(N-1)]
operations = [list(map(int, input().split())) for _ in range(Q)]

tree_dictionary = {i: [] for i in range(1, N+1)}
for edge in edges:
    tree_dictionary[edge[0]].append(edge[1])
    
counts = [0] * N
for op in operations:
    top_vertex, value = op
    added_verteces = get_verteces_in_subtree(top_vertex)
    print(added_verteces)
    for v in added_verteces:
        counts[v-1] += value
       
output = ""
for c in counts:
    output += (str(c) + " ")
output = output[:-1]
print(output)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6) #for deep recursion

N, Q = list(map(int, input().split()))
edges = [list(map(int, input().split())) for _ in range(N-1)]
operations = [list(map(int, input().split())) for _ in range(Q)]

counts = [0] * N
for op in operations:
    p, x = op
    counts[p-1] += x
    
all_connected_vertices = {i: [] for i in range(1, 1+N)}
for a, b in edges:
    all_connected_vertices[a].append(b)
    all_connected_vertices[b].append(a)
    
def dfs(point, pre):
    connected_vertices = all_connected_vertices[point]
    for c in connected_vertices:
        if c == pre:
            continue
        counts[c-1] += counts[point-1]
        dfs(c, point)
    
dfs(1, -1)
    
print(*counts)
A,B = map(int,input().split())
if A > B:
  print("Alice")
else if A < B:
  print("Bob")
else:
  print("Draw")

### FIXED CODE ###

a,b = map(int, input().split())
if a == b:
  print("Draw")
else:
  if a == 1:
    print("Alice")
  else:
    if b == 1:
      print("Bob")
    else:
      if a > b:
        print("Alice")
      else:
        print("Bob")
N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=N**N
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    t=a[x[i]]
    a[x[i]]-=t/(b[x[i]]+1)
    a[y[i]]+=t/(b[x[i]]+1)
n=0
for i in range(N):
    if a[i]!=0:
        n+=1
print(n)


### FIXED CODE ###

N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    if a[x[i]]==1:
        a[y[i]]=1
    if b[x[i]]==0:
        a[x[i]]=0
print(sum(a))
N,K = map(int,input().split())

Red = N-K
Blue = K
mod = 1000000007

ans = 1
for i in range(Blue):
    if Red < i:
            ans = 0
    elif i != 0:
        ans = ans * (Red + 1 - i) * (Blue - i) / ((i + 1) * i)
    else:
        ans = ans * (Red + 1 - i) / (i + 1)
    print(int(ans) % mod)


### FIXED CODE ###

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

Red = N-K
Blue = K
mod = 1000000007

ans = 1
for i in range(Blue):
    if Red < i:
            ans = 0
    elif i != 0:
        ans = (ans * (Red + 1 - i) * (Blue - i) // ((i + 1) * i))
    else:
        ans = (ans * (Red + 1 - i) // (i + 1))
    print(int(ans) % mod)
S,T=input(),split()
A,B map(int, input(),split())
U = input()
if S==U:
  A-=1
elif T==U:
  B-=1
print(A,B)

### FIXED CODE ###

S, T = input().split()
A, B= map(int, input().split())
U = input()
if S == U:
    print(A - 1, B)
else:
    print(A, B - 1)
s = input()
s_list=("Sunny","Cloudy","Rainy")
tom = s_list.index(s)+1
print(s_list[tom])


### FIXED CODE ###

s = input()
s_list=("Sunny","Cloudy","Rainy","Sunny")
tom = s_list.index(s)+1
print(s_list[tom])
S=sum(N/2(N-1))
print(S)

### FIXED CODE ###

N=int(input())
result = 0;
for i in range(1,N+1):
    result += i
        
print(result)
n=int(input())
ans=1000000000
for i in range(0,n+1,6):
  j=n-i
  while j:
    a=j%9
    j//=9
  while i:
    a+=i%6
    i//=6
  ans=min(a,ans)
prgnt(ans)

### FIXED CODE ###

n=int(input())
ans=1000000000
for i in range(0,n+1,6):
  j=n-i
  a=0
  while j:
    a+=j%9
    j//=9
  while i:
    a+=i%6
    i//=6
  ans=min(a,ans)
print(ans)
n = input()
s = list(map(int, input.split()))
ans = 0

while all(a%2==0, for a in s):
  ans +=1
  for a in s:
    s = a/2

print(ans)


### FIXED CODE ###

n = input()
s = list(map(int, input().split()))
ans = 0

while all(a%2==0 for a in s):
  ans +=1
  s = [a/2 for a in s]

print(ans)
s = input().split()
a = list(s)
if a[2] == a[3] and a[4] == a[5]:
    print("Yes")
else:
    print("No")    


### FIXED CODE ###

s = input()
a = list(s)
if a[2] == a[3] and a[4] == a[5]:
    print("Yes")
else:
    print("No")
import sys
N,M=map(int,input().split())
Ai=[]
Bi=[]
for i in range(N):
    Ai.append(input())
for i in range(M):
    Bi.append(input())
roop=N-M+1
for i in range(roop):
    for j in range(roop):
        #print("")
        flag=1
        for k in range(roop):
            #print(Ai[i+k][j:j+M])
            if(Ai[i+k][j:j+M]!=Bi[k]):
                flag=0
                break;
        if(flag==1):
            print("Yes")
            sys.exit()
print("No")


### FIXED CODE ###

import sys
N,M=map(int,input().split())
Ai=[]
Bi=[]
for i in range(N):
    Ai.append(input())
for i in range(M):
    Bi.append(input())
roop=N-M+1
for i in range(roop):
    for j in range(roop):
        #print("A")
        flag=1
        for k in range(M):
            #print(Ai[i+k][j:j+M])
            if(Ai[i+k][j:j+M]!=Bi[k]):
                flag=0
                break;
        if(flag==1):
            print("Yes")
            sys.exit()
print("No")
n,m=map(int,input().split())
ac_cnt = set()
wa_cnt = 0
penalty = [0]*n
for i in range(m):
    p,s = input().split()
    num = p - 1
    if num not in ac_cnt:
        if s == "AC":
            ac_cnt.add(num)
            wa_cnt += penalty[num]
        else:
            penalty[num] += 1
print(len(set(ac_cnt)),wa_cnt)
    

### FIXED CODE ###

n,m=map(int,input().split())
ac_cnt = set()
wa_cnt = 0
penalty = [0]*n
for i in range(m):
    p,s = input().split()
    num = int(p) - 1
    if num not in ac_cnt:
        if s == "AC":
            ac_cnt.add(num)
            wa_cnt += penalty[num]
        else:
            penalty[num] += 1
print(len(set(ac_cnt)),wa_cnt)
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7

def mapline(t = int):
    return map(t, sysread().split())
def mapread(t = int):
    return map(t, read().split())

def run():
    N, *A = mapread()
    ans = 1
    current = [0,0,0]
    for a in A:
        transition = 0
        cache = None
        for i, c in enumerate(current):
            if c == a:
                transition += 1
                cache = i
        ans *= transition
        ans %= mod
        current[cache] += 1
        #print(current)
    print(ans)

if __name__ == "__main__":
    run()


### FIXED CODE ###

# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7

def mapline(t = int):
    return map(t, sysread().split())
def mapread(t = int):
    return map(t, read().split())

def run():
    N, *A = mapread()

    dp = [defaultdict(lambda:0) for _ in range(N+1)]
    dp[0][(0,0,0)] = 1
    for i in range(N):
        a = A[i]
        k = i + 1
        for key in dp[k-1].keys():
            for ii, v in enumerate(key):
                if v == a:
                    tmp = list(key)
                    tmp[ii] += 1
                    dp[k][tuple(tmp)] += dp[k-1][key] % mod
    ans = 0
    for key in dp[N].keys():
        ans = (ans + dp[N][key]) % mod
    #print(dp)
    print(ans)


if __name__ == "__main__":
    run()
inp = int(input())
if inp>=400 and inp<=599:
  ans = 8
elif inp>=600 and inp<=799:
  ans = 7
elif inp>=800 and inp<=999:
  ans = 6
elif inp>=1000 and inp<=1199:
  ans = 5
elif inp>=1200 and inp<=1399:
  ans = 4
elif inp>=1400 and inp<=1599:
  ans = 3
elif inp>=1600 and inp<=1799:
  ans = 2
elif inp>=1800 and inp<=1999:
  ans = 1
print(ans)

### FIXED CODE ###

import math
def better(l, ans):
    for i in range(2, n):
        ans[i] = min(ans[i - 1] + abs(l[i]-l[i - 1]), ans[i - 2] + abs(l[i]-l[i - 2]))
    return ans
n = int(input())
l = list(map(int, input().split()))
ans = [0] * n
ans[1] = abs(l[1]-l[0])
print(better(l, ans)[len(ans)-1])
s=input()
if s.sorted() == 'abc':
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s=input()
if 'a' in s and 'b' in s and 'c' in s:
  print('Yes')
else:
  print('No')
S = str(input())
l = len(S)
a = int(0)
b= int(0)
ans = [0]*l
ansc=int(0)
ansv=int(0)
ansi=int(0)

newS = S.split('LR')

k = len(newS)

for i in range(k):
    if i ==0:
        a = newS[i].count('R')
        b = len(newS[i])-a
        ansc = (a+1)//2 + b//2 +1
        ansv = a//2 + (b+1)//2
        ansi += newS[i].index('RL')
        ans[ansi]=ansc
        ans[ansi+1]=ansv
        ansi = len(newS[i])

    elif i < k-1:
        a = newS[i].count('R')
        b = len(newS[i])-a
        ansc = (a)//2 + (b+1)//2 + 1
        ansv = (a+1)//2 + (b)//2 + 1
        if 'RL' in newS[i]:
            ansi += newS[i].index('RL')+1
        else:
            ansi +=1
        ans[ansi]=ansc
        ans[ansi+1]=ansv
        ansi += (len(newS[i])+1)
    else:
        a = newS[i].count('R')
        b = len(newS[i]) - a
        ansc = (a) // 2 + (b+1) // 2
        ansv = (a+1) // 2 + (b) // 2 + 1
        ansi += newS[i].index('RL')+2
        ans[ansi] = ansc
        ans[ansi + 1] = ansv


print(' '.join(map(str, ans)))


### FIXED CODE ###

#from collections import deque
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7

S = str(input())
N = len(S)
ans = [0]*N
k = int(1)
R = []
L = []
rcount = int(1)
lcount = int(0)
lLocate = []
for i in range(1,N):
    if S[i]==S[i-1]:
        if k == 1:
            rcount +=1
        else:
            lcount +=1
    else:
        if k==1:
            R.append(rcount)
            lLocate.append(i-1)
            lcount = int(1)
        else:
            L.append(lcount)
            rcount = int(1)

        k *= (-1)


L.append(lcount)

#print(R)
#print(L)
#print(lLocate)
j = int(0)
#for i in range(N):
#    if i in lLocate:
for i in lLocate:
    r = R[j]
    l = L[j]
    ans[i] = (r+1)//2 + l//2
    ans[i+1] = r//2 + (l+1)//2
    j +=1

print(' '.join(map(str, ans)))
a, b = map(int, input().sprit())

if (a * b) % 2 == 0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

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


if (a * b) % 2 == 0:
  print('Even')
else:
  print('Odd')
import queue 
n,m = map(int, input().split())

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

ans = 0
def dfs(i):
  global ans
  if all(reach[1:]):
    ans += 1
  for j in ma[i]:
    if reach[j] == 1:
      continue
    reach[j] = 1
    dfs(j)
    reach[j] = 0

reach=[0]*(n+1)
reach[1] = 1
dfs(1)
print(ans)

### FIXED CODE ###

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

ma = [[] for i in range(n+1)]
for i in range(m):
  a,b = map(int, input().split())
  ma[a].append(b)
  ma[b].append(a)

ans = 0
def dfs(i):
  global ans
  if all(reach[1:]):
    ans += 1
  for j in ma[i]:
    if reach[j] == 1:
      continue
    reach[j] = 1
    dfs(j)
    reach[j] = 0

reach=[0]*(n+1)
reach[1] = 1
dfs(1)
print(ans)
import numpy as np

N = int(input())

ans = 0
for i in range(1, int(np.sqrt(N)) + 1):
    if N % i != 0:
        continue
    m = N//i - 1
    if m <= i:
        continue
    if N % m == 0:
        continue
    ans += m
print(ans)

### FIXED CODE ###

import numpy as np

N = int(input())

ans = 0
for i in range(1, int(np.sqrt(N)) + 1):
    if N % i != 0:
        continue
    m = N//i - 1
    if m <= i:
        continue
    if N % m == 0:
        continue
    ans += m
print(ans)
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]

from operator import itemgetter
AB.sort(key = itemgetter(1),reverse = True)
AB.sort(key = itemgetter(0),reverse = True)


memo = {}
import sys
sys.setrecursionlimit(10**5 + 1)
def dp(i,j):
        if (i,j) in memo:
                return memo[(i,j)]
        elif i == M or j == N:
                return 0
        a,b = AB[j]
        if i <= M - a:
                return max(dp(i+1,j+1) + b, dp(i,j+1))
        return dp(i,j+1)
print(dp(0,0))

### FIXED CODE ###

import heapq
from operator import itemgetter

def main():
    N, M = map(int,input().split())
    AB = [list(map(int,input().split())) for _ in range(N)]
    AB.sort(key = itemgetter(0))
    heap = []
    ans = 0
    cnt = 0
    for i in range(1,M + 1):
        while cnt < N and AB[cnt][0] <= i:
            heapq.heappush(heap,-1*AB[cnt][1])
            cnt += 1
        if len(heap) > 0:
            ans += heapq.heappop(heap)*-1
    print(ans)
    return

if __name__ == "__main__":
    main()
if int(input())==1:
  print("Hello World")
else:
  A,B=map(int,input().split())
  print(A+B)

### FIXED CODE ###

if int(input())==1:
  print("Hello World")
else:
  A = int(input())
  B=int(input())
  print(A+B)
#ABC126D-EvenRelation.py

from sys import stdin
from functools import lru_cache

input = stdin.readline

N = int(input())

UVW = []

for i in range(N-1):
    UVW.append(list(map(int, input().split())))

UVW.sort()

@lru_cache(maxsize=None)
def d(i):
    if i == 1:
        return 0
    else:
        for uvw in UVW:
            if uvw[0] == i:
                return d(uvw[1]) + uvw[2]
            elif uvw[1] == i:
                return d(uvw[0]) + uvw[2]

for i in range(N):
    if d(i+1) % 2 == 0:
        print(0)
    else:
        print(1)


### FIXED CODE ###

#ABC126D-EvenRelation.py

import sys
import collections
import numpy as np

def main():
    N = int(sys.stdin.readline())
    UVW = [[] for _ in range(N)]
    for _ in range(N-1):
        u, v, w = list(map(int, sys.stdin.readline().split()))
        UVW[u-1].append([v,w])
        UVW[v-1].append([u,w])
    answerList = [0] + [-1]*(N-1)
    edge = collections.deque([(1,0)])

    while edge:
        u, w1 = edge.pop()
        for v, w2 in UVW[u-1]:
            if answerList[v-1] == -1:
                answerList[v-1] = (w1 + w2) % 2
                edge.append((v,w1+w2))

    for answer in answerList:
        print(answer)



if __name__ == "__main__":
    main()
h, w = map(int, input().split())
S = [str(input()) for _ in range(h)]

#g = [[] for _ in range(h*w)]

n = h*w

def Find(x, par):
    if par[x] < 0:
        return x
    else:
        par[x] = Find(par[x], par)
        return par[x]

def Unite(x, y, par, rank):
    x = Find(x, par)
    y = Find(y, par)

    if x != y:
        if rank[x] < rank[y]:
            par[y] += par[x]
            par[x] = y
        else:
            par[x] += par[y]
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1

def Same(x, y, par):
    return Find(x, par) == Find(y, par)

def Size(x, par):
    return -par[Find(x, par)]

par = [-1]* n
rank = [0]*n

for y in range(h):
    for x in range(w):
        idx1 = y*w+x
        for dy, dx in (-1, 0), (1, 0), (0, -1), (0, 1):
            ny, nx = y+dy, x+dx
            if 0 <= ny < h and 0 <= nx < w:
                idx2 = ny*w+nx
                if S[y][x] != S[ny][nx]:
                    Unite(idx1, idx2, par, rank)

ans = 0
#print(par)
d = {}
for i in range(n):
    if par[i] < 0:
        d[i] = [0, 0]

for i in range(n):
    y, x = divmod(i, w)
    if i in d:
        if S[y][x] == '#':
            d[i][0] += 1
        else:
            d[i][1] += 1
    else:
        if S[y][x] == '#':
            d[par[i]][0] += 1
        else:
            d[par[i]][1] += 1

ans = 0
for k, v in d.items():
    ans += v[0]*v[1]
print(ans)


### FIXED CODE ###

h, w = map(int, input().split())
S = [str(input()) for _ in range(h)]

#g = [[] for _ in range(h*w)]

n = h*w

def Find(x, par):
    if par[x] < 0:
        return x
    else:
        par[x] = Find(par[x], par)
        return par[x]

def Unite(x, y, par, rank):
    x = Find(x, par)
    y = Find(y, par)

    if x != y:
        if rank[x] < rank[y]:
            par[y] += par[x]
            par[x] = y
        else:
            par[x] += par[y]
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1

def Same(x, y, par):
    return Find(x, par) == Find(y, par)

def Size(x, par):
    return -par[Find(x, par)]

par = [-1]* n
rank = [0]*n

for y in range(h):
    for x in range(w):
        idx1 = y*w+x
        for dy, dx in (-1, 0), (1, 0), (0, -1), (0, 1):
            ny, nx = y+dy, x+dx
            if 0 <= ny < h and 0 <= nx < w:
                idx2 = ny*w+nx
                if S[y][x] != S[ny][nx]:
                    Unite(idx1, idx2, par, rank)

ans = 0
#print(par)
X = [[0, 0] for _ in range(n)]
K = []

for i in range(n):
    y, x = divmod(i, w)
    if par[i] < 0:
        K.append(i)
        if S[y][x] == '#':
            X[i][0] += 1
        else:
            X[i][1] += 1
    else:
        if S[y][x] == '#':
            X[Find(i, par)][0] += 1
        else:
            X[Find(i, par)][1] += 1

ans = 0
for k in K:
    ans += X[k][0]*X[k][1]
print(ans)
# https://atcoder.jp/contests/abc122/tasks/abc122_c
import itertools

N, Q = map(int, input().split())
N = int(N)
S = input()
lr = []
for _ in range(Q):
    l, r = map(int, input().split())
    lr.append((l - 1, r - 1))
locations = []
for i in range(N - 1):
    if S[i] == 'A' and S[i + 1] == 'C':
        locations.append(i)
# print(locations)

for l, r in lr:
    subset = list(itertools.filterfalse(lambda x: x < l, locations))
    subset = list(itertools.filterfalse(lambda x: x > r, subset))
    # print(l, r, subset)
    num_substring = len(subset)
    # print('num_substring', num_substring)
    if subset[-1] == r:
        print(num_substring - 1)
    else:
        print(num_substring)


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
cnt = [0]
for i in range(2, len(S) + 1):
    if S[i - 2:i] == 'AC':
        v = cnt[-1] + 1
    else:
        v = cnt[-1]
    cnt.append(v)

# print('cnt', cnt)
for _ in range(Q):
    l, r = map(int, input().split())
    ans = cnt[r - 1] - cnt[l - 1]
    print(ans)
N = int(input())
HList = [int(i) for i in input().split(" ")]
stn = HList[0]
stn2 = HList[1]

count = 0
for i in range(len(HList)) :
    if i == 0 :
        count += 1
    elif (HList[i] >= stn and HList[i] >= stn2) and HList[i] >= HList[i-1] :
        count += 1

print(count)

### FIXED CODE ###

N = int(input())
HList = [int(i) for i in input().split(" ")]
stn = -1
count = 0

for i in range(len(HList)) :
    if HList[i] >= stn  :
        count += 1
    if stn < HList[i] :
        stn = HList[i]

print(count)
a = 1
while True:
	if a != 0:
		b = int(raw_input())
		print('Case ' + str(a) + ': ' + str(b))
		a += 1
		continue
	else:
		break

### FIXED CODE ###

a = int(1)
b = int(1)
while True:
	b = int(raw_input())
	if b != 0:
		print('Case ' + str(a) + ': ' + str(b))
		a += 1
		continue
	else:
		break
import str
S,T=map(chr, input(),split())
A,B map(int, input(),split())
U = chr(input())
if S==U:
  print(A-1 B)
elif T==U:
  print(A B-1)

### FIXED CODE ###

S, T = input().split()
A, B= map(int, input().split())
U = input()
if S == U:
    print(A - 1, B)
else:
    print(A, B - 1)
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
B = int(input())

outValue = 0
for n in range(N+1):
    inputList = []
    for c in str(n):
        inputList.append(int(c))

    if A <= sum(inputList) <= B:
        outValue += n

print(outValue)


### FIXED CODE ###

# -*- coding: utf-8 -*-
strList = list(map(int, input().split()))

N = strList[0]
A = strList[1]
B = strList[2]

outValue = 0
for n in range(N+1):
    strList = [int(c) for c in str(n)]
    if A <= sum(strList) <= B:
        outValue += n

print(outValue)