Harryxun/stf_run huggingface dataset:
s = int(input())
p = [1]*(s+1)
mod = 10**9 + 7

p[1] = 0
p[2] = 0
if s >= 3
	for i in range(3,s+1):
		p[i] = (sum(p[:i-2]))%mod
print(p[s])

### FIXED CODE ###

s = int(input())
p = [0]*(s+1)
mod = 10**9 + 7
p[0] = 1

if s >= 3:
	for i in range(3,s+1):
		p[i] = (sum(p[:i-2]))%mod
print(p[s])
#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

# sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
start =  26
n = int(input())
ans = []
if n % 26 == 0:
    flag = True
while n:
    ans.append(n%26)
    n //= 26
# print(ans)
ans = ans[::-1]
if flag:
    ans [0] -= 1
    if ans[0] == 0:
        del ans[0]
for i in ans:
    if i == 0:
        i = 26
    printspx(chr(i+ord('a')-1))



'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

### FIXED CODE ###

#                           जय श्री राम

import sys; import math; from collections import *
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)

# sys.stdin  = open("input.txt","r"); sys.stdout = open("output.txt","w")

# for _testcases_ in range(int(input())):
n = int(input())
ans = []
while n:
    n -= 1
    n, r = divmod(n, 26)
    ans.append(chr(ord('a') + r))
print("".join(reversed(ans)))



'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''
n = int(input())
x = input()
pcnt = x.count("1")
pp = pcnt+1
pn = pcnt-1
ansb = [0,0,0]
def modpcnt(x):
  if x == 0:
    return 0
  b = x.bit_length()
  mod = 0
  for i in range(b):
    if x&1<<i:
      mod += 1
  return 1+modpcnt(x%mod)
for i in range(n):
  if x[i] == "1":
    ansb[1] += pow(2,n-i-1,pcnt)
    ansb[1] %= pcnt
    ansb[0] += pow(2,n-i-1,pp)
    ansb[0] %= pp
    ansb[2] += pow(2,n-i-1,pn)
    ansb[2] %= pn
for i in range(n):
  if x[i] == "0":
    tmp = (ansb[0]+pow(2,n-i-1,pp))%pp
    print(modpcnt(tmp)+1)
  else:
    tmp = (ansb[2]-pow(2,n-i-1,pn))%pn
    print(modpcnt(tmp)+1)

### FIXED CODE ###

n = int(input())
x = input()
pcnt = x.count("1")
pp = pcnt+1
pn = pcnt-1
ansb = [0,0,0]
def modpcnt(x):
  if x == 0:
    return 0
  b = x.bit_length()
  mod = 0
  for i in range(b):
    if x&1<<i:
      mod += 1
  return 1+modpcnt(x%mod)
for i in range(n):
  if x[i] == "1":
    ansb[1] += pow(2,n-i-1,pcnt)
    ansb[1] %= pcnt
    ansb[0] += pow(2,n-i-1,pp)
    ansb[0] %= pp
    if pn == 0:
      ansb[2] = 0
    else:
      ansb[2] += pow(2,n-i-1,pn)
      ansb[2] %= pn
for i in range(n):
  if x[i] == "0":
    tmp = (ansb[0]+pow(2,n-i-1,pp))%pp
    print(modpcnt(tmp)+1)
  else:
    if pn == 0:
      print(0)
    else:
      tmp = (ansb[2]-pow(2,n-i-1,pn))%pn
      print(modpcnt(tmp)+1)
input = input()[-1]
if input == '3':
    print('bon')
elif intpu in ['0', '1', '6', '8']:
    print('hon')
else:
    print('hon')

### FIXED CODE ###

input = input()[-1]
if input == '3':
    print('bon')
elif input in ['0', '1', '6', '8']:
    print('pon')
else:
    print('hon')
