peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
A, B, C ,D, E= map(int,input().split())

if A == 0:
    print(1)
elif B == 0:
    print(2)
elif C == 0:
    print(3)
elif D == 0:
    print(4)
else:
    print(5)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
num=[0,0,0]
for i in range(n):
    if a[i]%4==0:
        num[2]+=1
    elif a[i]%2==0:
        num[1]+=1
    else:
        num[0]+=1
if num[1]==0:
    if num[0]>num[2]+1:
        print("No")
    else:
        print("Yes")
elif num[0]>num[2]:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
n,k = map(int,input().split())

set_i = set()

for i in range(0,k,2):
  d = input()
  s = map(int,input().split())
  for s_ in s:
    set_i.add(s_)

print(n-len(set_i))
# Judge status: Accepted
n = int(input())
s = input()
cw = 0
cb = 0
di = []
a = -1
b = 0
mn = float("inf")
for i in range(n):
    if s[i] == ".":
        cw += 1
    else:
        di.append(i)
        cb += 1
for k in range(len(di)):
    if mn > cw - di[k] + 2*k:
        mn = cw - di[k] + 2*k
print(min(min(cw,cb),mn))
# Judge status: Accepted
a,b,c=map(int, input().split())
if a+b>=c:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import numpy as np
n = int(input())
a = list(map(int,input().split()))
a_sum = sum(a)
aa = np.array(a)
aaa = np.cumsum(aa)
aaa = aaa
all_a = sum(a)

ans = 0
for i in range(n-1):
    ans += (a[i]%(10**9+7) * (all_a - aaa[i]))

print(ans%(10**9+7))
# Judge status: Accepted
S = input()
C = ['dream', 'dreamer', 'erase', 'eraser']

while S:
    for c in C:
        if S.endswith(c):
            S = S[:-len(c)]
            break
    else:
        print('NO')
        break
else:
    print('YES')
# Judge status: Accepted
# coding: utf-8

X, Y, Z = map(int, input().strip().split())
A = Z
B = X
C = Y
print(A, B, C)
# Judge status: Accepted
import sys

stdin = sys.stdin

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

n = ni()

dp = [99999999]*(n+1)
dp[0] = 0
for i in range(1, n+1):
    dp[i] = dp[i-1] + 1
    k = 6
    while i-k >= 0:
        dp[i] = min(dp[i], dp[i-k]+1)
        k *= 6
    k = 9
    while i-k >= 0:
        dp[i] = min(dp[i], dp[i-k]+1)
        k *= 9
print(dp[n])
# Judge status: Accepted
import numpy as np 
a,b,x=map(int,input().split())
hanbun=a*a*b/2
if x<hanbun:
    teihen = x/(a*b/2)
    katamuki = b/teihen
    kakudo = np.rad2deg(np.arctan(katamuki))
else:
    teihen = (a*a*b-x)/(a*a/2)
    katamuki = teihen/a
    kakudo = np.rad2deg(np.arctan(katamuki))
print(kakudo)
# Judge status: Wrong Answer
from collections import defaultdict
N,M = map(int,input().split())
AC_List = defaultdict(int)
WA_List = defaultdict(int)

for i in range(M):
    Num,Sta = map(str,input().split())
    if Num in AC_List:
        continue
    else:
        if Sta == "WA":
            WA_List[Num] += 1
        else:
            AC_List[Num] += 1

print(str(len(AC_List))+" " +str(sum(WA_List.values())))
# Judge status: Accepted
def main():
    a,b,c=map(int, input().split())
    print(max(0, c-a+b))

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

N = input()

for ch in N:
    if ch == '7':
        print('Yes')
        sys.exit()
print('No')
# Judge status: Accepted
# coding: utf-8
s,t = input().split()
a,b = map(int, input().split())
u = input()

if u == s:
    print(a-1, b)
else:
    print(a,b-1)
# Judge status: Accepted
def solve():
    L, R = map(int, input().split())
    ans = 10 ** 10
    for i in range(L, min(L+2019, R)):
        for j in range(L+1, min(L+2019, R) + 1):
            ans = min(ans, i * j % 2019)
    return ans

print(solve())
# Judge status: Accepted
n = int(input())
ab = [[int(i) for i in input().split()] for _ in range(n)]
ans = 0
for i in range(n)[::-1]:
    if (ab[i][0]+ans)%ab[i][1]==0:
        y = 0
    else:
        y = ab[i][1] - ((ab[i][0]+ans)%ab[i][1])
    ans += y
