peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n = int(input())

rs=[]

for i in range(n):
  rs.append(input().split())
  rs[i][1]=int(rs[i][1])
  print(rs)
# Judge status: Accepted
def main():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())

    d = abs(A - B)
    s = V - W
    print('YES' if T * s >= d else 'NO')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,m = map(int,input().split())
print(max(0,n-2)*max(0,m-2))
# Judge status: Accepted
A, B, K = map(int, input().split())

tak = A
aok = B

if K < A:
    tak = A - K
elif A <= K < A + B:
    tak = 0
    aok = B - (K - A)
else:
    tak = 0
    aok = 0

print(tak, aok)
# Judge status: Accepted
n, m = map(int, input().split())
h = list(map(int, input().split()))

good = [True for _ in range(n)]

for _ in range(m):
	a, b = map(int, input().split())
	a -= 1
	b -= 1
	if (h[a] >= h[b]):
		good[b] = False
	if (h[b] >= h[a]):
		good[a] = False

print(len([i for i in good if i]))
# Judge status: Accepted
import itertools
import math
n = int(input())
a = [ int(x) for x in range(1,n+1)]
jun = list(itertools.permutations(a))
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]


sum = 0
for i in jun:
    for j in range(n-1):
        sum +=  math.sqrt((x[i[j]-1]-x[i[j+1]-1])**2 + (y[i[j]-1]-y[i[j+1]-1])**2)
print(sum/len(jun))
# Judge status: Accepted
c=input()
d=["a","e","i","o","u"]
if c in d:
  print("vowel")
else:
  print('consonant')
# Judge status: Accepted
from bisect import bisect_left

N = int(input())
L = sorted([int(i) for i in input().split()])

ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        ans += bisect_left(L, L[i]+L[j]) - (j + 1)

print(ans)
# Judge status: Accepted
def resolve():
    A,B,C,X = [int(input()) for i in range(4)]

    res = 0
    mA = min(X//500, A)
    for i in range(mA+1):
        Y = X - 500 * i
        mB = min(Y//100, B)
        for j in range(mB+1):
            Z = Y - 100 * j
            if Z <= 50*C:
                res += 1

    print(res)
    
resolve()
# Judge status: Wrong Answer
from collections import defaultdict

def solve():
    N = int(input())
    d = defaultdict(int)
    for _ in range(N):
        a = ''.join(sorted(list(input())))
        if a in d:
            d[a] += d[a]+1
        else:
            d[a] = 0
    return sum([i for i in d.values()])

print(solve())
# Judge status: Accepted
N, T = map(int, input().split())
CT = [list(map(int, input().split())) for _ in range(N)]

ans = 1001
for ct in CT:
    if ct[1] <= T:
        ans = min(ans, ct[0])

if ans == 1001:
    print('TLE')
else:
    print(ans)
# Judge status: Wrong Answer
n,k = map(int,input().split())

print(n%k + int(n/k))
# Judge status: Accepted
S = input()
l = len(S)
ans = "x" * l
print(ans)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))
ans = [i for i in range(1,n+1)]
cnt = 0

for i in range(n):
  if p[i] != ans[i]:
    cnt += 1
  if cnt > 2:
    print('No')
    exit()
    
print('Yes')
# Judge status: Wrong Answer
n, q = list(map(int, input().split()))
s =  input()
a = [0]*n

for i in range(1, n):
  if s[i-1] == "A":
    if s[i] == "C":
      a[i] = a[i-1]+1
  else:
    a[i] = a[i-1]

for i in range(q):
  b, c = list(map(int, input().split()))
  ans = a[c-1]-a[b-1]
  print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
x = sorted(map(int, input().split()))
if n >= m:
  print(0)
else:
  d = [x[i + 1] - x[i] for i in range(m - 1)]
  s = sorted(d, reverse=True)[:n - 1]
  i = [0] + [d.index(si) + 1 for si in s] + [0]
  ans = 0
  for k in range(n):
    ans += x[i[k + 1] - 1] - x[i[k]]
  print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 22 04:19:50 2020