from sympy import gcd
a, b, k = map(int, input().split())
c = gcd(a,b)
count = 0
for i in range(1,c+1):
    if c%i == 0:
        count += 1
    if count == k:
        ans = i
        break
print(ans)


### FIXED CODE ###

a, b, k = map(int, input().split())
count = 0
ans = min(a,b)
while count != k:
    if a%ans == b %ans == 0:
        count += 1
    ans -= 1
print(ans+1)
# encoding:utf-8
import copy
import numpy as np
import random

n,q = map(int,input().split())
s = list(str(input()))
L = []
for i in range(q):
    l,r = map(int,input().split())
    L.append([l,r])

# count_ac = np.zeros([n])
count_ac = []
count = 0
i = 0
while True:
    if i>=n:
        count_ac.append(count)
        break
    if s[i] == "A" and s[i+1] == "C":
        count_ac.append(count)
        count += 1
        count_ac.append(count)
        i += 2
    else:
        count_ac.append(count)
        i += 1


# print(count_ac)
for i in range(q):
    ans = count_ac[L[i][1]-1]-count_ac[L[i][0]-1]
    print(int(ans))


### FIXED CODE ###

# encoding:utf-8
import copy
import numpy as np
import random

n,q = map(int,input().split())
s = list(str(input()))
L = []
for i in range(q):
    l,r = map(int,input().split())
    L.append([l,r])

# count_ac = np.zeros([n])
count_ac = []
count = 0
i = 0
while i < n-1:
    if s[i] == "A" and s[i+1] == "C":
        count_ac.append(count)
        count += 1
        count_ac.append(count)
        i += 2
    else:
        count_ac.append(count)
        i += 1

count_ac.append(count)


# print(count_ac)
for i in range(q):
    ans = count_ac[L[i][1]-1]-count_ac[L[i][0]-1]
    print(int(ans))