print(ans)
# Judge status: Accepted
N = int(input())
S = [0]*N
for i in range(N):
  S[i] = input()
print(len(set(S)))
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
num = 0
for i in range(1, n-1):
    if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
        num += 1
print(num)
# Judge status: Wrong Answer
n,l= map(int, input().split())
lt=[]

for i in range(n):
    lt.append(abs(i+1+l-1))

lt.sort()

print(sum(lt[1:]))
# Judge status: Accepted
N = int(input())
MOD = 10**9+7
ans = 1

for i in range(N):
    ans *= i+1
    ans %= MOD

print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
c=list(map(int,input().split()))
c=[i for i in c if i>a/(4*b)]
if len(c)<b:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
def main():
    A, B = map(int, input().split())
    if A > 8 or B > 8:
        print(":(")
    else:
        print("Yay!")
if __name__ == "__main__":
    main()
# Judge status: Accepted
import math

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

ans = A[0]
for i in range(1, N):
  ans = math.gcd(A[i], ans)

print(ans)
# Judge status: Wrong Answer
#abc174_c

k=int(input())

# kの倍数が登場 -> 77...777%k==0となる最小の77の長さは？
if k%2==0:
    print(-1)
    exit()
if k==7:
    print(1)
    exit()

rem=7%k
for i in range(2,k+1):
    rem=(rem*10+7)%k
    if rem==0:
        print(i)
        exit()
print(-1)
# Judge status: Wrong Answer
n, m = map(int, input().split())
grida = []
gridb = []
for i in range(n):
    grida.append(list(input()))
for i in range(m):
    gridb.append(list(input()))

ans = False
for i in range(n-m):
    for j in range(n-m):
        bad = False 
        for k in range(m):
            for l in range(m):
                if grida[k+i][l+j] != gridb[k][l]:
                    bad = True
        if not bad:
            ans = True

if ans:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
import os