@author: liang
"""

N = int(input())
A = [int(x) for x in input().split()]
d = [False]*8
count = 0
ans = 0
for a in A:
    if a//400 >= 8:
        count += 1
    else:
        if d[a//400] == False:
            ans += 1
            d[a//400] = True

if count == 0:
    print(ans,ans)
else:
    if ans == 0:
        print(1,count)
    else:
        print(ans,ans+count)
# Judge status: Wrong Answer
x=int(input())
ans=1+(-1)*x
print(x)
# Judge status: Accepted
X=int(input())

arr=[]
for i in range(0,640):
    arr.append(i**5)
    arr.append(-i**5)

arr2=[]
arr3=[]
import itertools
l=itertools.combinations_with_replacement(arr,2)
for i in l:
    arr2.append(i[0]-i[1])
    arr3.append([i[0],i[1]])
import math

ans=arr3[arr2.index(X)]
print(int(math.pow(abs(ans[0]), 1/5))*(1 if ans[0]>=0 else -1), int(math.pow(abs(ans[1]), 1/5))*(1 if ans[1]>=0 else -1))
# Judge status: Wrong Answer
import numpy as np
n,m = list(map(int, input().split()))
info = list(list(map(int, input().split())) for i in range(m))

info = np.array(info)
p,y = info[:,0],info[:,1]
y[np.argsort(y)] = np.arange(1,m+1)
for i in range(m):
    print(str(p[i]).zfill(6) + str(y[i] - min(y[p == p[i]]) + 1).zfill(6))
# Judge status: Accepted
from sys import stdin


def rec_z():
    for i in range(N):
        for j in range(Hmax+1):
            if j >= a[i]:
                dp[j] = min(dp[j], dp[j-a[i]] + b[i])
    return min(dp[H:Hmax+1])
 
 
readline=stdin.readline
H, N = map(int,readline().split())
a = []
b = []
for i in range(N):
    aa, bb = map(int, readline().split())
    a.append(aa)
    b.append(bb)
Hmax = H + max(a)
INF = 10**9
dp = [INF for _ in range(Hmax+1)] 
dp[0] = 0
print(rec_z())
# Judge status: Accepted
n, m = map(int, input().split())
move = [tuple(map(int, input().split())) for i in range(m)]

ball = [1] * (n+1)
red = [False] * (n+1)
red[1] = True

for x, y in move:
  ball[x] -= 1
  ball[y] += 1
  if red[x]: red[y] = True
  if ball[x] == 0: red[x] = False

ans = red.count(True)
print(ans)
# Judge status: Wrong Answer
a = input().split()
if int(a[0]+a[1]+a[2]) >= 22:
  print ("bust")
else:
  print("win")
# Judge status: Accepted
s=input()
q=int(input())
q_=[input() for i in range(q)]
l=[]
r=list(s)
reverse=False
for i in q_:
  if i=="1":
    reverse=not reverse
  elif (i.split()[1]=="1" and not reverse) or (i.split()[1]=="2" and reverse):
    l.append(i.split()[2])
  else:
    r.append(i.split()[2])
#print(l)
#print(r)
if reverse:
  print(''.join(r[::-1]+l))
else:print(''.join(l[::-1]+r))
# Judge status: Accepted
n,m = map(int,input().split())
input_lines = [int(l) for l in input().split()]

all_ = sum(input_lines)

if len([i for i in input_lines if i>=(all_/(4*m))])>=m:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
#abc133 c
L,R=map(int,input().split())
ans=0
R=min(R,L+2019*2)
ans=2018
amari=[]
for i in range(L,R+1):
    tmp=i%2019
    amari.append(tmp)
    if len(amari)==2019*2:
        break
for i in range(len(amari)):
    for j in range(len(amari)):
        if i==j:
            continue
        ans=min(ans,(amari[i]*amari[j]*2019))
        if ans==0:
            break
print(ans)
# Judge status: Accepted
length = int(input())
s = input()

if len(s) <= length:
  print(s)
else:
  print(s[:length]+'...')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

mod = 10 ** 9 + 7

res = 0
two_factor = 1
for i in range(60):
    cnt_1 = 0
    cnt_0 = 0
    for v in a:
        if (v >> i) & 1:
            cnt_1 += 1
        else:
            cnt_0 += 1
    res = (res + cnt_1 * cnt_0 % mod * two_factor % mod) % mod
    two_factor = two_factor * 2 % mod

print(res)
# Judge status: Accepted
X, Y = map(int, input().split())

a = X+0
ans = 0
while a <= Y:
    ans += 1
    a *= 2

print(ans)
# Judge status: Wrong Answer
s = input()
i = 0
ans = 1
while i < len(s)-1:
    if s[i] == s[i+1]:
        # s s* と切る
        i += 2
    else:
        # s *
        i += 1
    ans += 1
print(ans)
# Judge status: Accepted
def ans(s,t):
    for i in range(len(s)):
        s = s[-1] + s[:-1]

        if s == t:
            return "Yes"
    return "No"

s = input()
t = input()

ans = ans(s,t)

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

p, sx, sy = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    d, dx, dy = t - p, abs(x - sx), abs(y - sy)
    if (dx + dy) > d or (dx + dy - d) % 2 == 1:
        print("No")
        exit()
    p, sx, sy = t, x, y
else:
    print("Yes")
# Judge status: Accepted
S = input().split()
print('A'+S[1][0]+'C')
# Judge status: Accepted
import sys
N = int(input())
S = str(input())
if N <= 0 or N > 100:
    sys.exit()
x = 0
max = 0
for I in S:
    if I == "I":
        x += 1
        if max < x:
            max = x
        continue
    if I == "D":
        x -=1
        continue
print(max)
# Judge status: Wrong Answer
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
if n==1:
	print(0)
	exit()
mod = 10**9+7
a = pow(10,n,mod)
b = pow(8,n,mod)
c = pow(9,n,mod)
print(a-2*c+b)
# Judge status: Accepted
a, b, c = map(int, input().split())
y = False
for i in range(b):
    if (a*i)%b == c:
        y = True

if y:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
nb = int(input())
somme = 0
mmax = 0
for loop in range(nb):
  n,m = map(int,input().split())
  somme+=n
  if m>mmax:
    mmax = m
if somme<=mmax:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N = int(input())
S = input()
x = 0
A = []
for i in range(N):
    if S[i] == "I":
        x += 1
    else:
        x -= 1
    A.append(x)
print(max(A), 0)
# Judge status: Accepted
import math
a,b,x = [int(x) for x in input().split()]
if a*a*b/2>=x:
    z = a*b*b/2/x
    s = math.atan(z)
    print(math.degrees(s))
else:
    z = 2 * (a**2*b-x) / a**3
    s = math.atan(z)
    print(math.degrees(s))
# Judge status: Accepted
n = int(input())
listA = list(map(int, input().split()))
q = int(input())

totalSum = 0
numMap = {}
for a in listA:
    totalSum+=a
    if a in numMap:
        numMap[a]+=1
    else:
        numMap[a]=1

for i in range(q):
    b, c = map(int, input().split())
    if b in numMap:
        count = numMap[b]
        del numMap[b]
        if c in numMap:
            numMap[c]+=count
        else:
            numMap[c]=count
        totalSum+=c*count-b*count
    print(totalSum)
# Judge status: Accepted
N,K,Q=map(int,input().split())
A=[int(input()) for _ in range(Q)]

a=[K-Q]*N

for i in A:
    a[i-1]+=1


for j in a:
    if j>0:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
_ = int(input())
a = list(map(int, input().split()))
res = 0
while True:
    suma = int(sum(a))
    if suma % 2 == 0:
        a = list(map(lambda x: x / 2, a))
        res += 1
    else:
        print(res)
        break
# Judge status: Accepted
d = int(input())

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

s = []

for _ in range(d):
    temp = list(map(int,input().split()))

    s.append(temp)

for i in range(d):
    print(s[i].index(max(s[i])) + 1)
# Judge status: Accepted
P,Q,R=map(int,input().split())
if P<Q<R or Q<P<R:
    print(P+Q)
if Q<R<P or R<Q<P:
    print(Q+R)
if R<P<Q or P<R<Q:
    print(R+P)
if P==Q==R:
    print(P+Q)
if P==Q<R:
    print(P+Q)
if P==Q>R:
    print(R+P)
if Q==R<P:
    print(Q+R)
if Q==R>P:
    print(P+Q)
if R==P<Q:
    print(R+P)
if R==P>Q:
    print(Q+R)
# Judge status: Wrong Answer
n = int(input())
l = input().split(' ')
d = {}
for i in range(len(l)):
  d[i+1] = l[i]
result = []
d2 = sorted(d.items(),key=lambda x:x[1])
for item in d2:
  result.append(str(item[0]))

print(' '.join(result))
# Judge status: Accepted
import math
def main():
    n = int(input())
    mn = math.floor(n/1.08)
    mx = math.floor((n+1)/1.08)+1
    for i in range(mn, mx):
        if math.floor(1.08*i) == n:
            print(i)
            return 0
    print(':(')

main()
# Judge status: Accepted
X,N = map(int,input().split())
if(N==0):
    print(X)
else:
    P = [int(i) for i in input().split()]
    A = []
    for i in range(-100,201):
        if not i in P:
            A.append([abs(X-i),i])

    A.sort()
    s = A[0][0]
    B = [[i,j] for i,j in A if i==s]
    B.sort(key = lambda x:x[1])
    print(B[0][1])
# Judge status: Accepted
n = int(input())

if n < 1000:
    print('ABC')
else:
    print('ABD')
# Judge status: Wrong Answer
N = int(input())
 
 
# M=1
# A=[5,4,2,1]
 
cnt = 0
cnt1 = 0
 
# for i in range(N):
#     cnt = cnt + A[i]
#
# for i in range(N):
#     if A[i] / cnt > 1 / 4 / M:
#         cnt1 = cnt1 + 1
 
a1 = N % 10
a2 = ((N-a1*10) % 100)//10
a3 = ((N-a1*100-a2*10))//100
 
if a1 == 7 or a2 == 7 or a3 == 7:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
d, n = map(int, input().split())

cnt = 0
for i in range(1, 10**7+1):
    if i%(100**d) == 0:
        cnt += 1
    if cnt == n:
        print(i)
        exit()
# Judge status: Accepted
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


A, B, C, D = map(int, input().split(' '))
lcm_cd = lcm(C, D)


def count_target(n):
    c_multiples = n // C
    d_multiples = n // D
    cd_multiples = n // lcm_cd
    return n - c_multiples - d_multiples + cd_multiples


count2a = count_target(A - 1)
count2b = count_target(B)

print(count2b - count2a)
# Judge status: Wrong Answer
N = int(input())
div = N % 1000
exc = (div + 1)*1000 -N
print(exc)
# Judge status: Wrong Answer
x, y = [int(i) for i in input().split()]

gr = [4,6,9,11]
gr2 = [1,3,5,7,8,10.12]

if (x ==2) | (y ==2):
    print("No")
    
elif (x in gr) & (y in gr):
    print("Yes")
elif (x in gr2) & (y in gr2):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
a , b = 2 , 1
for i in range (N - 1):
    a , b = b, a+b
print(b)
# Judge status: Accepted
n ,r = input().split(" ")
n = int(n)
r = int(r)
if n < 10:
    print( r + 100 * (10 - n))
else:
    print(r)
# Judge status: Accepted
N, K = map(int, input().split())
l = []
cmin = 0
cmax = 0
for i in range(K, N+2):
  cmin = 0
  cmax = 0
  cmin = i * (i-1) / 2
  cmax = (2*N - i + 1) * i / 2
  dif = cmax - cmin + 1
  l.append(dif)
print(int(sum(l)%(10**9 + 7)))
# Judge status: Accepted
def main():
    A, B, C = map(int, input().split())
    K = int(input())
    while B <= A:
        B *= 2
        K -= 1
    while C <= B:
        C *= 2
        K -= 1
    if K >= 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
# Judge status: Accepted
for i in range(365):
  print((i+5)%26+1)
# Judge status: Wrong Answer
n,a,b = map(int, input().split())
mod = 10**9+7

akai=1
nakai=n
bkai=1
nbkai=n
for i in range(2,a+1):
  akai=(akai%mod)*(i%mod)
  nakai=(nakai%mod)*((n-i+1)%mod)
for i in range(2,b+1):
  bkai=(bkai%mod)*(i%mod)
  nbkai=(nbkai%mod)*((n-i+1)%mod)
akai=akai%mod
bkai=bkai%mod
nakai=nakai%mod
nbkai=nbkai%mod
nakai=nakai*pow(akai,mod-2,mod)
nbkai=nbkai*pow(bkai,mod-2,mod)
print((pow(2,n,mod)-nakai-nbkai)%mod)
# Judge status: Wrong Answer
def myAnswer(X:int,Y:int) -> int:
   if(X == Y):return 0
   if(X == 0):return Y if(Y >= 0) else abs(Y) + 1
   if(X > 0):
      if(Y == 0):
         return X + 1
      return abs(Y - X) if (Y > 0) else abs(abs(Y) - X) + 1
   if(X < 0):
      if(Y == 0):
         return abs(X)
      return 2 + abs(Y - X) if(Y < 0) else abs(Y - abs(X)) + 1

def modelAnswer():
   return
def main():
   X,Y = map(int,input().split())
   print(myAnswer(X,Y))
if __name__ == '__main__':
   main()
# Judge status: Accepted
n=int(input())
l_list=[int(i) for i in input().split()]

if max(l_list)<sum(l_list)-max(l_list):
    print("Yes")
    
else:
    print("No")
# Judge status: Wrong Answer
n=int(input())
s=input()
s=list(s)
r=[]
g=[]
b=[]
for i in range(n):
    if s[i]=="R":
        r.append(i)
    elif s[i]=="G":    
        g.append(i)
    else:
        b.append(i)
print(r)       
print(g)    
print(b)    
cnt=0    
for j in r:
    for l in g:
        if (2*l-j) or (2*j-l) in b:
            cnt+=1
print(len(r)*len(g)*len(b)-cnt+1)
# Judge status: Wrong Answer
n = int(input())
prev = 0
res = 0
for _ in range(n):
    x = int(input())
    #print(res,x)
    res += x // 2
    x = x % 2
    if x == 1 and prev == 1:
        res += 1
        prev = 0
    pres = x
print(res)
# Judge status: Accepted
n = int(input())
a = n % 10
if a == 2 or a == 4 or a == 5 or a == 7 or a == 9 :
 print ("hon")
elif a == 0 or a == 1 or a == 6 or a == 8 :
 print ("pon")
else :
 print ("bon")
# Judge status: Accepted
d,t,s=map(int,input().split())
if (t>=d/s):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

print("{} {}".format(a-1, b)) if s == u else print("{} {}".format(a, b-1))
# Judge status: Accepted
n,m=map(int,input().split())
A=[int(input()) for _ in range(m)]
DP=[0]*(n+1)
DP[0]=1
DP[1]=1

for a in A:
	DP[a]=-1
	
if DP[1]==-1:DP[1]=0

for i in range(n-1):
		if DP[i+2]<0:
			DP[i+2]=0
		else:
			DP[i+2]=DP[i+1]+DP[i]

print(DP[n]%1000000007)
# Judge status: Accepted
N=int(input())
alise=0
bob=0
a_list=list(map(int,input().split()))
a_sort=sorted(a_list)
for i in range(N,0,-2):
    alise+=a_sort[i-1]
for i in range(N-1,0,-2):
    bob+=a_sort[i-1]
print(alise-bob)
# Judge status: Wrong Answer
A, B= map(int, input().split())

if A==1:
    A = 14

if B==1:
    B=14

if A > B:
    print("Alicce")
elif B < A:
    print("Bob")
else :
    print("Draw")
# Judge status: Wrong Answer
S=input()
for i in range(len(S)//4):
    print(i)
    if not S[i]==S[-i-len(S)//2-2]==S[i+len(S)//2+1]==S[-i-1]:
        exit()
print("Yes")
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
x.sort(reverse=True)

ans = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        a, b = x[i], x[j]
        left, right = j + 1, n
        while right - left > 1:
            k = (left + right) // 2
            if a < b + x[k]:
                left = k
            else:
                right = k
        if a < b + x[left]:
            ans += (left - j)

print(ans)
# Judge status: Accepted
C = [[int(i) for i in input().split()] for _ in range(3)]

D = [[] for _ in range(4)]
for i in range(2):
    for j in range(3):
        D[i].append(C[i+1][j] - C[i][j])
        D[i+2].append(C[j][i+1] - C[j][i])

for d in D:
    if len(set(d)) != 1:
        print("No")
        break
else:
    print("Yes")
# Judge status: Wrong Answer
import itertools

n = sorted([x+1 for x in range(int(input()))])
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
count = 0
pv = 0
qv = 0
for i in itertools.permutations(n,len(n)):
  count += 1
  if i == p:
    pv = count
  elif i == q:
    qv = count

print(abs(pv-qv))
# Judge status: Wrong Answer
def resolve():
    N = int(input())
    B = list(map(int, input().split()))
    B = [10**3] + B + [10**3]
    curr_sum = 0
    for i in range(1, len(B)):
        curr_sum += min(B[i-1], B[i])
    print(curr_sum)

resolve()
# Judge status: Accepted
N, K = [int(i) for i in input().split()]
h = sorted([int(input()) for _ in range(N)])

ans = float("inf")
for i, h_i in enumerate(h):
    if i + K - 1 == N:
        break
    ans = min(ans, h[i + K - 1] - h_i)
print(ans)
# Judge status: Accepted
from collections import Counter
from math import factorial

def count_combinations(n, r):
    return factorial(n) // (factorial(r) * factorial(n-r))

n = int(input())
s = []
for _ in range(n):
    s.append(input())

t = [''.join(sorted(str)) for str in s]
c = Counter(t)
ll = [i for _, i in c.items() if i > 1]
cnt = 0
for i in ll:
    cnt += count_combinations(i, 2)

print(cnt)
# Judge status: Accepted
N, K, S = map(int, input().split())
MOD = 10 ** 9
num = S + 1 if S < MOD else S - 1 
ans = [S] * K + [num] * (N - K)
print(*ans)
# Judge status: Wrong Answer
import itertools

N=int(input())
L=[0]*(10**4+10)
X=[x for x in range(1,11)]
plus=[0,1,3,6]

for v in itertools.combinations_with_replacement(X,3):
  x,y,z=v[0],v[1],v[2]
  temp=len(set(v))
  L[x**2+y**2+z**2+x*y+y*z+z*x]+=plus[temp]


for i in range(1,N+1):
  print(L[i])
# Judge status: Wrong Answer
n = [input() for _ in range(int(input()))]
m = [input() for _ in range(int(input()))]
l = list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i])))  for i in range(len(l)))
# Judge status: Wrong Answer
D=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(D):
  s.append(input().split())
  print(i+2)
#print(s)
# Judge status: Accepted
from collections import Counter
mod=10**9+7
n=int(input())
s=input()
c=Counter(s).values()
ans=1
for i in c:
    ans*=(i+1)
    ans%=mod
    
print(ans-1)
# Judge status: Wrong Answer
a,b,c =map(int,input().split())
print(["YES","NO"][a-b != c-b])
# Judge status: Accepted
a,b,c,d = list(map(int,input().split()))
max = a*c
if a*d>max:
    max = a*d
if b*c>max:
    max = b*c
if b*d>max:
    max = b*d

print(max)
# Judge status: Wrong Answer
N,M=map(int,input().split())
if N%2!=0:
    for i in range(M):
        print((N//2)-i,(N//2)+1+i)
else:
    for i in range(M):
        print((N//2)-i,(N//2)+i+1)
# Judge status: Accepted
n, k, x, y = [int(input()) for i in range(4)]
if n >= k:
  print(k*x + (n-k) * y)
else:
  print(n * x)
# Judge status: Wrong Answer
from itertools import groupby
n = list(input())
k = int(input())
if n == 1:
    print(1)
    exit()
li = []
for key,v in groupby(n):
    li.append(list(v))

if li[0][0] == "1":
    if len(li[0])>= k:
        print(1)

for i in range(len(n)):
    if n[i] != "1":
        print(n[i])
        break
# Judge status: Accepted
a,b = map(int, input().split())

if a ==1:
    a =14

if b ==1:
    b =14

if a>b:
    print("Alice")
elif a ==b:
    print("Draw")
else:
    print("Bob")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = [0] * N

for i in range(N - 1, -1, -1):
    B[i] = (sum(B[2 * (i + 1) - 1::i + 1]) % 2) ^ A[i]

print(sum(B))
print(*[i+1 for i in range(N) if B[i] == 1])
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
ans = False

for i in range(N-M):
  for j in range(N-M):
    flg = True
    for k in range(M):
      if A[i+k][j:j+M] != B[k]:
        flg = False
    if flg:
      ans = True

if ans:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N = 26
D = int(input())
C = [int(i) for i in input().split()]

S = []
for i in range(D):
  s = [int(i) for i in input().split()]
  m = max(s)
  i = s.index(m)
  S.append(i)

for i in S:
  print(i)
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
if B - A <= 2 * K:
    for i in range(A, B + 1):
        print(i)
    exit()

for i in range(A, B + 1):
    if i <= A + K - 1:
        print(i)
        continue
    if i >= B - K + 1:
        print(i)
        continue
# Judge status: Accepted
n, k = map(int, input().split())
h = [int(input()) for i in range(n)]

h.sort()

ans = 10000000000000000

for i in range(n-k+1):
  if ans > h[i+k-1]-h[i]:
    ans = h[i+k-1]-h[i]

print(ans)
# Judge status: Wrong Answer
#import
import math
#import numpy as np
modnum = 10 ** 9 + 7
S = int(input())

def mod(num):
    return num % modnum

dp = [0] * (S + 20)
dp[0] = 1

for i in range(S + 10):
    for j in range(3, 10):
        dp[i + j] = mod(dp[i + j] + dp[i])


print(dp[S])
# Judge status: Accepted
from math import *
n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse = True)
ans = 0
for i in range(1,n):
	ans+=a[i//2]
print(ans)
# Judge status: Accepted
N,R = map(int,input().split())

if N >= 10:
  print(R)
else:
  print(R + 100 * (10 - N))
# Judge status: Accepted
n,m=map(int,input().split())
road=[]

for i in range(m):
  x=[int(j) for j in input().split()]
  road.extend(x)
for k in range(1,n+1):
  print(road.count(k))
# Judge status: Accepted
import math
n,k=map(int,input().split())
ans=0
t=n
for i in range(1,n+1):
    t=i
    p=1/n
    while t<k:
        p=p*(1/2)
        t=t*2
    ans+=p
print(ans)
# Judge status: Wrong Answer
import numpy as np
n,k=map(int,input().split())
a=list(map(int, input().split()))
a=np.array(a)
hyou=np.zeros(n)
hyou[k-1]=np.prod(a[:k+1])
for i in range(k,n):
    hyou[i]=hyou[i-1]*a[i]//a[i-k]
    if hyou[i]>hyou[i-1]:
        print('Yes')
    else:
        print('No')