import fractions
n,m=map(int,input().split())
lis  = list(map(int,input().split()))
#aそれぞれを2で割ったものを持っておく
div = []
for i in range(n):
    div.append(lis[i]//2)
#lisそれぞれの要素を2で割り切れる回数をすべて数える
L = []
for i in range(n):
    cnt = 0
    while lis[i] %2 ==0:
        lis[i] //= 2
        cnt += 1
    L.append(cnt)

bl = True
for i in range(n-1):
    if L[0] != L[i+1]:
        bl = False
        print(0)
        exit()
#div内の最小子公倍数Tを求める
T = 0
ans = div[0]
for i in range(1,n):
    ans =ans*div[i]//fractions.gcd(ans,div[i])
    T = ans

S = m//T
if S %2 ==0:
    print(S//2)
else:
    print(S//2 +1)

### FIXED CODE ###

import fractions
n,m=map(int,input().split())
lis  = list(map(int,input().split()))
#aそれぞれを2で割ったものを持っておく
div = []
for i in range(n):
    div.append(lis[i]//2)
#lisそれぞれの要素を2で割り切れる回数をすべて数える
L = []
for i in range(n):
    cnt = 0
    while lis[i] %2 ==0:
        lis[i] //= 2
        cnt += 1
    L.append(cnt)

bl = True
#重複要素を削除して要素数でLがすべて一緒か判断
def set_list(es):
    return len(list(set(es))) == 1

if set_list(L) != 1:
    print(0)
    exit()

#div内の最小子公倍数ansを求める

ans = div[0]
for i in range(1,n):
    ans =ans*div[i]//fractions.gcd(ans,div[i])

S = m//ans
if S %2 ==0:
    print(S//2)
else:
    print(S//2 +1)
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
for i in range(k):
    h.pop()
print(sum(h))


### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
if n <= k:
    print(0)
    exit()
h.sort()
for i in range(k):
    h.pop()
print(sum(h))
N = list(input())
K = int(input())
for i in range(len(K)) :
  a = int(N[i])
  if a!=1:
    print(a)
    exit()
print(1)

### FIXED CODE ###

N = list(input())
K = int(input())
for i in range(K) :
  a = int(N[i])
  if a!=1:
    print(a)
    exit()
print(1)
import collections

def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

mod=10**9+7
n=int(input())
dic=collections.defaultdict(int)
cnt=0
for _ in range(n):
  a,b=map(int,input().split())
  if a!=0 and b!=0:
    g=gcd(abs(a),abs(b))
    if a*b>0:
      dic[(abs(a)//g,abs(b)//g)]+=1
    else:
      dic[(-abs(a)//g,abs(b)//g)]+=1
  else:
    if a==0 and b==0:
      cnt+=1
    elif a==0:
      dic[(0,1)]+=1
    elif b==0:
      dic[(1,0)]+=1
ans=1
s=set()
for a,b in dic.keys():
  if (a,b) in s:
    continue
  s.add((a,b))
  if a!=0 and b!=0:
    if a>0:
      s.add((-b,a))
      cnt1=dic[(a,b)]
      cnt2=dic[(-b,a)]
      ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
      ans%=mod
    elif a<0:
      s.add((b,-a))
      cnt1=dic[(a,b)]
      cnt2=dic[(b,-a)]
      ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
      ans%=mod
  else:
    s.add((b,a))
    cnt1=dic[(a,b)]
    cnt2=dic[(b,a)]
    ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
    ans%=mod
print((ans+cnt-1)%mod)

### FIXED CODE ###

def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

mod=10**9+7
n=int(input())
dic={}
cnt=0
for _ in range(n):
  a,b=map(int,input().split())
  if a!=0 and b!=0:
    g=gcd(abs(a),abs(b))
    if (a>0 and b>0) or (a<0 and b<0):
      if (abs(a)//g,abs(b)//g) not in dic:
        dic[(abs(a)//g,abs(b)//g)]=1
      else:
        dic[(abs(a)//g,abs(b)//g)]+=1
    elif (a<0 and b>0) or (a>0 and b<0):
      if (-abs(a)//g,abs(b)//g) not in dic:
        dic[(-abs(a)//g,abs(b)//g)]=1
      else:
        dic[(-abs(a)//g,abs(b)//g)]+=1
  else:
    if a==0 and b==0:
      cnt+=1
    elif a==0:
      if (1,0) not in dic:
        dic[(1,0)]=1
      else:
        dic[(1,0)]+=1
    elif b==0:
      if (0,1) not in dic:
        dic[(0,1)]=1
      else:
        dic[(0,1)]+=1
ans=1
s=set()
for a,b in dic.keys():
  if (a,b) in s:
    continue
  s.add((a,b))
  if a!=0 and b!=0:
    if a>0:
      if (-b,a) in dic:
        s.add((-b,a))
        cnt1=dic[(a,b)]
        cnt2=dic[(-b,a)]
        ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
        ans%=mod
      else:
        ans*=pow(2,dic[(a,b)])
        ans%=mod
    elif a<0:
      if (b,-a) in dic:
        s.add((b,-a))
        cnt1=dic[(a,b)]
        cnt2=dic[(b,-a)]
        ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
        ans%=mod
      else:
        ans*=pow(2,dic[(a,b)],mod)
        ans%=mod
  else:
    if (b,a) in dic:
      s.add((b,a))
      cnt1=dic[(a,b)]
      cnt2=dic[(b,a)]
      ans*=(pow(2,cnt1,mod)+pow(2,cnt2,mod)-1)%mod
      ans%=mod
    else:
      ans*=pow(2,dic[(a,b)],mod)
      ans%=mod
print((ans+cnt-1)%mod)
N,K=map(int,input().split())
A=list(map(int,input().split()))
a=0
cnt=0
anlist=[]
while True:
  if A[A[a]-1]==1:
    break
  else:
    anlist.append(A[A[a]-1])
    a=A[a]-1
    cnt+=1
res=N%cnt
ans=anlist[res]
print(ans)  

### FIXED CODE ###

N,K,*A=map(int, open(0).read().split())
x=1
C=[None]*N
C[0]=0
c=0
while c<K:
    x=A[x-1]
    c+=1
    if C[x-1] is None:
        C[x-1]=c
    else:
        a=C[x-1]
        b=c-a
        K=(K-a)%b+a+b
        while c<K:
            x=A[x-1]
            c+=1
        break
print(x)
total = 0
  if A < B:
    total += B
    if A < B - 1:
      total += B - 1
    else:
      total += A
  elif:
    total += A
    if B < A - 1:
      total += A - 1 
    else:
      total += B
  else:
    total = A + B
    

### FIXED CODE ###

a,b=map(int,input().split())
print(max(a+b,2*a-1,2*b-1))
A, B, C, X, Y = map(int, input().split())

price = min(A*X+B*Y, C*2*max(x, y))

is_break = 0
for a in range(X+1):
    if is_break:
        break
    for b in range(Y+1):
        if is_break:
            break
        for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b) + 1):
            if price >= A*a+B*b+C*c:
                price = A*a+B*b+C*c
                is_break = 1
                break

print(price)


### FIXED CODE ###

A, B, C, X, Y = map(int, input().split())

price = min(A*X+B*Y, C*2 * (max(X, Y)))

is_break = 0

for i in range(100000):
    if price >= A*max(0, X - i) + B*max(0, Y - i)+2*C*i:
        price = A*max(0, X - i) + B*max(0, Y - i)+2*C*i
print(price)
from sys import stdin
def main():
    N, K = [int(x) for x in stdin.readline().rstrip().split()]
    A = [int(x) for x in stdin.readline().rstrip().split()]
    if A[0] == 1:
        print(1)
        exit() 
    X=1
    Log = [1]
    for i in range(K):
      X = A[X-1]
      if (X in Log) ==True:
        break
      Log += [X]
        #print(Log)
        #print(K - Log.index(X))
        #print(i - Log.index(X)+1)
    K = (K - Log.index(X))%(i - Log.index(X)+1)
    #print(K)
    print(Log[Log.index(X)+K])    
main()

### FIXED CODE ###

from sys import stdin
import numpy as np
 
def main():
    N, K = [int(x) for x in stdin.readline().rstrip().split()]
    A = [int(x) for x in stdin.readline().rstrip().split()]
    X = 1
    L = [1]
    if A[0] == 1:
        print(1)
        exit()
    if N >= K :
        for i in range(K):
            X = A[X-1]
        print(X)
        exit()
    else:
        for i in range(N):
            X = A[X-1]
            L += [X]
        #print('L',L)#OK
        C = np.zeros(N)
        for i in range(N):
            if C[L[i]-1] == 0:
                C[L[i]-1] += 1
                #print('C,i',C,i)
            else:
                break
        #print('C',C)
        #print('i+1',i+1)#Roop 回数　When Roop Goal
        #print('L[i+1]',L[i+1])#Roop initial Number
        S = L.index(L[i+1])
        #print('S',S)#When Roop Start ,Roop times
        #print(K - i-1)#Remain K
        #print('i + 1 -S',i + 1 - S)#Roop Cycle
        K = (K - i-1)%(i+1 - S)
        #print(K)
        print(L[S+K])
        
main()
N=int(input())
S=["" for i in range(N)]

for i in range(N):
    S[i]=input()


count=0

for l in range(N):
    for j in range(N):
        for k in range(j+1,N):
            JUDGE=1
            
            kk=(k+l)%N
            if S[j][kk]!=S[N-1-kk][N-1-j-l]:
                JUDGE=0


    if JUDGE==1:
        count+=1
    

print(count*N)


### FIXED CODE ###

N=int(input())
S=["" for i in range(N)]

for i in range(N):
    S[i]=input()

count=0

for l in range(N):
    JUDGE=1
    for j in range(N):
        for k in range(j+1,N):
            
            if S[j][k-l]!=S[k][j-l]:
                JUDGE=0
                break
        if JUDGE==0:
            break

    if JUDGE==1:
        count+=1

print(count*N)
n, k, x, y = [int(input()) for i in range(3)]
print(x*k + y*(n-k))


### FIXED CODE ###

n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n > k:
    print(k*x + (n - k)*y)
else:
    print(n*x)
N,K = map(int, input().split())
A = list(map(int, input().split()))

A.sort
for i in range(K):
  A.pop()
print(sum(A))

### FIXED CODE ###

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

A.sort()
if N > K:
  for i in range(K):
    A.pop()
  print(sum(A))
else:
  print("0")
N = input()
A = input()

amari = N % 500
if amari <= A:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

N = int(input())
A = int(input())
 
amari = N % 500
if amari <= A:
  print("Yes")
else:
  print("No")
inp = int(input())
li = [0]
i = 0
while i == 0:
  te = inp/2
  if te.is_integer():
    pass
  else:
    te = inp * 3 + 1
  if te in li:
    print(int(len(li)+1))
    i = 1
  li.append(te)
  inp = te

### FIXED CODE ###

inp = [int(i) for i in input().split()]
ru = inp[0] * inp[1] / 2
print(int(ru))
lst=[]
N=int(input())
h = map(int, input().split())
c=1
A=list(h)
B=len(A)
for i in range(B):
 if len(lst)==A[i]:
  lst.append(1)
 else:
  lst[A[i]]+=1
 if A[i]==0:
  c*=1
 else:
  c*=(lst[A[i]-1]-lst[A[i]]+1)
if lst[0]==1:
 c*=3
else:
 c*=6
print(c%1000000007)


### FIXED CODE ###

N=int(input())
A= list(map(int,input().split()))
B=[0,0,0]
C=1
for i in range(N):
 E=0
 F=0
 for j in range(3):
  if A[i]==B[j]:
   E+=1
   if E==1:
    B[j]+=1
    F=j
 C*=E
 C%=1000000007
print(C)
n,k = map(int,input().split())
ls = list(map(int,input().split()))
dp = [100000000] *n
dp[0] = 0
dp[1] = abs(ls[1]-ls[0])
p = inf
for i in range(2,n):
    for j in range(i-k,i):
        if (dp[j] >= p) or (abs(ls[j] - ls[i]) >= p):
            pass
        else:
            a = dp[j] + abs(ls[j] - ls[i])
            if a < p:
                p = a
                a = 0
            else:
                a = 0
    dp[i] = p
    p = 100000000
print(dp[n-1])

### FIXED CODE ###

n,k = map(int,input().split())
ls = list(map(int,input().split()))
dp = [10000000000] *n
dp[0] = 0
dp[1] = abs(ls[1]-ls[0])
p = 10000000000
for i in range(2,n):
    for j in range(i-k,i):
        if (dp[j] >= p) or (abs(ls[j] - ls[i]) >= p):
            pass
        else:
            a = dp[j] + abs(ls[j] - ls[i])
            if a < p:
                p = a
                a = 0
            else:
                a = 0
    dp[i] = p
    p = 10000000000
print(dp[n-1])
x,y=map(int,input().split())
if x>y:
  print(">")
elif x<y:
  print("<")
else:
  print("=")

### FIXED CODE ###

x,y=map(str,input().split())
if ord(x)>ord(y):
  print(">")
elif ord(x)<ord(y):
  print("<")
else:
  print("=")
from sys import stdin

k = int(stdin.readline().rstrip())
s = int(stdin.readline().rstrip())
count = 0

x = 0
y = 0
z = 0

for x in range(s+1):
    y = 0
    for y in range(s+1):
        z = 0
        z = s - x - y
        if x <= k and y <= k and z<= k and 0 <= z:
            count +=1
            print(x,y,z)

print(count,flush=True)



### FIXED CODE ###

from sys import stdin
lis =[]
#k = int(stdin.readline().rstrip())
lis= stdin.readline().rstrip().split()
k = int(lis[0])
s = int(lis[1])
count = 0
x = 0
y = 0
z = 0
for x in range(k+1):
    y = 0
    for y in range(k+1):
        z = 0
        z = s - x - y
        if z <= k and z >= 0:
                count +=1



print(count)
def yomikata(N):
    N_firstdigit=N%10
    if N_firstdigit==3:
        print("bon")
    elif N_firstdigit==0 or 1 or 6 or 8:
        print("pon")
    else:
        print("hon")

yomikata(N)

### FIXED CODE ###

N=int(input())

def yomikata(N):
    N_firstdigit=N%10
    if N_firstdigit==3:
        print("bon")
    #elif N_firstdigit==0 or 1 or 6 or 8: このように条件は省略して書いてはだめらしい!
    elif N_firstdigit==0 or N_firstdigit==1 or N_firstdigit==6 or N_firstdigit==8:
        print("pon")
    else:
        print("hon")
        
yomikata(N)
N = int(input())
name = [0]*5
ans = 0
for i in range(N):
    a = input()
    if a[0] == 'M': name[0] += 1
    elif a[0] == 'A': name[1] += 1
    elif a[0] == 'R': name[2] += 1
    elif a[0] == 'C': name[3] += 1
    elif a[0] == 'H': name[4] += 1
if sum(name) < 3:
    print(0)
else:
    for i in combinations(name, 3):
        ans += i[0]*i[1]*i[2]
    print(ans)



### FIXED CODE ###

from itertools import combinations
N = int(input())
name = [0]*5
ans = 0
for i in range(N):
    a = input()
    if a[0] == 'M': name[0] += 1
    elif a[0] == 'A': name[1] += 1
    elif a[0] == 'R': name[2] += 1
    elif a[0] == 'C': name[3] += 1
    elif a[0] == 'H': name[4] += 1
if sum(name) < 3:
    print(0)
else:
    for i in combinations(name, 3):
        ans += i[0]*i[1]*i[2]
    print(ans)
#!/usr/bin/env python3
import bisect

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N = int(input())
    S = list(input())
    Q = int(input())

    L = [[] for x in range(26)] # i番目のリストは、アルファベットが現れるインデックスのリストを持つ。

    for idx, s in enumerate(S):
        L[ord(s)-ord("a")].append(idx)

    for _ in range(Q):
        row = input().split()
        if row[0] == '1':
            y, z = int(row[1])-1, row[2]
            idx_target = ord(S[y]) - ord("a")
            idx_del = bisect.bisect_left(L[idx_target], y)
            if idx_del < len(L[idx_target]):
                L[idx_target].pop(idx_del)
            bisect.insort(L[ord(z) - ord("a")], y)
            S[y] = z

        elif row[0] == '2':
            y, z = int(row[1]) - 1, int(row[2]) - 1
            answer = 0
            for idx_alphabet in range(ord("a"), ord("z")+1):
                left = bisect.bisect_left(L[idx_alphabet], y)
                if left < len(L[idx_alphabet]) and y <= L[idx_alphabet][left] <= z:
                    answer += 1
            print(answer)

    # Failed to predict input format
    pass

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import bisect

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N = int(input())
    S = list(input())
    Q = int(input())

    L = [[] for x in range(26)] # i番目のリストは、アルファベットが現れるインデックスのリストを持つ。

    for idx, s in enumerate(S):
        L[ord(s)-ord("a")].append(idx)

    for _ in range(Q):
        row = input().split()
        if row[0] == '1':
            y, z = int(row[1])-1, row[2]
            if S[y] != z:
                idx_target = ord(S[y]) - ord("a")
                idx_del = bisect.bisect_left(L[idx_target], y)
                if idx_del < len(L[idx_target]):
                    L[idx_target].pop(idx_del)
                bisect.insort(L[ord(z) - ord("a")], y)
                S[y] = z

        elif row[0] == '2':
            y, z = int(row[1]) - 1, int(row[2]) - 1
            answer = 0
            for idx_alphabet in range(26):
                left = bisect.bisect_left(L[idx_alphabet], y)
                if left < len(L[idx_alphabet]) and y <= L[idx_alphabet][left] <= z:
                    answer += 1
            print(answer)

    # Failed to predict input format
    pass

if __name__ == '__main__':
    main()
T=int(input())
N =[]

for i in range(T):
  x=0
  N = map(int,input().split())
  x += N[3]
  min = min(N)
if N[0] == 2:
	print(x + N[1])  
elif N[0] == 3:
      print(x + N[2])
elif N[0] == 5:
      print(x + N[3])
elif N[0] % min == 0:
      print(x + (min * ( N[0] / min)))
elif N[0] % min == 1:
      print(x + (min * ( N[0] / min) + N[3]))
        
      

### FIXED CODE ###

T = int(input())
for i in range(T):
    n, A, B, C, D = map(int, input().split())
    memo = {}
 
    def herasu(N):
        if N == 0:
            return 0
        if N == 1:
            return D
        if N in memo:
            return memo[N]
        m = 100000000000000000000000
        if N % 2 == 0:
            m = min([m, A + herasu(N//2)])
        else:
            m = min([m, A + herasu(N//2) + D])
            m = min([m, A + herasu(N//2 + 1) + D])
        if N % 3 == 0:
            m = min(m, B + herasu(N//3))
        else:
            m = min([m, B + herasu(N//3) + (N%3) * D])
            m = min([m, B + herasu(N//3 + 1) + (3-(N%3)) * D])
        if N % 5 == 0:
            m = min(m, C + herasu(N // 5))
        else:
            m = min([m, C + herasu(N//5) + (N%5) * D])
            m = min([m, C + herasu(N//5 + 1) + (5-(N%5)) * D])
        m = min([m, D * N])
        memo[N] = m
        return m
 
    print(herasu(n))
a,b = map(int, input().split())

print (int(a*b))

### FIXED CODE ###

a,b=map(int,input().replace('.', '').split())
print(a*b//100)
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
l=[0]*100000
ans=sum(A)

for i in A:
  l[i]+=1

for i in range(Q):
  b,c=map(int,input().split())
  ans=ans+(c-b)*l[b]
  l[c]+=l[b]
  l[b]=0
  print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
l=[0]*1000000
ans=sum(A)

for i in A:
  l[i]+=1

for i in range(Q):
  b,c=map(int,input().split())
  ans=ans+(c-b)*l[b]
  l[c]+=l[b]
  l[b]=0
  print(ans)
i = list(map(int,input().split()))

a = i[0]
b = i[1]

plus = a + b
minus = a - b
add = a * b
perse = a / b

list = [plus, minus, add, perse]

flag = True
for l in list :
    if flag :
        box = l
    else :
        if l >= box :
            box = l
print(box)

### FIXED CODE ###

i = list(map(int,input().split()))

a = i[0]
b = i[1]

plus = a + b
minus = a - b
add = a * b

list = [plus, minus, add]

flag = True
for l in list :
    if flag :
        box = l
        flag = False
    else :
        if l >= box :
            box = l
print(box)
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=list(Counter(a))
ans=0
for (i,x) in c:
  if i>x:
    ans+=x
  elif i<x:
    ans+=x-i
print(ans)

### FIXED CODE ###

from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(a)
c=list(c.items())
ans=0
for k in range(len(c)):
  i=c[k][0]
  x=c[k][1]
  if i>x:
    ans+=x
  elif i<x:
    ans+=x-i
print(ans)