def file_input():
    f = open('ARC091/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    # int(input())
    N,M=map(int, input().split())

    if N==1 and M==1:
        print(1)
    elif N==1 or M==1:
        print(N*M-2)
    else:
        print(N*M-4-(N+M-4)*2)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N ,*A  = map(int,open(0).read().split())

L = [0 for i in range(N+1)]
D = [0 for i in range(N)]

for i,a in enumerate(A,1):
  L[i] = L[i-1] + a
for i in range(N):
  D[i] = L[-1]-L[i]
#L.pop(0)
  
print(L)
print(D)
ans = 1e19
for i in range(N):
  #print(L[i],D[i],L[i]-D[i])
  ans = min(abs(L[i]-D[i]),ans)
print(ans)
# Judge status: Accepted
def main():
    A, B, K = map(int, input().split())
    count = 0

    for i in range(100, 0, -1):
        if (A % i == 0) and (B % i == 0):
            count += 1
            if count == K:
                print(i)
                break
main()
# Judge status: Accepted
S = input()
T = input()

count = 0

for i in range(len(S)):
  if S[i] != T[i]:
  
    count += 1
  
print(count)
# Judge status: Accepted
n, r =map(int,input().split())
if n >= 10:
    print(r)
else:
    print(r+1000-100*n)
# Judge status: Accepted
*x,=map(input().count,"abc");print("YNEOS"[max(x)>-~min(x)::2])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
cnt = 1
ans = 0

if a.count(1) == 0:
    print(-1)
    exit()

for i in range(n):
    if a[i] != cnt:
        ans += 1
    else:
        cnt += 1
print(ans)
# Judge status: Accepted
S = input()
tmp = ""
for i in range(5):
    tmp += "hi"
    if tmp == S:
        print("Yes")
        exit()
print("No")
# Judge status: Accepted
from math import gcd

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

if N == 2:
    print(max(A))
else:
    r = max(gcd(A[0], A[1]), gcd(A[1], A[2]), gcd(A[2], A[0]))
    a = gcd(A[0], gcd(A[1], A[2]))

    for i in range(3, N):
        r = max(gcd(A[i], r), a)
        a = gcd(A[i], a)
        
    print(r)
# Judge status: Wrong Answer
# AtCoder Grand Contest 006
# A - Prefix and Suffix

N=int(input())
s=input()
t=input()

if s==t:
    print(N)
    exit()
else :
    pass
l=0

for i in range (N):
    if t[i]==s[-1*(i+1)]:
        pass
    else:
        l=i
        break

print(2*N-l)
# Judge status: Wrong Answer
a1, a2, a3 = map(int, input().split())
if 1 <= a1 <= 13 and 1 <= a2 <= 13 and 1 <= a3 <= 13:
    if a1 + a2 + a3 == 22:
        print('bust.')
    else:
        print('win.')
# Judge status: Wrong Answer
import sys
S=input()
first=S[0]
cnt=0
moji=[i for i in "abcdefghijklmnopqrstuvwxyz"]

if first=="A":
  for i in range(2,len(S)-1):
    if S[i]=="C":
      cnt+=1
    else:
      if (S[i] in moji)==False:
        print("WA")
        sys.exit()

  if cnt==1:
    print("AC")
  else:
    print("WA")
        
else:
  print("WA")
# Judge status: Wrong Answer
S = input()
T = input()
ans = 'No'
for i in range(len(S)):
    print(S, T)
    if S == T:
        ans = 'Yes'
        break
    S = S[-1] + S[:-1]
print(ans)
# Judge status: Accepted
n,k  = map(int,input().split())
S = input()
s = list(S)
ans = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        ans += 1
ans += 2*k
print(min(ans,n-1))
# Judge status: Wrong Answer
from fractions import Fraction
N , K = list(map(int,input().split()))
denom_list = []
Z=0


def detame_keisan( N , K , i ):
    kijun = 10
    score = i
    count = 0
    
    while score < kijun:
        count += 1
        score = ( score *  2 )
        
        print(count)
    return N * (2 ** count)

for i in range( 1,N+1 ):
    X = detame_keisan( N , K , i)
    denom_list.append( X )

for item in denom_list:
    Z += 1/item
print( Z )
# Judge status: Accepted
a, b, c, d = map(int, input().split())

ans = [a*c, a*d, b*c, b*d]
print(max(ans))
# Judge status: Accepted
y, m, d = input().split('/')
t = int(y + m + d)
if t <= 20190430:
    print('Heisei')
else:
    print('TBD')
# Judge status: Wrong Answer
n = int(input())
a = []
b = []

for i in range(n):
    x , y = map(int,input().split());
    a.append(x + y)
    b.append(abs(x - y))

aa = max(a)-min(a)
bb = max(b)-min(b)

if aa >= bb:
    print(aa)
else:
    print(bb)
# Judge status: Accepted
h,a=map(int,input().split())
print(h//a if h%a==0 else h//a+1)
# Judge status: Accepted
n = int(input())
h = [int(i) for i in input().split()]
x = True
c = 0
for i in range(n):
    if i > 0 and h[i - 1] - h[i] >= 2:
        x = False
        break
    elif i > 0 and h[i - 1] - h[i] == 1:
        c += 1
    elif i > 0 and h[i] > h[i - 1] and c == 1:
        c = 0
    if c == 2:
        x = False
        break
if x:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
m = {}
ans = 0
n = int(input())
def C(x:int) -> 'conbination_nC2':
	return x*(x-1)/2

for i in range(n):
	s = input()
	new_str = ''.join(sorted(s))
	if new_str in m.keys() :
		m[new_str] += 1
	else :
		m[new_str] = int(1)
	

for i in m:
	ans += C(m[i])

print(int(ans))
# Judge status: Accepted
n = int(input())
d = [int(xi) for xi in input().split()]

d = sorted(d)

print(d[int(n/2)]-d[int(n/2)-1])
# Judge status: Wrong Answer
Sp = input()
T = input()

if len(T) > len(Sp):
	print("UNRESTORABLE")
	exit()
if T in Sp:
	print(Sp.replace("?", "a"))
	exit()
	
oklist = []
for i in range(len(Sp) - len(T), -1, -1):
	for j in range(len(T)):
		if Sp[i + j] != "?" and Sp[i + j] != T[j]:
			break
	else:
		anspre = ["a" if Sp[k] == "?" else Sp[k] for k in range(i)]
		anssuf = ["a" if Sp[k] == "?" else Sp[k] for k in range(len(Sp) - j - i - 1)] 
		oklist.append("".join(anspre) + T + "".join(anssuf))

if oklist:
	print(min(oklist))
else:
	print("UNRESTORABLE")
# Judge status: Accepted
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()

score=0
kekka=[]

def Tensu(Aite):
  if Aite=="r":
    return P
  elif Aite=="s":
    return R
  else:
    return S


for i in range(N):
  if i<K:
    score+=Tensu(T[i])
    kekka.append(1)
  else:
    if T[i]!=T[i-K] or kekka[i-K]==0:
      score+=Tensu(T[i])
      kekka.append(1)
    else:
      score+=0
      kekka.append(0)
      
print(score)
# Judge status: Accepted
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
x= int(input())
if x == 0:
  print(1)
else:
  print(0)
# Judge status: Accepted
Q,H,S,D = map(int, input().split())
N = int(input())

if N % 2 == 0:
  print(min(Q*N*4,H*N*2,S*N,D*N//2))
else:
  N -= 1
  print(min(Q*N*4,H*N*2,S*N,D*N//2) + min(Q*4,H*2,S))
# Judge status: Wrong Answer
THP, TMP, AHP, AMP = map(int, input().split())
 
if TMP == AHP:
  print('Yes')

else:
  while AHP > 0 and THP > 0:
  
    AHP = AHP - TMP
    THP = THP - AHP
  
  if AHP > THP:
    print('Yes')

  else:
    print('No')
# Judge status: Wrong Answer
s = input()
maxCount = 0
count = 0

for i in s:
  if(i == 'R'):
    count += 1
  else:
    maxCount = max(count, maxCount)
    count = 0
    
print(maxCount)
# Judge status: Accepted
a,b=map(int,input().split())
print('Odd' if (a*b)%2==1 else 'Even')
# Judge status: Wrong Answer
# input
N = int(input())
W = [input() for n in range(N)]

# check
before = W[0]
for i in range(1, N):
    if W[i][0] != before[-1] or W[i] in W[:i]:
        print("No")
        exit(0)
print("Yes")
# Judge status: Accepted
N=int(input())
AC=0
WA=0
TLE=0
RE=0
for i in range(N):
  IN=input()
  if IN=='AC':
    AC+=1
  if IN=='WA':
    WA+=1
  if IN=='TLE':
    TLE+=1
  if IN=='RE':
    RE+=1
print('AC x ',AC)
print('WA x ',WA)
print('TLE x ',TLE)
print('RE x ',RE)
# Judge status: Accepted
n = int(input())
X = list(map(int,input().split()))
Y = sorted(X)
left = Y[n//2-1]
right = Y[n//2]

for i in X:
    if i <= left:
        print(right)
        
    else:
        print(left)
# Judge status: Accepted
n, m = map(int, input().split())
ps = [(input().split()) for _ in range(m)]

wa = [0] * (n + 1)
ac = [0] * (n + 1)

for p, s in ps:
    i = int(p)
    if s == "WA":
        if ac[i] != 1:
            wa[i] += 1
    else:
        if ac[i] != 1:
            ac[i] = 1

print(sum(ac), sum(wa[i] * ac[i] for i in range(n + 1)))
# Judge status: Accepted
#template
def inputlist(): return [int(j) for j in input().split()]
#template
N = int(input())
a = inputlist()
count = 0
for i in range(N):
    if i % 2 == 0 and a[i] % 2 == 1:
        count +=1
print(count)
# Judge status: Wrong Answer
n = int(input())
s = 0
for i in range(n):
  if i % 3 != 0 and i % 5 != 0:
    s += i
print(s)
# Judge status: Accepted
S = input()
T = input()

for i in range(len(S)):
    S = S[-1] + S[:-1]
    if S == T:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
import sys
import math
import bisect

def solve(n, m):
    for i in range(m + 1):
        if i > n:
            break
        if (n - i) % 500 == 0:
            return True
    return False

def main():
    n = int(input())
    m = int(input())
    if solve(n, m):
        print('Yes')
    else:
        print('No')

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

N, X = [int(_) for _ in input().split()]
L = [int(_) for _ in input().split()]

bounce_positions = list(itertools.accumulate([0]+L))
ans = sum(x <= X for x in bounce_positions)
print(ans)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
n, q = map(int,input().split())
s = input()

tmp = [0 for _ in range(n)]
for i in range(n - 1):
    if s[i] == 'A' and s[i + 1] == 'C':
        tmp[i] = 1
        tmp[i + 1] = 3
print(tmp)

for i in range(q):
    l, r = map(int,input().split())
    ans = sum(tmp[l-1:r])
    if tmp[l-1] == 3:
        ans -= 3
    if tmp[r-1] == 1:
        ans -= 1
    print(ans // 4)
# Judge status: Accepted
import math

n = int(input())

x = list(range(n))
y = list(range(n))
m = list(range(n))
l = list(range(n))
for i in range(n):
  x[i],y[i] = map(int,input().split())
  m[i] = x[i] - y[i]
  l[i] = x[i] + y[i]
m.sort()
l.sort()
res = max(m[n-1]-m[0], l[n-1]-l[0])
print(res)
# Judge status: Accepted
s = input()
s = list( map(int,s) )

ansa = 0
ansb = 0

a = 0 #01010101
b = 1 #10101010

for i in s:

  if i != a:
    ansa += 1
  
  if i != b:
    ansb += 1

  a = (a+1)%2
  b = (b+1)%2

print(min(ansa,ansb))
# Judge status: Accepted
s = input()
t = input()
ans = 10 ** 10
ls = len(s)
lt = len(t)
for i in range(ls - lt + 1):
    cnt = 0
    for j in range(lt):
        if s[i + j] != t[j]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)
# Judge status: Wrong Answer
a,b = input().split()

x = a * int(b)
y = b * int(a)

if int(x) <= int(y):
  print(x)
else:
  print(y)
# Judge status: Accepted
S = input()
if S[-1]=='s':
    print(S+'es')
else:
    print(S+'s')
# Judge status: Wrong Answer
S=input()
chk = [False, False, False]
if S[0]=="A":
    chk[0]=True

ind = 0
for i in range(2, len(S)):
    if S[i]=="C":
        chk[1]=True
        ind=i

chk[2]=True
for i in range(len(S)):
    if i==ind or i==0:
        continue
    if S[i].isupper():
        chk[2]=False

if chk[0] and chk[1] and chk[2]:
    print("AC")
else:
    print("WA")
# Judge status: Accepted
import sys
input = sys.stdin.readline


class AtCoder:
    def main(self):
        K, X = map(int, input().split())

        if 500 * K >= X:
            print("Yes")
        else:
            print("No")

# Run main
if __name__ == '__main__':
    AtCoder().main()
# Judge status: Accepted
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int,input().split()))
bucket_l = [0] * (2*n)
bucket_r = [0] * (2*n)
for i,v in enumerate(a):
    if v > n:
        continue
    if i-v >= 0:
        bucket_l[i-v]+=1
    bucket_r[i+v]+=1

ret = 0
for i,j in zip(bucket_l,bucket_r):
    ret+=i*j
print(ret)
# Judge status: Accepted
n, q = map(int, input().split())
s = input()
t = [0] * (n + 1)

for i in range(n):
    m = 0
    if s[i:i+2] == 'AC':
        m = 1
    t[i + 1] = t[i] + m

for _ in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
def calc_expect(n):
    return (n+1) / 2


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

p_expect_list = list(map(calc_expect, p_list))

max_val = 0

res = [0] * len(p_expect_list)
res[0] = p_expect_list[0]
for i in range(len(res)-1):
    res[i+1] = res[i] + p_expect_list[i+1]

for i in range(len(p_expect_list)-k):
    val = res[i+k]-res[i]
    if val > max_val:
        max_val = val

print(max_val)
# Judge status: Accepted
s = input()[::-1]
x = ["dream", "dreamer", "erase", "eraser"]
can = True
i = 0
for a in range(4):
    x[a] = x[a][::-1]
while(True):
    if(i == len(s)):
        break
    can2 = False
    for j in range (4):
        if(s[i:i+len(x[j])] == x[j]):
            can2 = True
            i += len(x[j])
    if(can2 == False):
        can = False
        break
print("YES" if can == True else "NO")
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))
 
A += [A[0] + K]
gap = max(y-x for x,y in zip(A, A[1:]))
print(K - gap)
# Judge status: Wrong Answer
h, n = map(int, input().split())
lis = []
wari = 0
dam = 0
mp = 0
use = 0
for l in range(n):
    a, b = map(int, input().split())
    lis.append([a, b])
    if wari < a / b :
        wari = a / b
        dam = a
        mp = b
use = (h // dam) * mp
h = h % dam
if h != 0:
    for l in range(n):
        if h <= lis[l][0] and mp >= lis[l][1]:
            mp = lis[l][1]
else:
    mp = 0
print(use + mp)
# Judge status: Accepted
N = int(input())

s = set()

for i in range(N):
	s.add(input())

print(len(s))
# Judge status: Wrong Answer
n = int(input())
c = input()
W_all = c.count("W")
R_all = c.count("R")
W_0 = c[0 : 0].count("W")
R_0 = c[0 : n].count("R")

tmp = n
W = W_0
R = R_0
for i in range(n):
    #print(W, R)
    if c[i] == "W":
        W += 1
        R = R
    elif c[i] == "R":
        W = W
        R -= 1

    if tmp >= max([W ,R]):
        tmp = max([W, R])

print(tmp)
# Judge status: Accepted
n = int(input())
w = list(input() for i in range(n))
s = True

for i in range(len(w)-1):
  if w[i][-1]!=w[i+1][0]:
    s = False
    break

ws = set(w)
if s and len(ws)==len(w):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
A,B,N=map(int,input().split())
if N>=B:
    N=B-1
    print(int(A*N/B)-(A*int(N/B)))
    exit()    
else:
    print(int(A*N/B))
    exit()
# Judge status: Wrong Answer
import sys
from collections import deque
import itertools


def input():
    return sys.stdin.readline().rstrip()


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


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if a % b == 0 and c != 0:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
  if i == 0:
    tmp = A[i]
  else:
    if tmp > A[i]:
      ans += (tmp - A[i])
    else:
      tmp = A[i]
print(ans)
# Judge status: Accepted
N,T,A,*H=map(int,open(0).read().split());v=[]
for i in H:
    v.append(abs(A-T+i*0.006))
print(v.index(min(v))+1)
# Judge status: Accepted
N = int(input())

al = [chr(ord('a') + i) for i in range(26)]
out = dict(zip(al,[100]*26))
# print(out)

for i in range(N):
    S = list(input())
    dam = dict(zip(al,[0]*26))
    for T in S:
        dam[T] += 1   #辞書Tに+1
    for key in out.keys():
        out[key] = min(out[key], dam[key])
    # print(dam)
outS = ""
for key in out.keys():
    # print(key)
    outS += key*out[key]
print(outS)
# Judge status: Accepted
h=int(input())
w=int(input())
n=int(input())
mx=max(h,w)
if n%mx==0:
 print(n//mx)
else:
 print(n//mx+1)
# Judge status: Wrong Answer
n, k = map(int, input().split())
List = list(map(int, input().split()))
score = []
max = 0
index = 0
res = 0

a = n - k + 1
b = k - 1

for i in range(a):
    for j in range(b):
        score.append(List[i+j])
    pre = sum(score)

    if max < pre:
        max = pre
        index = i
        pre = 0
    else:
        pre = 0
    score.clear()

for i in range(index, index+k):
    res += 1 + 0.5 * (List[i]-1)

print(res)
# Judge status: Accepted
N = int(input())
P = list(map(int,input().split()))

mi = P[0]
cnt = 1
for i in range(1,N):
    if P[i] <= mi:
        mi = P[i]
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
N, M = map(int,input().split())

A = []
for i in range(N):
  a,b = map(int,input().split())
  A.append([a,b])

A.sort()
print(A)

nokori = M
yen = 0
mise = 0
while nokori > 0:
  if A[mise][1] >= nokori: #i番目の店で何本買えるか
    yen += A[mise][0]*nokori
    break
  else:
    yen += A[mise][0]*A[mise][1]
    nokori -= A[mise][1]
    mise += 1
print(yen)
# Judge status: Accepted
s = list(input())
ans = "Good"
for i in range(3):
    if s[i] == s[i+1]:
        ans = "Bad"
        break
print(ans)
# Judge status: Wrong Answer
import math
N,K = map(int,input().split())


print(sum([(1/N)*(0.5)**math.ceil(math.log2(math.ceil(K/i))) if i<K else 1/N for i in range(1,N+1)]))
# Judge status: Wrong Answer
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

l = p[:x] + q[:y] + r
l.sort(reverse=True)

print(sum(l[:x+y]))
# Judge status: Accepted

from collections import Counter
def resolve():
    MOD = 10 ** 9 + 7
    N = int(input())
    S = input()

    CNT = Counter(S)
    ans = 1
    for v in CNT.values():
        ans *= v + 1
        ans %= MOD

    print(ans - 1)


if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
S = input().strip()
K = int(input())

ans = ""
for i, s in enumerate(S):
    if i == len(S) - 1:
        if ord(s) + K <= ord("z"):
            ans += chr(ord(s) + K)
        else:
            ans += chr(ord("a") + (ord(s) + K - ord("z") - 1) % 26)
        break
    if ord("z") + 1 - ord(s) <= K:
        ans += "a"
        K -= (ord("z") + 1 - ord(s))
    else:
        ans += s

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

    total = S.count('R') * S.count('G') * S.count('B')

    sub = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = 2 * j - i  # j-i = k-j を満たす k
            if j < k < N and S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                sub += 1
    return total - sub

print(d_rgb_triplets())